CMake FIND_LIBRARY: link to the specified library error

I already installed the FFTW3 library on my computer, and the following files can be found in / usr / lib:

libfftw3f.so.3 libfftw3l_threads.so.3 libfftw3f.so.3.3.0 libfftw3l_threads.so.3.3.0 libfftw3f_threads.so.3 libfftw3.so.3 libfftw3f_threads.so.3.3.0 libfftw3.so.3.3.0 libfftw3l.so.3 libfftw3_threads.so.3 libfftw3l.so.3.3.0 libfftw3_threads.so.3.3.0 

I want to install another package that should link these libraries, but when I try FIND_LIBRARY(FFTW3_LIBRARIES fftw3) and FIND_LIBRARY(FFTW3_LIBRARIES fftw3f) , it just cannot find the libraries.

How can i solve this? Thanks!

Code in CMakeLists.txt:

 FIND_PATH(FFTW3_INCLUDE_DIR fftw3.h) IF(FFLD_HOGPYRAMID_DOUBLE) FIND_LIBRARY(FFTW3_LIBRARIES libfftw3.so.3) ELSE() FIND_LIBRARY(FFTW3_LIBRARIES libfftw3f.so.3) ENDIF() #IF(NOT FFTW3_INCLUDE_DIR OR NOT FFTW3_LIBRARIES) IF(NOT FFTW3_INCLUDE_DIR OR NOT FFTW3_LIBRARIES) MESSAGE(FATAL_ERROR "Could not find fftw3.") ENDIF() 

error message:

 CMake Error at CMakeLists.txt:52 (MESSAGE): Could not find fftw3. 
+5
source share
3 answers

Try gui-cmake , http://www.cmake.org/cmake/help/runningcmake.html .

Then you can select the desired library manually.

+1
source

You have dynamic libraries installed, but do you have a development package? You will probably need a file or a symbolic link with the name:

 libfftw3.so 

You may need to install the fftw3-devel package (or fftw3-dev).

Also try removing the lib prefix and the .so.3 suffix:

 FIND_LIBRARY(FFTW3_LIBRARIES NAMES fftw3 libfftw3) 

If this does not work, try adding the PATHS argument:

 FIND_LIBRARY(FFTW3_LIBRARIES NAMES fftw3 libfftw3 PATHS /usr/lib <other paths>) 

Make sure that the CMAKE_FIND_ROOT_PATH variable is set correctly (apparently you are not cross-compiling, so it is probably empty and cmake will use reasonable places to search for libraries).

See the cmake man page for a detailed use of the find_library function.

Finally, look at this site for how to write a find_package script: http://www.cmake.org/Wiki/CMake:How_To_Find_Libraries

+3
source

I usually expect to see symbolic links such as /usr/lib/libfftw.so -> libfftw.so.3 . If they were in place, your find_library calls should work fine.

If you do not want to add symbolic links, you can change your calls to:

 find_library(FFTW3_LIBRARIES libfftw3.so.3 /usr/lib) find_library(FFTW3F_LIBRARIES libfftw3f.so.3 /usr/lib) 
+1
source

Source: https://habr.com/ru/post/955701/


All Articles