[CMake] Debug/Release configurations for codeblocks ?
Verweij, Arjen
VerweijA at tass-safe.com
Tue Jul 27 10:46:18 EDT 2010
Hi Michael,
Well lets see:
>> set (CMAKE_BUILD_TYPE RELEASE FORCE)
Get rid of debug builds on my windows XP VS2003 ifort 8.1 testbox. Didn't do the trick without FORCE.
>> SET (CMAKE_EXE_LINKER_FLAGS_INIT "" FORCE)
Actually this one fails. I couldn't get rid of it. See bottom.
>> set (CMAKE_C_FLAGS_RELEASE_INIT "")
>> set (CMAKE_CXX_FLAGS_RELEASE_INIT "")
I don't want "/MD" but "/MT" (libcmt.lib instead of msvcrt.dll)
>> set (CMAKE_Fortran_FLAGS_RELEASE_INIT "")
This flag normally specifies "/O1". Our default optimization level is MDFC_OPT_LVL2 which is "-O2" but some code gets compiled with lvl 3 (-O3 -QaxW) or lvl 0 ("-Od").
Windows-ifort.cmake:
# compile a C++ file into an object file
#SET(CMAKE_Fortran_COMPILE_OBJECT
# "<CMAKE_Fortran_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /fpp /Fo<OBJECT> <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
message (STATUS "FIXME: Removed /fpp from the compile line")
SET(CMAKE_Fortran_COMPILE_OBJECT
"<CMAKE_Fortran_COMPILER> ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /Fo<OBJECT> <DEFINES> <FLAGS> -c <SOURCE>${CMAKE_END_TEMP_FILE}")
message (STATUS "Turned off /INCREMENTAL:YES flag")
#SET (CMAKE_EXE_LINKER_FLAGS_INIT " /INCREMENTAL:YES")
>Could you help me understand the motivations behind this type of code?
>Is it the conflicts between the debug and release C/C++ runtime
>libraries on Visual Studio?
I was ending up with libraries for free on my link lines by cmake, ifort and/or cl.exe (msvcrtd.dll, msvcrt.dll, libifcore.lib and others.). This actually caused the link to fail. Cmake is great for setting up a project, but desperation may set in if you want control over certain parts :P
Regards,
Arjen
More information about the CMake
mailing list