From df785accc16f33f505b5c3b82cf40f48fc4db4a5 Mon Sep 17 00:00:00 2001 From: Olivier BICHLER <olivier.bichler@cea.fr> Date: Tue, 20 Feb 2024 16:04:53 +0100 Subject: [PATCH] Proper way of handling fmt dependency --- CMakeLists.txt | 3 ++- aidge_core-config.cmake.in | 10 ++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2a7884855..d26a511d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,6 +40,7 @@ FetchContent_Declare( set(FMT_SYSTEM_HEADERS ON) FetchContent_MakeAvailable(fmt) +set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON) ############################################## # Create target and set properties @@ -72,7 +73,7 @@ if (PYBIND) ) endif() -target_link_libraries(${module_name} PUBLIC fmt::fmt-header-only) +target_link_libraries(${module_name} PUBLIC fmt::fmt) target_compile_features(${module_name} PRIVATE cxx_std_14) if (DOSANITIZE STREQUAL "ON") diff --git a/aidge_core-config.cmake.in b/aidge_core-config.cmake.in index 24a44f513..9862b6405 100644 --- a/aidge_core-config.cmake.in +++ b/aidge_core-config.cmake.in @@ -1,13 +1,7 @@ @PACKAGE_INIT@ -Include(FetchContent) -FetchContent_Declare( - fmt - GIT_REPOSITORY https://github.com/fmtlib/fmt.git - GIT_TAG 10.2.1 # or a later release -) - -FetchContent_MakeAvailable(fmt) +include(CMakeFindDependencyMacro) +find_dependency(fmt) include(${CMAKE_CURRENT_LIST_DIR}/aidge_core-config-version.cmake) -- GitLab