|
Boost : |
Subject: Re: [boost] CMake - one more time
From: Gavin Lambert (gavinl_at_[hidden])
Date: 2016-04-27 21:47:25
On 27/04/2016 06:02, Robert Ramey wrote:
> LOL - see my rant about option() above. it's not clear where one should
> put it, how it interacts with option placed somewhere else, whether the
> options are string variables or some sort of instrinsic, what is the
> default, how it interacts with someone placing the option on the command
> line. This is just a tiny simple example and a very simple one compared
> to others. One could supply pages and pages and pages of such examples
> - but thankfully one is sufficient.
https://cmake.org/cmake/help/v3.0/command/option.html
It seems fairly obvious how they're defined from that.
Usually custom options would be activated with -d and tested for with if
(https://cmake.org/cmake/help/v3.0/command/if.html), but
BUILD_SHARED_LIBS in particular
(https://cmake.org/cmake/help/v3.0/variable/BUILD_SHARED_LIBS.html)
alters the behaviour of add_library
(https://cmake.org/cmake/help/v3.0/command/add_library.html) when
defined (via any means).
ie. add_library(name STATIC sources...) will always build a static library.
add_library(name SHARED sources...) will always build a shared library.
add_library(name sources...) will build a shared library if
BUILD_SHARED_LIBS is ON, otherwise a static library.
This information was not hard to find.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk