On Apr 22, 2016, at 5:41 PM, Robert Ramey
wrote: On 4/22/16 2:56 PM, Raffi Enficiaud wrote:
Certainly, CMake can do everything with the appropriate effort. But so far, although I am a CMake user, I do not know how to do this:
- having the same target name with different target properties: like set(PROJECT_SRC ....) add_library(myproject SHARED ${PROJECT_SRC}) add_library(myproject STATIC ${PROJECT_SRC})
how do you do that? how do you refer to the appropriate variant?
I know it's beside the point of your post, but I can't resist.
I do this in the following way.
a) I set up a cached boolean variable USE_STATIC b) I use the CMake script
if(USE_STATIC) add_library(myproject STATIC ${PROJECT_SRC}) else() add_library(myproject SHARED ${PROJECT_SRC}) elseif()
This is not necessary at all. Cmake provides the `BUILD_SHARED_LIBS` variable that can be set to do this same purpose: https://cmake.org/cmake/help/v3.5/variable/BUILD_SHARED_LIBS.html
Then I generate two different versions and can switch back and forth between them.
You see this in the serialization library CMake files
Robert Ramey
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost