Re: [CMake] Specifying name of library file on CMake command line?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Re: [CMake] Specifying name of library file on CMake command line?

Boost - Users mailing list
From: Kyle Edwards <[hidden email]>
Sent: Monday, June 17, 2019 6:49 PM
To: Osman Zakir; [hidden email]
Subject: Re: [CMake] Specifying name of library file on CMake command line?
 
On Mon, 2019-06-17 at 13:47 +0000, Osman Zakir wrote:
>> 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?

>https://cmake.org/cmake/help/v3.14/module/FindBoost.html​

>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.

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [CMake] Specifying name of library file on CMake command line?

Boost - Users mailing list
Is there a way to pass linker commands to CMake on the command line?  I could try doing it that way.

_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users
Reply | Threaded
Open this post in threaded view
|

Re: [CMake] Specifying name of library file on CMake command line?

Boost - Users mailing list
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



_______________________________________________
Boost-users mailing list
[hidden email]
https://lists.boost.org/mailman/listinfo.cgi/boost-users