From 5a729992d73615ef7718d27a3cf249a725d4755c Mon Sep 17 00:00:00 2001 From: Timo Kreuzer Date: Thu, 5 Jan 2012 17:19:15 +0000 Subject: [PATCH] [CMAKE] Add an option to compile with PREFAST enabled, when using MSVC svn path=/trunk/; revision=54841 --- reactos/cmake/config.cmake | 5 +++++ reactos/cmake/msvc.cmake | 10 ++++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/reactos/cmake/config.cmake b/reactos/cmake/config.cmake index aabef676321..60bbb06bc74 100644 --- a/reactos/cmake/config.cmake +++ b/reactos/cmake/config.cmake @@ -55,3 +55,8 @@ set(BUILD_MP TRUE CACHE BOOL 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() diff --git a/reactos/cmake/msvc.cmake b/reactos/cmake/msvc.cmake index 626c8cb2217..187feabf202 100644 --- a/reactos/cmake/msvc.cmake +++ b/reactos/cmake/msvc.cmake @@ -43,15 +43,21 @@ if(MSVC_IDE) # 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 - " /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm ${definitions} /D__ASM__ /D_USE_ML /EP /c > .tmp" + "cl /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm ${definitions} /D__ASM__ /D_USE_ML /EP /c > .tmp" " /nologo /Cp /Fo /c /Ta .tmp") else() # NMake Makefiles set(CMAKE_ASM_COMPILE_OBJECT - " /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm /D__ASM__ /D_USE_ML /EP /c > .tmp" + "cl /nologo /X /I${REACTOS_SOURCE_DIR}/include/asm /I${REACTOS_BINARY_DIR}/include/asm /D__ASM__ /D_USE_ML /EP /c > .tmp" " /nologo /Cp /Fo /c /Ta .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}) set(CMAKE_ASM_CREATE_SHARED_LIBRARY ${CMAKE_C_CREATE_SHARED_LIBRARY}) set(CMAKE_ASM_CREATE_STATIC_LIBRARY ${CMAKE_C_CREATE_STATIC_LIBRARY})