From e3cfd89fe6e62aa579b4b1f6cc8eaa12046b4571 Mon Sep 17 00:00:00 2001 From: Alexander Vieth Date: Wed, 28 Aug 2024 15:47:09 +0200 Subject: [PATCH] CMake: OS independent flann linking --- hdi/dimensionality_reduction/CMakeLists.txt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/hdi/dimensionality_reduction/CMakeLists.txt b/hdi/dimensionality_reduction/CMakeLists.txt index 452e7e7..d410ba0 100644 --- a/hdi/dimensionality_reduction/CMakeLists.txt +++ b/hdi/dimensionality_reduction/CMakeLists.txt @@ -26,11 +26,15 @@ if(DEFINED ENV{CI}) target_include_directories(${PROJECT} PRIVATE ${flann_INCLUDE_DIR} ${lz4_INCLUDE_DIR}) else() message (STATUS "Flann path: " ${flann_DIR}) - if(WIN32) - target_link_libraries(${PROJECT} PRIVATE flann::flann_cpp_s) - else() - target_link_libraries(${PROJECT} PRIVATE flann::flann) + + if(TARGET flann::flann_cpp_s) + set(FLANN_TARGET flann::flann_cpp_s) + elseif(TARGET flann::flann) + set(FLANN_TARGET flann::flann) endif() + + message (STATUS "Flann link library: " ${FLANN_TARGET}) + target_link_libraries(${PROJECT} PRIVATE ${FLANN_TARGET}) endif() if(OpenMP_CXX_FOUND)