Cleanup .travis.yml a bit

Signed-off-by: Jeroen Koekkoek <jeroen@koekkoek.nl>
This commit is contained in:
Jeroen Koekkoek 2020-07-29 19:35:08 +02:00
parent b9c2553a7b
commit 8445394e2a
2 changed files with 78 additions and 71 deletions

View file

@ -174,21 +174,26 @@ if(${CMAKE_GENERATOR} STREQUAL "Xcode")
set (CMAKE_XCODE_ATTRIBUTE_GCC_WARN_ABOUT_MISSING_PROTOTYPES YES)
endif()
if(CMAKE_VERSION VERSION_LESS 3.13)
macro(add_link_options)
link_libraries(${ARGV})
endmacro()
endif()
# Make it easy to enable Clang's/gcc's analyzers
set(USE_SANITIZER "" CACHE STRING "Sanitizers to enable on the build.")
if(NOT("${USE_SANITIZER}" STREQUAL ""))
foreach(san "${USE_SANITIZER}")
message(STATUS "Enabling sanitizer: '${san}'")
if("${san}" STREQUAL address)
add_compile_options(-fno-omit-frame-pointer)
link_libraries(-fno-omit-frame-pointer)
if(USE_SANITIZER)
string(REGEX REPLACE " " "" USE_SANITIZER "${USE_SANITIZER}")
string(REGEX REPLACE "[,;]+" ";" USE_SANITIZER "${USE_SANITIZER}")
foreach(san ${USE_SANITIZER})
if(san STREQUAL "address")
add_compile_options("-fno-omit-frame-pointer")
add_link_options("-fno-omit-frame-pointer")
endif()
if(NOT("${san}" STREQUAL "none"))
if(san AND NOT san STREQUAL "none")
message(STATUS "Enabling sanitizer: ${san}")
add_compile_options("-fsanitize=${san}")
link_libraries("-fsanitize=${san}")
add_link_options("-fsanitize=${san}")
endif()
endforeach()
endif()