From 91e1562f1df39e242183b2f95d7f98798a129b80 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Fri, 20 Aug 2021 15:48:20 -0500 Subject: [PATCH 1/2] Fix external pugixml issue --- utils/CMakeLists.txt | 7 +------ utils/pugixml/CMakeLists.txt | 25 ++++++++++++++++--------- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt index 848d0b1da..bfaad48a6 100644 --- a/utils/CMakeLists.txt +++ b/utils/CMakeLists.txt @@ -13,11 +13,6 @@ target_include_directories(opts install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/opts" DESTINATION include) - -if(SENSEI_USE_EXTERNAL_pugixml) - find_package(pugixml REQUIRED COMPONENTS pugixml) -else () - add_subdirectory(pugixml) -endif() +add_subdirectory(pugixml) #add_subdirectory(ImageTester) diff --git a/utils/pugixml/CMakeLists.txt b/utils/pugixml/CMakeLists.txt index ce5142e13..66be96fd8 100644 --- a/utils/pugixml/CMakeLists.txt +++ b/utils/pugixml/CMakeLists.txt @@ -1,15 +1,22 @@ -add_library(pugixml STATIC src/pugixml.cpp) +if(SENSEI_USE_EXTERNAL_pugixml) + find_package(pugixml REQUIRED COMPONENTS pugixml) -target_include_directories(pugixml - INTERFACE $ - $) + add_library(pugixml INTERFACE) + install(TARGETS pugixml EXPORT pugixml) +else () + add_library(pugixml STATIC src/pugixml.cpp) -install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/" - DESTINATION include/pugixml FILES_MATCHING PATTERN "*.hpp") + target_include_directories(pugixml + INTERFACE $ + $) -install(TARGETS pugixml EXPORT pugixml - INCLUDES DESTINATION include/pugixml ARCHIVE DESTINATION lib - LIBRARY DESTINATION lib) + install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/src/" + DESTINATION include/pugixml FILES_MATCHING PATTERN "*.hpp") + + install(TARGETS pugixml EXPORT pugixml + INCLUDES DESTINATION include/pugixml ARCHIVE DESTINATION lib + LIBRARY DESTINATION lib) +endif () install(EXPORT pugixml DESTINATION lib/cmake EXPORT_LINK_INTERFACE_LIBRARIES) From cb904db87c88ffa275dab66d10f7bc20a0c4c6b3 Mon Sep 17 00:00:00 2001 From: Ryan Krattiger Date: Tue, 31 Aug 2021 14:08:16 -0500 Subject: [PATCH 2/2] Update installation when using external pugixml --- CMake/external.pugixml.cmake.in | 1 + utils/pugixml/CMakeLists.txt | 17 +++++++++++------ 2 files changed, 12 insertions(+), 6 deletions(-) create mode 100644 CMake/external.pugixml.cmake.in diff --git a/CMake/external.pugixml.cmake.in b/CMake/external.pugixml.cmake.in new file mode 100644 index 000000000..cc4b1e0bd --- /dev/null +++ b/CMake/external.pugixml.cmake.in @@ -0,0 +1 @@ +find_package(pugixml REQUIRED COMPONENTS pugixml) diff --git a/utils/pugixml/CMakeLists.txt b/utils/pugixml/CMakeLists.txt index 66be96fd8..39d2ecbf9 100644 --- a/utils/pugixml/CMakeLists.txt +++ b/utils/pugixml/CMakeLists.txt @@ -1,8 +1,13 @@ -if(SENSEI_USE_EXTERNAL_pugixml) +if (SENSEI_USE_EXTERNAL_pugixml) find_package(pugixml REQUIRED COMPONENTS pugixml) - add_library(pugixml INTERFACE) - install(TARGETS pugixml EXPORT pugixml) + configure_file("${CMAKE_SOURCE_DIR}/CMake/external.pugixml.cmake.in" + "${CMAKE_BINARY_DIR}/lib/cmake/pugixml.cmake" + @ONLY) + + install( + FILES "${CMAKE_BINARY_DIR}/lib/cmake/pugixml.cmake" + DESTINATION "lib/cmake") else () add_library(pugixml STATIC src/pugixml.cpp) @@ -16,7 +21,7 @@ else () install(TARGETS pugixml EXPORT pugixml INCLUDES DESTINATION include/pugixml ARCHIVE DESTINATION lib LIBRARY DESTINATION lib) -endif () -install(EXPORT pugixml DESTINATION lib/cmake - EXPORT_LINK_INTERFACE_LIBRARIES) + install(EXPORT pugixml DESTINATION lib/cmake + EXPORT_LINK_INTERFACE_LIBRARIES) +endif ()