The following issue has been SUBMITTED. ====================================================================== http://www.cmake.org/Bug/view.php?id=14345 ====================================================================== Reported By: hyde Assigned To: ====================================================================== Project: CMake Issue ID: 14345 Category: (No Category) Reproducibility: have not tried Severity: minor Priority: normal Status: new ====================================================================== Date Submitted: 2013-08-08 04:56 EDT Last Modified: 2013-08-08 04:56 EDT ====================================================================== Summary: pkg_check_modules does not honor link command given by pkg-config: leaves out -L flag Description: Situation: A library is installed in a custom location, and it has pkg-config .pc file installed, `pkg-config --libs ...` gives correct link command. Library is added to project with "pkg-check-modules" in CMakeLists.txt.
Running cmake succeeds and finds the library. Running make, compilation succeeds and correct -I option is added. Bug: only -l option is given for link command, and -L is not given, so linker does not find the library, and build fails. Steps to Reproduce: Minimal example to reproduce provided in attached .zip (please review all files before running/building, needs root for test lib install!). Overview of steps: Have a library in custom location, not in default linker search path. Have pkg-config file for the library, which gives correct compilation (-I) and linking flags (-l, -L). Add the library to a project with pkg_check_modules. Use a symbol from the library in source code. Build project. Linking fails, because -L is not added and linker does not find the library. Additional Information: Possibly related issue: http://www.cmake.org/Bug/view.php?id=8644 It's possible there is something wrong with the project files (in the uploaded .zip), but they are fine as far as I can see. It's also possible there's something wrong with how cmake is set up in the Linux distro. Workaround: add to CMakeLists.txt explicit path for the custom library (also sets RPATH, be aware): link_directories(${XXXXX_LIBRARY_DIRS}) ====================================================================== Issue History Date Modified Username Field Change ====================================================================== 2013-08-08 04:56 hyde New Issue 2013-08-08 04:56 hyde File Added: cmake_Lbug_sscce.zip ====================================================================== -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers
