Hi, I have added support for find_package(primesieve) to my primesieve library and I have exported 2 targets in my main CMakeLists.txt:
primesieve::libprimesieve (shared library) primesieve::libprimesieve-static It works fine if both the static and shared primesieve libraries have previously been installed. As a test I have now deleted the static libprimesieve from my PC and now find_package(primesieve) fails: CMake Error at /usr/local/lib/cmake/primesieve/primesieveTargets.cmake:88 (message): The imported target "primesieve::libprimesieve-static" references the file "/usr/local/lib/libprimesieve.a" but this file does not exist. Possible reasons include... The error seems reasonable but if I leave my code as is this error will be triggered if somebody installs the libprimesieve RPM package on Fedora or Red Hat Linux. The libprimesieve package contains only the shared libprimesieve. Fedora requires that static libraries are put into a separate package. Hence the static primesieve library is in libprimesieve-static. How can I solve this issue? If the shared libprimesieve is installed but the static libprimesieve is not installed then I would like to only export: primesieve::libprimesieve (shared library) But if both the static and shared libprimesieve are installed I would like to export: primesieve::libprimesieve (shared library) primesieve::libprimesieve-static Do you know any library which has already implemented this? Thanks, Kim
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake