[CMake] Fwd: Problems setting CMAKE_CONFIGURATION_TYPES for Visual Studio

gaga bla gagabla0 at gmail.com
Wed May 29 07:14:56 EDT 2013


Hello Eric,
thanks for your reply, i tried this, but in my case it doesn't work. I made
a function that first sets the configuration types (using your line of
code) and then calls the project function. Using this function instead of
the project function itself, still all configurations are beeing generated.
I browsed through the cmake sources and modules, but i coudn't find the
place that reintroduces those configurations.
It looks like a bug to me, later on i will try to produce an example.

Kind regards
Janosch


On Tue, May 28, 2013 at 10:01 PM, Eric Clark <eclark at ara.com> wrote:

>  Our projects limit the types to just Debug and Release. However, what I
> found was that you had to set the variable before every call to project(…).
> What we did was we created a module called BuildTypes.cmake and include it
> first thing in every list file. The file has one line of code in it that
> looks like this:****
>
> ** **
>
> set(CMAKE_CONFIGURATION_TYPES Debug Release CACHE TYPE INTERNAL FORCE)****
>
> ** **
>
> This does the trick for us. Hope this helps…****
>
> ** **
>
> Eric****
>
> ** **
>
> *From:* cmake-bounces at cmake.org [mailto:cmake-bounces at cmake.org] *On
> Behalf Of *gaga bla
> *Sent:* Tuesday, May 28, 2013 12:55 PM
> *To:* cmake at cmake.org
> *Subject:* [CMake] Problems setting CMAKE_CONFIGURATION_TYPES for Visual
> Studio****
>
> ** **
>
> Hello, I have problems reducing available configuration types for a Visual
> Studio project.****
>
> No matter what I do, the project always contains all four configuration
> types.****
>
>  ****
>
> I have two files involved, I tried to strip everything that seemed to be
> unimportant:****
>
>  ****
>
> CmakeLists.txt (Main file):****
>
> ------------------------------------****
>
> include("... Helpers.cmake")****
>
> configureMyProject("MyProject")****
>
> message("Config types (outside): ${CMAKE_CONFIGURATION_TYPES}")****
>
> ------------------------------------****
>
>  ****
>
> Helpers.cmake:****
>
> ------------------------------------****
>
> if(__myhelpers)****
>
>                 return()****
>
> endif()****
>
> set(__myhelpers YES)****
>
>  ****
>
> function(configureMyProject MY_NAME ........)****
>
>   set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING ""
> FORCE)****
>
>   message("Config types (before): ${CMAKE_CONFIGURATION_TYPES}") ****
>
>   project(${MY_NAME}) ****
>
>   message("Config types (after): ${CMAKE_CONFIGURATION_TYPES}") ****
>
>   set(CMAKE_CONFIGURATION_TYPES "Debug;RelWithDebInfo" CACHE STRING ""
> FORCE) ****
>
>   message("Config types (after 2): ${CMAKE_CONFIGURATION_TYPES}")****
>
>   ...****
>
>   add_library(...)****
>
>   ...****
>
> endfunction()****
>
> ------------------------------------****
>
>  ****
>
> I then get the following output:****
>
> ------------------------------------****
>
> Config types (before): Debug;RelWithDebInfo****
>
> Config types (after): Debug;Release;MinSizeRel;RelWithDebInfo****
>
> Config types (after 2): Debug;RelWithDebInfo****
>
> Config types (outside): Debug;RelWithDebInfo****
>
> ------------------------------------****
>
>  ****
>
> So it seems to me, that the call of the project-function resetted the
> configuration types and created then the project accordingly.****
>
> Is this a bug or am I doing something wrong? Does anyone know a workaround?
> ****
>
>  ****
>
> Kind regards****
>
> Janosch Scharlipp****
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130529/03be4a12/attachment.htm>


More information about the CMake mailing list