Skip to content

Commit 0f70cb6

Browse files
committed
Fix find_package(xsimd) for xtl enabled xsimd, reloaded
PR #788 fixes xtl lookup by adding the corresponding find_dependency call. However, there are still two issues remaining: - If xtl is not found, the INTERFACE_LINK_LIBRARIES property will make CMake interpret "xtl" as a .lib, pass it as a -l flag, and cause the build to fail. - If xtl is used, the required definition XSIMD_ENABLE_XTL_COMPLEX=1 is never passsed to downstream consumers. This commit fixes both issues, ensuring that if xtl was required at compile time, the Config module with not load unless xtl is also found. Fixes #869
1 parent 96a24ae commit 0f70cb6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,8 @@ OPTION(ENABLE_XTL_COMPLEX "enables support for xcomplex defined in xtl" OFF)
9696
OPTION(BUILD_TESTS "xsimd test suite" OFF)
9797

9898
if(ENABLE_XTL_COMPLEX)
99-
add_definitions(-DXSIMD_ENABLE_XTL_COMPLEX=1)
10099
find_package(xtl 0.7.0 REQUIRED)
100+
target_compile_definitions(xsimd INTERFACE XSIMD_ENABLE_XTL_COMPLEX=1)
101101
target_link_libraries(xsimd INTERFACE xtl)
102102
endif()
103103

xsimdConfig.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ if(NOT TARGET @PROJECT_NAME@)
2121
set(@PROJECT_NAME@_ENABLE_XTL_COMPLEX @ENABLE_XTL_COMPLEX@)
2222
if(@PROJECT_NAME@_ENABLE_XTL_COMPLEX)
2323
include(CMakeFindDependencyMacro)
24-
find_dependency(xtl)
24+
find_dependency(xtl REQUIRED)
2525
endif()
2626

2727
include("${CMAKE_CURRENT_LIST_DIR}/@[email protected]")

0 commit comments

Comments
 (0)