Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Fix Finding EXPAT #12523

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions src/AnalyzeView/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,12 @@ if(TARGET ulog_cpp::ulog_cpp)
target_link_libraries(AnalyzeView PRIVATE ulog_cpp::ulog_cpp)
endif()

if(WIN32)
set(_EXPAT_INSTALL_OPTION ON)
else()
set(_EXPAT_INSTALL_OPTION OFF)
endif()

CPMAddPackage(
NAME EXPAT
VERSION 2.6.4
Expand All @@ -113,20 +119,24 @@ CPMAddPackage(
"EXPAT_BUILD_PKGCONFIG OFF"
"EXPAT_BUILD_TESTS OFF"
"EXPAT_BUILD_TOOLS OFF"
"EXPAT_ENABLE_INSTALL OFF"
"EXPAT_ENABLE_INSTALL ${_EXPAT_INSTALL_OPTION}"
"EXPAT_SHARED_LIBS OFF"
)

set(_EXIV2_ENABLE_XMP OFF)
if(EXPAT_ADDED)
find_package(expat CONFIG QUIET)
if(NOT TARGET expat::expat)
if(TARGET expat::expat)
add_library(EXPAT::EXPAT INTERFACE IMPORTED)
target_link_libraries(EXPAT::EXPAT INTERFACE expat::expat)
get_target_property(EXPAT_INCLUDES expat::expat INTERFACE_INCLUDE_DIRECTORIES)
if(EXPAT_INCLUDES)
target_include_directories(EXPAT::EXPAT INTERFACE ${EXPAT_INCLUDES})
set(_EXIV2_ENABLE_XMP ON)
endif()
else()
find_package(EXPAT MODULE)
if(EXPAT_FOUND)
if(NOT TARGET expat::expat)
add_library(expat::expat INTERFACE IMPORTED)
target_link_libraries(expat::expat INTERFACE EXPAT::EXPAT)
endif()
set(_EXIV2_ENABLE_XMP ON)
endif()
endif()
Expand Down
Loading