Skip to content

Commit

Permalink
Add proper compile definition when XTL has been configured
Browse files Browse the repository at this point in the history
Basically so that -DENABLE_XTL_COMPLEX=On at configuration step implies
-DXSIMD_ENABLE_XTL_COMPLEX=1 for the tests.

Fix #942
  • Loading branch information
serge-sans-paille committed Oct 8, 2023
1 parent d5d58db commit 8d255bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
10 changes: 4 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -86,19 +86,17 @@ target_include_directories(xsimd INTERFACE
$<BUILD_INTERFACE:${XSIMD_INCLUDE_DIR}>
$<INSTALL_INTERFACE:include>)

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)
Expand Down
3 changes: 2 additions & 1 deletion test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 8d255bb

Please sign in to comment.