|
18 | 18 | @PACKAGE_INIT@ |
19 | 19 |
|
20 | 20 | if(NOT TARGET @PROJECT_NAME@) |
21 | | - set(@PROJECT_NAME@_ENABLE_XTL_COMPLEX @ENABLE_XTL_COMPLEX@) |
22 | | - if(@PROJECT_NAME@_ENABLE_XTL_COMPLEX) |
23 | | - include(CMakeFindDependencyMacro) |
24 | | - find_dependency(xtl REQUIRED) |
| 21 | + include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") |
| 22 | + get_target_property( |
| 23 | + @PROJECT_NAME@_INCLUDE_DIRS |
| 24 | + @PROJECT_NAME@ INTERFACE_INCLUDE_DIRECTORIES |
| 25 | + ) |
| 26 | + |
| 27 | + # xsimd <= 14 behaviour. |
| 28 | + # Packagers that configured xsimd for their users with ENABLE_XTL_COMPLEX |
| 29 | + # have it automatically enabled. |
| 30 | + # Can be removed in xsimd 15. Keeping it with a version check so we do not |
| 31 | + # miss the opportunity to remove it in the next major release. |
| 32 | + # Compared to legacy version, users can now override the check |
| 33 | + # with XSIMD_ENABLE_XTL_COMPLEX. |
| 34 | + if( |
| 35 | + @ENABLE_XTL_COMPLEX@ |
| 36 | + AND @XSIMD_VERSION_MAJOR@ LESS_EQUAL 14 |
| 37 | + AND NOT DEFINED XSIMD_ENABLE_XTL_COMPLEX |
| 38 | + ) |
| 39 | + # The next check will handle adding it to the target |
| 40 | + set(XSIMD_ENABLE_XTL_COMPLEX @ENABLE_XTL_COMPLEX@) |
25 | 41 | endif() |
26 | 42 |
|
27 | | - include("${CMAKE_CURRENT_LIST_DIR}/@PROJECT_NAME@Targets.cmake") |
28 | | - get_target_property(@PROJECT_NAME@_INCLUDE_DIRS @PROJECT_NAME@ INTERFACE_INCLUDE_DIRECTORIES) |
| 43 | + # Final users of xsimd in a package manager control whether or not to |
| 44 | + # enable xtl with this variable. |
| 45 | + if(XSIMD_ENABLE_XTL_COMPLEX) |
| 46 | + include(CMakeFindDependencyMacro) |
| 47 | + find_dependency(xtl 0.8.0 REQUIRED) |
| 48 | + target_link_libraries(@PROJECT_NAME@ INTERFACE xtl) |
| 49 | + target_compile_definitions( |
| 50 | + @PROJECT_NAME@ |
| 51 | + INTERFACE XSIMD_ENABLE_XTL_COMPLEX=1 |
| 52 | + ) |
| 53 | + endif() |
29 | 54 | endif() |
0 commit comments