[Cmake] CMAKE_BUILD_TYPE, Makefiles, and MSVC

paul. poppenhe at umich.edu
Tue Jul 13 17:20:00 EDT 2004


Hello CMakers,

When using the command line client, the CMAKE_BUILD_TYPE does an 
excellent job of emulating MSVC's build types. I can make a subfolder 
DEBUG or RELEASE or what have you, and the build of that type will go 
into that folder. Very handy, because we need to keep different types 
of builds around.

That is, if I have:
IF(CMAKE_BUILD_TYPE MATCHES Release)
	SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/RELEASE)
ENDIF(CMAKE_BUILD_TYPE MATCHES Release)
IF(CMAKE_BUILD_TYPE MATCHES Debug)
	SET(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/DEBUG)
ENDIF(CMAKE_BUILD_TYPE MATCHES Debug)

I get my binaries put in the appropriate place, either 
${PROJECT_BINARY_DIR}/RELEASE or ${PROJECT_BINARY_DIR}/DEBUG.


However, we also have windows developers using MSVC. If they run cmake 
and then build, they get
${PROJECT_BINARY_DIR}/DEBUG/Release
${PROJECT_BINARY_DIR}/DEBUG/Debug
${PROJECT_BINARY_DIR}/RELEASE/Release
${PROJECT_BINARY_DIR}/RELEASE/Debug


I understand that MSVC is operating on a post-cmake-run build style, 
while I need to regenerate my cmake cache to have the same effect on 
Makefile targets. Is there some way to unify this behavior? To be able 
to 'make Debug' and 'make Release' from the commandline (having the 
Makefile emulate MSVC), OR to be able to only have one build style in 
MSVC until the cache is regenerated (having MSVC emulate the Makefile)? 
Because of the (very large) amount of media that we need to copy, and 
the different libraries we need to link in depending on this type, it 
would be handy to not have to special case windows builds.

- paul

ps - the CMAKE_BUILD_TYPE 'None' has come in handy already; interesting 
option!



More information about the Cmake mailing list