From 8d255bb17b1e0c04c50519d136b6a1957502745f Mon Sep 17 00:00:00 2001 From: serge-sans-paille Date: Sun, 8 Oct 2023 21:00:36 +0200 Subject: [PATCH] Add proper compile definition when XTL has been configured Basically so that -DENABLE_XTL_COMPLEX=On at configuration step implies -DXSIMD_ENABLE_XTL_COMPLEX=1 for the tests. Fix #942 --- CMakeLists.txt | 10 ++++------ test/CMakeLists.txt | 3 ++- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4c7dcdb26..39e20a394 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -86,19 +86,17 @@ target_include_directories(xsimd INTERFACE $ $) -if (ENABLE_XTL_COMPLEX) - target_compile_features(xsimd INTERFACE cxx_std_14) -else() - target_compile_features(xsimd INTERFACE cxx_std_11) -endif() - OPTION(ENABLE_XTL_COMPLEX "enables support for xcomplex defined in xtl" OFF) OPTION(BUILD_TESTS "xsimd test suite" OFF) if(ENABLE_XTL_COMPLEX) find_package(xtl 0.7.0 REQUIRED) + target_compile_features(xsimd INTERFACE cxx_std_14) target_compile_definitions(xsimd INTERFACE XSIMD_ENABLE_XTL_COMPLEX=1) target_link_libraries(xsimd INTERFACE xtl) + message(STATUS: "xtl_INCLUDE_DIRS: ${xtl_INCLUDE_DIRS}") +else() + target_compile_features(xsimd INTERFACE cxx_std_11) endif() if(BUILD_TESTS) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index ff6da76d5..847b13881 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -191,7 +191,8 @@ else() endif() if(ENABLE_XTL_COMPLEX) -target_include_directories(test_xsimd PRIVATE ${xtl_INCLUDE_DIRS}) + add_compile_definitions(XSIMD_ENABLE_XTL_COMPLEX=1) + target_include_directories(test_xsimd PRIVATE ${xtl_INCLUDE_DIRS}) endif() add_test(NAME test_xsimd COMMAND test_xsimd)