On 4/27/16 6:47 PM, Gavin Lambert wrote:
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.
LOL - sorry it's not obvious to me. It still doesn't answer the questions that occured to me above.
Usually custom options would be activated with -d
You mean a command line switch? How would one do this with the GUI.
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.
LOL - it's not that it's hard to find - it's hard to make sense of when you do find it. Ambiguity is built in. Of course it's a matter of opinion. If it's clear to you, I won't dispute it. Robert Ramey