diff --git a/CMakeLists.txt b/CMakeLists.txt index 85132055b..98c208f07 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -133,6 +133,16 @@ if(CMAKE_COMPILER_IS_GNUCC) endif() set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") + + # Hack to strip absolute paths out of the __FILE__ macro + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILE__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__FILE__='\"$(subst ${CMAKE_SOURCE_DIR}/,,$(abspath $<))\"'") + CHECK_C_COMPILER_FLAG (-Wno-builtin-macro-redefined Wno-builtin-macro-redefined) + if(Wno-builtin-macro-redefined) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-builtin-macro-redefined") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-builtin-macro-redefined") + endif() + CHECK_C_COMPILER_FLAG (-Wno-unused-result Wno-unused-result) if(Wno-unused-result) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-result")