From 7c3b09869a7938bcf27dd49f4942b1d8cf827737 Mon Sep 17 00:00:00 2001 From: Sutou Kouhei Date: Thu, 7 Jul 2022 09:00:48 +0900 Subject: [PATCH] Fix find_package(xsimd) for xtl enabled xsimd If we enable xtl by -DENABLE_XTL_COMPLEX=ON, the xsimd CMake target depends on the xtl CMake target. (See installed xsimdTargets.cmake. You can find 'INTERFACE_LINK_LIBRARIES "xtl"' line in the file.) But installed xsimdConfig.cmake doesn't include find_dependency(xtl). If we don't run find_dependency(xtl) in xsimdConfig.cmake, the xtl CMake target isn't defined when users run find_package(xsimd). If the xtl CMake target isn't defined, "xtl" in 'INTERFACE_LINK_LIBRARIES "xtl"' is processed as library name not CMake target. If "xtl" is processed as library name, '-lxtl' is added to link command line. It causes link error because 'libxtl.so' doesn't exist. How to reproduce: 1. Install xsimd with -DENABLE_XTL_COMPLEX=ON: cmake -S . -B build -DCMAKE_INSTALL_PREFIX=/tmp/local -DENABLE_XTL_COMPLEX=ON cmake --build build --target install 2. Create a test project: xsimd_test.cc: #include int main(void) { return 0; } CMakeLists.txt: cmake_minimum_required(VERSION 3.1) project(xsimd_test) # Enable