[CMake] Questions on CMAKE_CONFIGURATION_TYPES

Alexander Ivash alexander.ivash at psa-software.com
Mon Mar 12 06:43:23 EST 2007


Hello, cmake.

I need to make a project with 4 configuration types: "Debug",
"Release", "Debug_Unicode" and "Release_Unicode". As I was told
"Visual Studio 8 2005" generator can't handle configurations other
than "Debug", "Release", "MinSizRel" and "RelWithDebugInfo". (When I
tried to set my 4 configurations with the command

      "set(CMAKE_CONFIGURATION_TYPES
        "Debug Release Debug_Unicode Release_Unicode"
        CACHE TYPE INTERNAL FORCE
        )"

, I got the next response:

"CMake Error: Invalid configuration type in CMAKE_CONFIGURATION_TYPES: Debug_Unic
ode (Valid types are Debug,Release,MinSizeRel,RelWithDebInfo)
CMake Error: Invalid configuration type in CMAKE_CONFIGURATION_TYPES: Release_Un
icode (Valid types are Debug,Release,MinSizeRel,RelWithDebInfo)"
)

After I commented this check (
 "if(config == "Debug" || config == "Release" ||
         config == "MinSizeRel" || config == "RelWithDebInfo")"
) in the cmGlobalVisualStudio7Generator.cxx file - errors disappeared
and I got exactly the same project type (I mean with 4 custom
configurations) that I wanted in Visual Studio 8.

1. For what purpose this check is? Is it bug or feature? The hack
above works for me but is it scheduled to implement more clean way of
adding custom build configurations to VisualStudio generators?

But there is another problem - now if I create project for nmake
(use nmake generator) then I can't install my target because
CMAKE_INSTALL_CONFIG_NAME gets value "Debug Release Debug_Unicode
Release_Unicode" instead of CMAKE_BUILD_TYPE value. So I decided to
do the following check:

if(MSVC_IDE)
set(CMAKE_CONFIGURATION_TYPES 
        "Debug Release Debug_Unicode Release_Unicode"
        CACHE TYPE INTERNAL FORCE
)
endif(MSVC_IDE)

But it doesn't work! It seems never be true! Is it bug or feature
again? How to distinguish nmake generator from msvc8 ?


-- 
Best regards,
 Alexander                          mailto:alexander.ivash at psa-software.com



More information about the CMake mailing list