List Archive

Thread

Thread Index

Message

From: Thomas Klausner <tk%giga.or.at@localhost>
To: Michał Janiszewski <janisozaur%gmail.com@localhost>
Subject: Re: vcpkg support/static builds
Date: Mon, 14 Aug 2017 15:46:59 +0200

On Mon, Aug 14, 2017 at 01:02:06PM +0200, Michał Janiszewski wrote:
> thanks for the update.
> Since I posted the previous message, I've learned about CMake-3.0+ standard
> option "BUILD_SHARED_LIBS":
> https://cmake.org/cmake/help/v3.0/variable/BUILD_SHARED_LIBS.html
> This allows user to set upon configuration whether they want a shared or
> static library, but only for `add_library` targets. All other things retain
> their linking mode.
> See it getting used here:
> https://github.com/OpenRCT2/OpenRCT2/pull/6145/files
> Seeing how both your static and shared paths are the same, perhaps you may
> want to investigate using said option.

I've looked at the documentation and the example you pasted, but it's
not clear to me how to use it.

Just removing the type is not enough.

Removing it and adding

OPTION(BUILD_SHARED_LIBS "build shared libraries" ON)

in the main CMakeLists.txt file just builds static libraries.

Using

SET(BUILD_SHARED_LIBS ON)

in the main CMakeLists.txt builds shared libraries, but I can't turn
it off by running

cmake -DBUILD_SHARED_LIBS:BOOL=OFF ..

so I don't really know how this is supposed to work. Any ideas?
 Thomas

Made by MHonArc.