View Issue Details [ Jump to Notes ] | [ Print ] | ||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | ||||
0015132 | CMake | CMake | public | 2014-09-06 15:26 | 2016-06-10 14:31 | ||||
Reporter | Greg Jung | ||||||||
Assigned To | Kitware Robot | ||||||||
Priority | normal | Severity | minor | Reproducibility | always | ||||
Status | closed | Resolution | moved | ||||||
Platform | Mingw/Msys CygWin64 Win7 | OS | Windows 7 64-bit | OS Version | 6.1 | ||||
Product Version | CMake 3.0.1 | ||||||||
Target Version | Fixed in Version | ||||||||
Summary | 0015132: find_library retrieves libraries from $PATH even when they can be found in the proper locations. | ||||||||
Description | Contrary to documentation, find_library usurps my intention when it has an apparent match from $ENV{PATH}. This also occurs if I specify the preference explicitly via CMAKE_PREFIX_PATH: if the library is found in program path, it picks those up for linkage instead of the specified preference. In the folowing example, I happen to have only one of the libraries fftw3, fftw3f in my /local32/lib. So the FFTWDIR is set to pick up libraries as in FindFFTW.cmake: CMakeLists.txt: set(CMAKE_PREFIX_PATH ${FFTWDIR}) find_package(FFTW QUIET) FindFFTW.cmake: find_library(FFTW_LIBRARY NAMES fftw3) message(STATUS " FFTW_LIBRARY: ${FFTW_LIBRARY}") find_library(FFTWF_LIBRARY NAMES fftw3f) message(STATUS " FFTWF_LIBRARY: ${FFTWF_LIBRARY}") set(FFTW_LIBRARIES ${FFTW_LIBRARY} ${FFTWF_LIBRARY}) find_path(FFTW_INCLUDE_DIR NAMES fftw3.h) result: CMakeCache.txt //GDL: Specifiy the FFTW directory tree FFTWDIR:PATH=D:/programs/win32libs //Path to a library. FFTWF_LIBRARY:FILEPATH=D:/programs/win32libs/lib/libfftw3f.a //Path to a file. FFTW_INCLUDE_DIR:PATH=E:/mingw/local32/include //Path to a library. FFTW_LIBRARY:FILEPATH=E:/mingw/local32/lib/libfftw3.a | ||||||||
Steps To Reproduce | put an acceptable library file in your %PATH%, run cmake: SET(CMAKE_PREFIX_PATH "c:/proper/lib") find_library(WRONG libname) | ||||||||
Additional Information | In cygwin, I set LDFLAGS="-L/opt/local/lib -L/usr/local/lib" which are ingested, with my modified Platform/UnixPaths.cmake, into CMAKE_SYSTEM_LIBRARY_PATH and into CMAKE_SYSTEM_INCLUDE_PATH. <Platform/UnixPaths> inspecting LDFLAGS: -L/opt/local/lib -L/usr/local/lib <Platform/UnixPaths> adding system library path: /opt/local/lib <Platform/UnixPaths> adding system library path: /usr/local/lib so according to the docs, CMAKE_SYSTEM_LIBRARY_PATH and CMAKE_SYSTEM_INCLUDE_PATH will be utilized in find_library and in find_path, respectively. Instead I get Junk from the mingw side bleeding into it because I have an application directory in %PATH%: PLPLOT_LIBRARY: /cygdrive/d/programs/libplplotd.dll.a FindPlplot> PLPLOT_LIBRARY_DIR: /cygdrive/d/programs PLPLOT_INCLUDE=? /cygdrive/d/programs/../include Found PLPLOT: /cygdrive/d/programs/libplplotd.dll.a;/cygdrive/d/programs/libplplotcxxd.dll.a (errors due to bad linkage) Looking for c_plslabelfunc in /cygdrive/d/programs/libplplotd.dll.a;/cygdrive/d/programs/libplplotcxxd.dll.a Looking for c_plslabelfunc in /cygdrive/d/programs/libplplotd.dll.a;/cygdrive/d/programs/libplplotcxxd.dll.a - not found Of course, I reset my $PATH for the cygwin to run right, but the find_library behavior is wrong. | ||||||||
Tags | No tags attached. | ||||||||
Attached Files | ![]() | ||||||||
Relationships | |
Relationships |
Notes | |
(0036741) Brad King (manager) 2014-09-08 08:57 |
The documentation of find_library: http://www.cmake.org/cmake/help/v3.0/command/find_library.html [^] says that ENV{PATH} is step 4, while CMAKE_SYSTEM_LIBRARY_PATH is step 5, so of course entries in PATH come before the builtin search paths. I do not see from the provided information why setting CMAKE_PREFIX_PATH does not work, but please also try setting CMAKE_LIBRARY_PATH and CMAKE_INCLUDE_PATH. |
(0042622) Kitware Robot (administrator) 2016-06-10 14:29 |
Resolving issue as `moved`. This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page. |
Notes |
Issue History | |||
Date Modified | Username | Field | Change |
2014-09-06 15:26 | Greg Jung | New Issue | |
2014-09-06 15:26 | Greg Jung | File Added: cmakebug | |
2014-09-08 08:57 | Brad King | Note Added: 0036741 | |
2016-06-10 14:29 | Kitware Robot | Note Added: 0042622 | |
2016-06-10 14:29 | Kitware Robot | Status | new => resolved |
2016-06-10 14:29 | Kitware Robot | Resolution | open => moved |
2016-06-10 14:29 | Kitware Robot | Assigned To | => Kitware Robot |
2016-06-10 14:31 | Kitware Robot | Status | resolved => closed |
Issue History |
Copyright © 2000 - 2018 MantisBT Team |