[CMAKE] Fix and improve the Release build type of the MSVC builds.
authorAmine Khaldi <amine.khaldi@reactos.org>
Sat, 23 May 2015 10:34:25 +0000 (10:34 +0000)
committerAmine Khaldi <amine.khaldi@reactos.org>
Sat, 23 May 2015 10:34:25 +0000 (10:34 +0000)
svn path=/trunk/; revision=67861

reactos/cmake/msvc.cmake

index 47446d4..e3ae5ba 100644 (file)
@@ -2,6 +2,11 @@
 #if(${CMAKE_BUILD_TYPE} STREQUAL "Debug")
 if(CMAKE_BUILD_TYPE STREQUAL "Debug")
     # no optimization
+    add_compile_flags("/Ob0 /Od")
+elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
+    add_compile_flags("/Ox /Ob2 /Ot /Oy /GT /GF")
+    set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /OPT:REF /OPT:ICF")
+    set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /OPT:REF /OPT:ICF")
 elseif(OPTIMIZE STREQUAL "1")
     add_definitions(/O1)
 elseif(OPTIMIZE STREQUAL "2")
@@ -76,10 +81,9 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
     if(NOT (_PREFAST_ OR _VS_ANALYZE_))
         add_compile_flags("/Zi")
     endif()
-    add_compile_flags("/Ob0 /Od")
 #elseif(${CMAKE_BUILD_TYPE} STREQUAL "Release")
 elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
-    add_compile_flags("/Ob2 /D NDEBUG")
+    add_definitions("/D NDEBUG")
 endif()
 
 if(MSVC_IDE AND (NOT DEFINED USE_FOLDER_STRUCTURE))