From: Leon Mlakar (leon_at_[hidden])
Date: 2019-06-17 17:02:45


On 17.06.2019 17:43, Osman Zakir via Boost-users wrote:
> Is there a way to pass linker commands to CMake on the command line? 
> I could try doing it that way.

You could declare the static library as imported and use this target for
dependencies - from StackOverflow:

|# Your-external "mylib", add GLOBAL if the imported library is located
in directories above the current. add_library( mylib SHARED IMPORTED ) #
You can define two import-locations: one for debug and one for release.
set_target_properties( mylib PROPERTIES IMPORTED_LOCATION
${CMAKE_BINARY_DIR}/res/mylib.so )|

But it's possible to force FindBoost to use static versions - just set:

     set(Boost_USE_STATIC_LIBS ON)

before using

     find_package(Boost ......)

Hope it helps,

Leon