Re: [CMake] How to specify library dir for imported interface?
Le mer. 4 juil. 2018 à 10:43, Marc CHEVRIER a écrit : > Next version of CMake (3.13) will supports properties LINK_OPTIONS as well > as INTERFACE_LINK_OPTIONS. > Interesting, will it fix the issue with pkg-config? When installed in a non-standard directory, pkg-config will return the library dir. Here is an example with libsodium: $ PKG_CONFIG_PATH=/tmp/bidon/lib/pkgconfig pkg-config --libs libsodium -L/tmp/bidon/lib -lsodium At first, the property INTERFACE_LINK_DIRECTORIES would make sens. Would there be some drawbacks to specify link directories for imported targets? Cheers, Francis -- Francis Giraldeau -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake
Re: [CMake] How to specify library dir for imported interface?
Next version of CMake (3.13) will supports properties LINK_OPTIONS as well as INTERFACE_LINK_OPTIONS. Le mer. 4 juil. 2018 à 16:02, Francis Giraldeau a écrit : > > However, it seems no property exists to actually specify the library dir > > of imported target, nor the linker flags to pass when using the > > imported target. > > > > What would be the best way to specify the library dir for an imported > > library? > > My workarround at the moment is to add a global link_directories(). It is > not clean, as it lacks the transitivity for library users, but at least it > works. > > Cheers, > > Francis > -- > Francis Giraldeau > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > https://cmake.org/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake
[CMake] How to specify library dir for imported interface?
> However, it seems no property exists to actually specify the library dir > of imported target, nor the linker flags to pass when using the > imported target. > > What would be the best way to specify the library dir for an imported > library? My workarround at the moment is to add a global link_directories(). It is not clean, as it lacks the transitivity for library users, but at least it works. Cheers, Francis -- Francis Giraldeau -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake
[CMake] How to specify library dir for imported interface?
Build fails at link time, because a static library imported using pkg-config is not in the standard path: [ 74%] Linking CXX executable valhalla_add_predicted_traffic /usr/bin/c++ ... -lprime_server ... Usually, cmake uses the absolute path to the static library, but instead, pkg-config provides the library name and the library dir separately. Here is the imported target: add_library(libprime_server INTERFACE IMPORTED) pkg_check_modules(libprime_server REQUIRED libprime_server>=0.6.3) set_target_properties(libprime_server PROPERTIES INTERFACE_LINK_LIBRARIES "${libprime_server_LIBRARIES}" INTERFACE_INCLUDE_DIRECTORIES "${libprime_server_INCLUDE_DIRS}") The library dir is defined in the CMakeCache.txt (both in the LDFLAGS in LIBRARY_DIRS): libprime_server_LDFLAGS:INTERNAL=-L/home/francis/local/lib;-lprime_server libprime_server_LIBRARY_DIRS:INTERNAL=/home/francis/local/lib However, it seems no property exists to actually specify the library dir of imported target, nor the linker flags to pass when using the imported target. What would be the best way to specify the library dir for an imported library? Thanks! Francis Giraldeau -- Francis Giraldeau -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake