MantisBT - CMake | ||||||||||
View Issue Details | ||||||||||
ID | Project | Category | View Status | Date Submitted | Last Update | |||||
0015804 | CMake | Modules | public | 2015-10-20 05:32 | 2016-06-10 14:31 | |||||
Reporter | Sam Thursfield | |||||||||
Assigned To | Kitware Robot | |||||||||
Priority | normal | Severity | minor | Reproducibility | always | |||||
Status | closed | Resolution | moved | |||||||
Platform | OS | OS Version | ||||||||
Product Version | CMake 3.3.2 | |||||||||
Target Version | Fixed in Version | |||||||||
Summary | 0015804: FindPkgConfig pkg_check_modules command should return full path to shared libraries in _LIBRARIES variable | |||||||||
Description | CMake seems to encourage using absolute paths to shared libraries. From link_directories() documentation: Note that this command is rarely necessary. Library locations returned by find_package() and find_library() are absolute paths. Pass these absolute library file paths directly to the target_link_libraries() command. CMake will ensure the linker finds them. However, the FindPkgConfig module doesn't follow this, and instead returns just the names of libraries, plus a linker path. Since CMake makes it awkward to propagate the linker path, so the end result is that if you have a package installed in a non-standard library path, things break. | |||||||||
Steps To Reproduce | An example pkg-config file: cmake_minimum_required(VERSION 3.3.2) find_package(PkgConfig REQUIRED) pkg_check_modules(ZLIB zlib REQUIRED) message("ZLIB_LIBRARIES: ${ZLIB_LIBRARIES}") message("ZLIB_LIBRARY_DIRS: ${ZLIB_LIBRARY_DIRS}") Output: ZLIB_LIBRARIES: z ZLIB_LIBRARY_DIRS: /usr/lib64 Expected output: ZLIB_LIBRARIES: /usr/lib64/libz.so | |||||||||
Additional Information | I'm aware that in the case of Zlib there is a FindZLib module, and /usr/lib64 is in my library search path in any case. This is just an example. The painful case is where I had to build a library from source myself and then install it into a non-standard prefix. | |||||||||
Tags | No tags attached. | |||||||||
Relationships |
| |||||||||
Attached Files | cmake-pkg-config-absolute-paths.patch (2,189) 2015-10-20 17:59 https://public.kitware.com/Bug/file/5555/cmake-pkg-config-absolute-paths.patch cmake-pkg-import-module.patch (5,839) 2016-01-12 12:58 https://public.kitware.com/Bug/file/5608/cmake-pkg-import-module.patch | |||||||||
Issue History | ||||||||||
Date Modified | Username | Field | Change | |||||||
2015-10-20 05:32 | Sam Thursfield | New Issue | ||||||||
2015-10-20 17:59 | Sam Thursfield | File Added: cmake-pkg-config-absolute-paths.patch | ||||||||
2015-10-20 18:04 | Sam Thursfield | Note Added: 0039663 | ||||||||
2015-10-20 18:10 | Sam Thursfield | Note Added: 0039664 | ||||||||
2015-10-20 18:14 | Sam Thursfield | Note Added: 0039665 | ||||||||
2015-10-21 08:27 | Brad King | Note Added: 0039666 | ||||||||
2015-10-21 08:28 | Brad King | Relationship added | related to 0015805 | |||||||
2016-01-12 12:58 | Sam Thursfield | File Added: cmake-pkg-import-module.patch | ||||||||
2016-01-12 12:59 | Sam Thursfield | Note Added: 0040207 | ||||||||
2016-06-10 14:29 | Kitware Robot | Note Added: 0042863 | ||||||||
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 |
Notes | |||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|
||||
|
|||||
|
|