Author: akhaldi
Date: Sat Jan 14 17:27:17 2012
New Revision: 54962
URL:
http://svn.reactos.org/svn/reactos?rev=54962&view=rev
Log:
[CMAKE/MSVC]
* Improve the way we set the debugging flags for debug and release build types.
* Don't generate debug info when we're in prefast mode and don't prefix with
prefast when linking executables.
* We don't need to alter the c/c++ compiler variables in prefast mode anymore.
Modified:
trunk/reactos/cmake/Platform/Windows-cl.cmake
trunk/reactos/cmake/msvc.cmake
Modified: trunk/reactos/cmake/Platform/Windows-cl.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/Platform/Windows-cl.…
==============================================================================
--- trunk/reactos/cmake/Platform/Windows-cl.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/Platform/Windows-cl.cmake [iso-8859-1] Sat Jan 14 17:27:17 2012
@@ -213,15 +213,15 @@
#SET(CMAKE_C_LINK_EXECUTABLE "<CMAKE_COMMAND> -E vs_link_exe
${CMAKE_C_LINK_EXECUTABLE}")
SET(CMAKE_BUILD_TYPE_INIT Debug)
-SET(CMAKE_CXX_FLAGS_DEBUG_INIT "/Zi /Ob0 /Od")
-SET(CMAKE_C_FLAGS_DEBUG_INIT "/Zi /Ob0 /Od")
+SET(CMAKE_CXX_FLAGS_DEBUG_INIT "")
+SET(CMAKE_C_FLAGS_DEBUG_INIT "")
SET(CMAKE_CXX_FLAGS_INIT "")
SET(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
-SET(CMAKE_CXX_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
+SET(CMAKE_CXX_FLAGS_RELEASE_INIT "")
SET(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")
SET(CMAKE_C_FLAGS_INIT "")
SET(CMAKE_C_FLAGS_MINSIZEREL_INIT "/O1 /Ob1 /D NDEBUG")
-SET(CMAKE_C_FLAGS_RELEASE_INIT "/O2 /Ob2 /D NDEBUG")
+SET(CMAKE_C_FLAGS_RELEASE_INIT "")
SET(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/Zi /O2 /Ob1")
SET(CMAKE_C_STANDARD_LIBRARIES_INIT "")
SET(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}")
Modified: trunk/reactos/cmake/msvc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/msvc.cmake?rev=54962…
==============================================================================
--- trunk/reactos/cmake/msvc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/msvc.cmake [iso-8859-1] Sat Jan 14 17:27:17 2012
@@ -21,6 +21,16 @@
add_compile_flags("/X /GR- /GS- /Zl /W3")
+# Debugging
+if(${CMAKE_BUILD_TYPE} MATCHES Debug)
+ if(NOT _PREFAST_)
+ add_compile_flags("/Zi")
+ endif()
+ add_compile_flags("/Ob0 /Od")
+elseif(${CMAKE_BUILD_TYPE} MATCHES Release)
+ add_compile_flags("/Ob2 /D NDEBUG")
+endif()
+
if(${_MACHINE_ARCH_FLAG} MATCHES X86)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB
/RELEASE")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /SAFESEH:NO
/NODEFAULTLIB /RELEASE")
@@ -54,16 +64,14 @@
if(_PREFAST_)
message("PREFAST enabled!")
- set(CMAKE_C_COMPILER "prefast cl")
- set(CMAKE_CXX_COMPILER "prefast cl")
- set(CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> ${CMAKE_START_TEMP_FILE}
${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /Fo<OBJECT> /Fd<TARGET_PDB>
-c <SOURCE>${CMAKE_END_TEMP_FILE}"
+ set(CMAKE_C_COMPILE_OBJECT "prefast cl ${CMAKE_START_TEMP_FILE}
${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /Fo<OBJECT> -c
<SOURCE>${CMAKE_END_TEMP_FILE}"
"prefast LIST")
- set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER>
${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP
/Fo<OBJECT> /Fd<TARGET_PDB> -c <SOURCE>${CMAKE_END_TEMP_FILE}"
+ set(CMAKE_CXX_COMPILE_OBJECT "prefast cl ${CMAKE_START_TEMP_FILE}
${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP /Fo<OBJECT> -c
<SOURCE>${CMAKE_END_TEMP_FILE}"
"prefast LIST")
set(CMAKE_C_LINK_EXECUTABLE
- "cl ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS>
/Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB>
/version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>
<CMAKE_C_LINK_FLAGS> <LINK_FLAGS>
<LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+ "cl ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS>
/Fe<TARGET> -link /implib:<TARGET_IMPLIB>
/version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>
<CMAKE_C_LINK_FLAGS> <LINK_FLAGS>
<LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
set(CMAKE_CXX_LINK_EXECUTABLE
- "cl ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS>
/Fe<TARGET> /Fd<TARGET_PDB> -link /implib:<TARGET_IMPLIB>
/version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>
<CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS>
<LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+ "cl ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS>
/Fe<TARGET> -link /implib:<TARGET_IMPLIB>
/version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR>
<CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS>
<LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
endif()
set(CMAKE_RC_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})