FFTW / fftw3

DO NOT CHECK OUT THESE FILES FROM GITHUB UNLESS YOU KNOW WHAT YOU ARE DOING. (See below.)
GNU General Public License v2.0
2.76k stars 667 forks source link

3.3.9: CMake .pc file adds libm unconditonally #236

Open ax3l opened 3 years ago

ax3l commented 3 years ago

On Windows (and with some compilers like ICC/ICX), libm is added by the compiler.

With FFTW3 3.3.9 on Windows, I observed that on a CMake-based install, the generated .pc file adds libm unconditionally to the link dependencies. https://github.com/FFTW/fftw3/blob/fftw-3.3.9/fftw.pc.in#L10 https://github.com/FFTW/fftw3/blob/fftw-3.3.9/CMakeLists.txt#L409

This is a bug with MSVC on Windows and fails downstream linking, e.g. when picked up with:

find_package(PkgConfig REQUIRED QUIET)
pkg_check_modules(fftw3 REQUIRED IMPORTED_TARGET fftw3)
target_link_libraries(mytarget PkgConfig::fftw3)

Changing the unconditional search for libm in CMakeLists.txt by passing -DLIBM_LIBRARY=LIBM-NOTFOUND helps with the Config.cmake package, but the .pc package is then still broken: https://github.com/FFTW/fftw3/blob/fftw-3.3.9/CMakeLists.txt#L109 https://github.com/conda-forge/fftw-feedstock/pull/75

cc @junghans