diff options
Diffstat (limited to 'SetFlags.cmake')
-rw-r--r-- | SetFlags.cmake | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/SetFlags.cmake b/SetFlags.cmake index 6e2417a51..339174e5c 100644 --- a/SetFlags.cmake +++ b/SetFlags.cmake @@ -26,10 +26,17 @@ endmacro() macro(set_flags) + # Add coverage processing, if requested: + if (NOT MSVC) + if (${CMAKE_BUILD_TYPE} STREQUAL "COVERAGE") + message("Including CodeCoverage") + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/cmake-coverage/") + include(CodeCoverage) + endif() + endif() + # Add the preprocessor macros used for distinguishing between debug and release builds (CMake does this automatically for MSVC): if (NOT MSVC) - set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/lib/cmake-coverage/") - include(CodeCoverage) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -D_DEBUG") set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG") set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -D_DEBUG") @@ -63,12 +70,16 @@ macro(set_flags) else() # Let gcc / clang know that we're compiling a multi-threaded app: - add_flags_cxx("-pthread") + if (UNIX) + add_flags_cxx("-pthread") + endif() + + # Make CLang use C++11, otherwise MSVC2008-supported extensions don't work ("override" keyword etc.): if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") - set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -std=c++11") set(CMAKE_CXX_FLAGS_COVERAGE "${CMAKE_CXX_FLAGS_COVERAGE} -std=c++11") - set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -std=c++11") endif() # We use a signed char (fixes #640 on RasPi) |