Hi,
I am using find_package to configure a library that uses pkg-config.
When I configure and build a static only version of the library the link
commands generated for my project are wrong.
The problem boils down to the fact that for static link of a library
pkg-config needs to be called with the '--static' option to extract the
correct compile switches and link libraries.
In my case the library libdl needs to be linked because the external
library uses run time library loading. For example:
$ pkg-config --cflags --libs hamlib
-pthread -I/home/bill/test-install/hamlib/include
-L/home/bill/test-install/hamlib/lib -lhamlib
$ pkg-config --cflags --libs --static hamlib
-pthread -I/home/bill/test-install/hamlib/include
-L/home/bill/test-install/hamlib/lib -lhamlib -lm -ldl -lusb
So how do I get find_package to use the correct pkg-config invocation
when there is no shared library version of the external library or if I
want to force static linking of this external library?
TIA
Bill Somerville.
--
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:
http://www.cmake.org/mailman/listinfo/cmake