Skip to content

Commit

Permalink
CMake: Check all known NanoSVG target names
Browse files Browse the repository at this point in the history
  • Loading branch information
MaartenBent committed May 10, 2022
1 parent 138d1ab commit 86b3360
Showing 1 changed file with 21 additions and 10 deletions.
31 changes: 21 additions & 10 deletions build/cmake/lib/nanosvg.cmake
Expand Up @@ -12,17 +12,28 @@ if(wxUSE_NANOSVG STREQUAL "builtin")
elseif(wxUSE_NANOSVG)
set(wxUSE_NANOSVG_EXTERNAL 1 PARENT_SCOPE)

set(NANOSVG_LIBRARIES )
set(NANOSVG_INCLUDE_DIRS )
set(wxUSE_NANOSVG_EXTERNAL_ENABLE_IMPL TRUE)

find_package(NanoSVG REQUIRED)

set(NANOSVG_LIBRARIES NanoSVG::nanosvgrast)
get_target_property(svg_incl_dir NanoSVG::nanosvg INTERFACE_INCLUDE_DIRECTORIES)
set(NANOSVG_INCLUDE_DIRS ${svg_incl_dir})
foreach(TARGETNAME NanoSVG::nanosvg NanoSVG::nanosvgrast unofficial::nanosvg)
if(NOT TARGET ${TARGETNAME})
continue()
endif()

get_target_property(svg_lib_d NanoSVG::nanosvgrast IMPORTED_LOCATION_DEBUG)
get_target_property(svg_lib_r NanoSVG::nanosvgrast IMPORTED_LOCATION_RELEASE)
get_target_property(svg_lib NanoSVG::nanosvgrast IMPORTED_LOCATION)
set(wxUSE_NANOSVG_EXTERNAL_ENABLE_IMPL TRUE)
if(svg_lib_d OR svg_lib_r OR svg_lib)
set(wxUSE_NANOSVG_EXTERNAL_ENABLE_IMPL FALSE)
endif()
list(APPEND NANOSVG_LIBRARIES ${TARGETNAME})
get_target_property(svg_incl_dir ${TARGETNAME} INTERFACE_INCLUDE_DIRECTORIES)
if(svg_incl_dir)
list(APPEND NANOSVG_INCLUDE_DIRS ${svg_incl_dir})
endif()

get_target_property(svg_lib_d ${TARGETNAME} IMPORTED_LOCATION_DEBUG)
get_target_property(svg_lib_r ${TARGETNAME} IMPORTED_LOCATION_RELEASE)
get_target_property(svg_lib ${TARGETNAME} IMPORTED_LOCATION)
if(svg_lib_d OR svg_lib_r OR svg_lib)
set(wxUSE_NANOSVG_EXTERNAL_ENABLE_IMPL FALSE)
endif()
endforeach()
endif()

0 comments on commit 86b3360

Please sign in to comment.