Re: [Boost-users] [CMake] Specifying name of library file on CMake command line?
From: Kyle Edwards
I want to know how to specify the name of a library I file I want to link against. How do I do this? I wanted to build a library with a static runtime and static libs; it requires linking against a Boost library which I did build with static runtime but when I tried to build it, I had linker errors because the dynamic version of the library was used instead of the static one. I want to somehow make it use the static one. So yeah, how do I do this? Is there a way?
Are you using the FindBoost module?
Kyle
Yes, I'm using that module. I didn't make any changes to it; it came with the third-party library I'm trying to build.
Is there a way to pass linker commands to CMake on the command line? I could try doing it that way.
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
participants (2)
-
Leon Mlakar
-
Osman Zakir