Author: akhaldi
Date: Thu May 10 10:39:16 2012
New Revision: 56558
URL:
http://svn.reactos.org/svn/reactos?rev=56558&view=rev
Log:
* Introduce _VS_ANALYZE_ option for the VS static analysis support.
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=565…
==============================================================================
--- trunk/reactos/cmake/config.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/config.cmake [iso-8859-1] Thu May 10 10:39:16 2012
@@ -69,6 +69,10 @@
"Whether to create a graphml dependency of dlls.")
if(MSVC)
+
set(_PREFAST_ FALSE CACHE BOOL
"Whether to enable PREFAST while compiling.")
+set(_VS_ANALYZE_ FALSE CACHE BOOL
+"Whether to enable static analysis while compiling.")
+
endif()
Modified: trunk/reactos/cmake/msvc.cmake
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/cmake/msvc.cmake?rev=56558…
==============================================================================
--- trunk/reactos/cmake/msvc.cmake [iso-8859-1] (original)
+++ trunk/reactos/cmake/msvc.cmake [iso-8859-1] Thu May 10 10:39:16 2012
@@ -26,7 +26,7 @@
# Debugging
if(${CMAKE_BUILD_TYPE} MATCHES Debug)
- if(NOT _PREFAST_)
+ if(NOT (_PREFAST_ OR _VS_ANALYZE_))
add_compile_flags("/Zi")
endif()
add_compile_flags("/Ob0 /Od")
@@ -56,21 +56,19 @@
"<CMAKE_ASM_COMPILER> /nologo /Cp /Fo<OBJECT> /c /Ta
<OBJECT>.tmp")
endif()
-if(_PREFAST_)
- if(MSVC_VERSION EQUAL 1600 OR MSVC_VERSION GREATER 1600)
- add_compile_flags("/analyze")
- else()
- message("PREFAST enabled!")
- set(CMAKE_C_COMPILE_OBJECT "prefast cl ${CMAKE_START_TEMP_FILE}
${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /Fo<OBJECT> -c
<SOURCE>${CMAKE_END_TEMP_FILE}"
+if(_VS_ANALYZE_)
+ message("VS static analysis enabled!")
+ add_compile_flags("/analyze")
+elseif(_PREFAST_)
+ message("PREFAST enabled!")
+ 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 "prefast cl ${CMAKE_START_TEMP_FILE}
${CMAKE_CL_NOLOGO} <FLAGS> <DEFINES> /TP /Fo<OBJECT> -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
+ set(CMAKE_C_LINK_EXECUTABLE
"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
+ set(CMAKE_CXX_LINK_EXECUTABLE
"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()
-
endif()
set(CMAKE_RC_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY})