[ros-diffs] [tkreuzer] 54841: [CMAKE] Add an option to compile with PREFAST enabled, when using MSVC

tkreuzer at svn.reactos.org tkreuzer at svn.reactos.org
Thu Jan 5 17:19:15 UTC 2012


Author: tkreuzer
Date: Thu Jan  5 17:19:15 2012
New Revision: 54841

URL: http://svn.reactos.org/svn/reactos?rev=54841&view=rev
Log:
[CMAKE]
Add an option to compile with PREFAST enabled, when using MSVC

Modified:
    trunk/reactos/cmake/config.cmake
    trunk/reactos/cmake/msvc.cmake

Modified: trunk/reactos/cmake/config.cmake
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/config.cmake?rev=54841&r1=54840&r2=54841&view=diff
==============================================================================
--- trunk/reactos/cmake/config.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/config.cmake [iso-8859-1] Thu Jan  5 17:19:15 2012
@@ -55,3 +55,8 @@
 
 set(GENERATE_DEPENDENCY_GRAPH FALSE CACHE BOOL
 "Whether to create a graphml dependency of dlls.")
+
+if(MSVC)
+set(_PREFAST_ FALSE CACHE BOOL
+"Whether to enable PREFAST while compiling.")
+endif()

Modified: trunk/reactos/cmake/msvc.cmake
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/msvc.cmake?rev=54841&r1=54840&r2=54841&view=diff
==============================================================================
--- trunk/reactos/cmake/msvc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/msvc.cmake [iso-8859-1] Thu Jan  5 17:19:15 2012
@@ -43,13 +43,19 @@
     # We may temporarily use just the global defines, but this is not a solution as some modules (minihal for example) apply additional definitions to source files, so we get an incorrect build of such targets.
     get_directory_property(definitions DEFINITIONS)
     set(CMAKE_ASM_COMPILE_OBJECT
-        "<CMAKE_C_COMPILER> /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> ${definitions} /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
+        "cl /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> ${definitions} /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
         "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <OBJECT>.tmp")
 else()
     # NMake Makefiles
     set(CMAKE_ASM_COMPILE_OBJECT
-        "<CMAKE_C_COMPILER> /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
+        "cl /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm <FLAGS> <DEFINES> /D__ASM__ /D_USE_ML /EP /c <SOURCE> > <OBJECT>.tmp"
         "<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta <OBJECT>.tmp")
+endif()
+
+if(_PREFAST_)
+message("PREFAST enabled!")
+set(CMAKE_C_COMPILER "prefast cl")
+set(CMAKE_CXX_COMPILER "prefast cl")
 endif()
 
 set(CMAKE_RC_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})




More information about the Ros-diffs mailing list