Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Sonar: remove redundant jumps.
[simgrid.git] / tools / cmake / GCCFlags.cmake
index 309a69a..432441c 100644 (file)
@@ -26,7 +26,7 @@ if(enable_compile_warnings)
   endif()
 
   set(warnCXXFLAGS "${warnCFLAGS} -Wall -Wextra -Wunused -Wmissing-declarations -Wpointer-arith -Wchar-subscripts -Wcomment -Wformat -Wwrite-strings -Wno-unused-function -Wno-unused-parameter -Wno-strict-aliasing")
-  if(CMAKE_COMPILER_IS_GNUCXX AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER "5.0")))
+  if(CMAKE_COMPILER_IS_GNUCXX AND (NOT (CMAKE_CXX_COMPILER_VERSION VERSION_LESS "5.0")))
     set(warnCFLAGS "${warnCFLAGS} -Wformat-signedness")
   endif()
   if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GCC")
@@ -79,6 +79,11 @@ if(enable_compile_optimizations AND CMAKE_COMPILER_IS_GNUCC
   set(optCFLAGS "${optCFLAGS} -finline-functions ")
 endif()
 
+# Do not leak the current directory into the binaries
+if(CMAKE_COMPILER_IS_GNUCC)
+  set(optCFLAGS "${optCFLAGS} -fdebug-prefix-map=${CMAKE_SOURCE_DIR}=.")
+endif()
+
 # Configure LTO
 # NOTE, cmake 3.0 has a INTERPROCEDURAL_OPTIMIZATION target
 #       property for this (http://www.cmake.org/cmake/help/v3.0/prop_tgt/INTERPROCEDURAL_OPTIMIZATION.html)
@@ -187,6 +192,12 @@ if(enable_address_sanitizer)
     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address -fno-omit-frame-pointer")
     set(CMAKE_C_LINK_FLAGS "${CMAKE_C_LINK_FLAGS} -fsanitize=address")
     set(TESH_OPTION --enable-sanitizers)
+    try_compile(HAVE_SANITIZE_ADDRESS ${CMAKE_BINARY_DIR} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_asan.cpp)
+    try_compile(HAVE_SANITIZE_ADDRESS_FIBER_SUPPORT ${CMAKE_BINARY_DIR} ${CMAKE_HOME_DIRECTORY}/tools/cmake/test_prog/prog_asan.cpp
+      COMPILE_DEFINITIONS -DCHECK_FIBER_SUPPORT)
+else()
+    set(HAVE_SANITIZE_ADDRESS FALSE CACHE INTERNAL "")
+    set(HAVE_SANITIZE_ADDRESS_FIBER_SUPPORT FALSE CACHE INTERNAL "")
 endif()
 
 if(enable_thread_sanitizer)