Skip to content

Commit

Permalink
Fix FindRESVG for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
ferdnyc committed Jan 9, 2020
1 parent 0f47446 commit 08add08
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions cmake/Modules/FindRESVG.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -94,18 +94,28 @@ find_package_handle_standard_args(RESVG
# Export target
if(RESVG_FOUND AND NOT TARGET RESVG::resvg)
message(STATUS "Creating IMPORTED target RESVG::resvg")
add_library(RESVG::resvg SHARED IMPORTED)
if (WIN32)
# Windows mis-links SHARED library targets
add_library(RESVG::resvg UNKNOWN IMPORTED)
message(STATUS " UNKNOWN IMPORTED target for Win32")
else()
# Linux needs SHARED to link because libresvg has no SONAME
add_library(RESVG::resvg SHARED IMPORTED)
set_property(TARGET RESVG::resvg APPEND PROPERTY
IMPORTED_NO_SONAME TRUE)
message(STATUS " SHARED IMPORTED target with IMPORTED_NO_SONAME")
endif()

message(STATUS " INCLUDE_DIRECTORIES: ${RESVG_INCLUDE_DIRS}")
message(STATUS " COMPILE_DEFINITIONS: ${RESVG_DEFINITIONS}")
message(STATUS " IMPORTED_LOCATION: ${RESVG_LIBRARIES}")

set_target_properties(RESVG::resvg PROPERTIES
set_property(TARGET RESVG::resvg APPEND PROPERTY
INTERFACE_INCLUDE_DIRECTORIES "${RESVG_INCLUDE_DIRS}")

set_property(TARGET RESVG::resvg APPEND PROPERTY
INTERFACE_COMPILE_DEFINITIONS "${RESVG_DEFINITIONS}")

# libresvg.so doesn't have a SONAME
set_property(TARGET RESVG::resvg APPEND PROPERTY
IMPORTED_NO_SONAME TRUE)

set_property(TARGET RESVG::resvg APPEND PROPERTY
IMPORTED_LOCATION "${RESVG_LIBRARIES}")
endif()

0 comments on commit 08add08

Please sign in to comment.