[CMake] (no subject)

Lukast dev lukast.dev at gmail.com
Tue Apr 28 04:56:06 EDT 2015


Hello guys,

I use multi-configuration generator (MSVC 2008) and I need to create
one solution containing two configurations for one library target N:

For build type Debug target N is compiled as static library
For build type Release target N is compiled as shared library

Something like this, but I know that I can't use CMAKE_BUILD_TYPE
variable when I use multi-configuration generator:

cmake_minimum_required (VERSION 2.8.11)
project (hello)
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
    add_library(hello STATIC main.cpp)
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
    add_library(hello SHARED main.cpp)
endif()

I already used CMAKE_CXX_FLAGS_DEBUG and CMAKE_CXX_FLAGS_RELEASE
to distinguish some attributes between Debug and Release, but I can't
figure it out in case of the library type (SHARED vs STATIC).

Any ideas how to achieve it?

Thanks
Lukas


More information about the CMake mailing list