best way to override or bypass find_package for OS-specific settings

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

best way to override or bypass find_package for OS-specific settings

j1wuttke
Project P depends on library L.
L comes with a module FindL.cmake, which is so
complicated that we would not be able to adapt it
to our needs.

On most platforms, users will build P from source,
and dynamically link with L. For them, the line

   find_package(L REQUIRED)

in P/CMakeLists.txt works fine.

But now let's suppose users of platform W are unable
to cope with binaries that depend on dynamic libraries.
They want a fully self-contained executable.

Therefore on this platform, we need to link P
statically with L. Let's assume that a static binary
of L is provided in an idiosyncratic location X/L.lib.

So we need to inform CMake that we want static linkage,
and where L.lib is located. What is the best way to
do this?

Shall we bypass find_package?
Or shall we provide a location hint to find_package?
Shall we hard-code the library location, or pass
it as a command-line argument?




--

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

smime.p7s (6K) Download Attachment