From f2fd3202eafa330b113f65889f7fbe8a687603c6 Mon Sep 17 00:00:00 2001 From: Elizaveta Morozova Date: Tue, 25 Jul 2023 12:06:42 +0300 Subject: [PATCH] itk-5.3.0-WebAssemblyInterface Avoid using FetchContent for dependencies, use system libraries instead. --- CMakeLists.txt | 21 +++++++++------------ src/CMakeLists.txt | 2 +- 2 files changed, 10 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4651c94d..cdb2a05b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -78,13 +78,6 @@ set(WITH_EXAMPLES OFF CACHE BOOL "Build libcbor examples") set(SANITIZE OFF CACHE BOOL "Enable sanitizers in Debug mode in libcbor") list(APPEND CMAKE_MODULE_PATH ${libcbor_SOURCE_DIR}/CMakeModules) -FetchContent_MakeAvailable(rapidjson_lib cli11 rang libcbor) -set(RapidJSON_INCLUDE_DIR "${rapidjson_lib_SOURCE_DIR}/include") -set(cli11_INCLUDE_DIR "${cli11_SOURCE_DIR}/include") -set(rang_INCLUDE_DIR "${rang_SOURCE_DIR}/include") -set(libcbor_INCLUDE_DIR "${libcbor_SOURCE_DIR}/src") -set(libcbor_EXPORT_DIR "${libcbor_BINARY_DIR}/src") -set(libcbor_CONFIGURATION_DIR "${libcbor_BINARY_DIR}/") set(BUILD_TESTING ${_itk_build_testing}) set(BUILD_SHARED_LIBS ${_itk_build_shared}) @@ -92,13 +85,20 @@ set(BUILD_SHARED_LIBS ${_itk_build_shared}) find_path(RapidJSON_INCLUDE_DIR NAMES rapidjson/document.h ) +find_path(cli11_INCLUDE_DIR NAMES CLI/CLI.hpp) +find_path(rang_INCLUDE_DIR NAMES rang.hpp) +find_path(libcbor_INCLUDE_DIR NAMES cbor.h) +find_library(CBOR_LIB + NAMES libcbor cbor + PATHS "/usr/lib" "/usr/lib32" "/usr/lib64") +add_library(cbor SHARED IMPORTED ${CBOR_LIB}) +set_property(TARGET cbor PROPERTY IMPORTED_LOCATION ${CBOR_LIB}) + set(WebAssemblyInterface_INCLUDE_DIRS ${RapidJSON_INCLUDE_DIR} ${cli11_INCLUDE_DIR} ${rang_INCLUDE_DIR} ${libcbor_INCLUDE_DIR} - ${libcbor_EXPORT_DIR} - ${libcbor_CONFIGURATION_DIR} ) list(APPEND WebAssemblyInterface_LIBRARIES cbor) @@ -113,6 +113,3 @@ if(NOT ITK_SOURCE_DIR) else() itk_module_impl() endif() -itk_module_target_label(cbor) -itk_module_target_export(cbor) -itk_module_target_install(cbor) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d14e9f69..0c4c3035 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -25,7 +25,7 @@ set(WebAssemblyInterface_SRCS itkSupportInputPolyDataTypes.cxx ) itk_module_add_library(WebAssemblyInterface ${WebAssemblyInterface_SRCS}) - +target_link_libraries(WebAssemblyInterface LINK_PUBLIC cbor) if(BUILD_ITK_WASM_IO_MODULES) if(EMSCRIPTEN) -- 2.33.8