"Fossies" - the Fresh Open Source Software Archive

Member "snort3_extra-3.0.3-1/cmake/configure_options.cmake" (23 Sep 2020, 3474 Bytes) of package /linux/misc/snort3_extra-3.0.3-1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) CMake source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 # map cmake options to compiler defines and do miscellaneous further configuration work
    2 # cmake options are defined in cmake/create_options.cmake
    3 
    4 include(CheckCXXCompilerFlag)
    5 
    6 # debugging
    7 
    8 # FIXIT-L Properly handle NDEBUG through CMAKE_BUILD_TYPE
    9 if ( ENABLE_DEBUG )
   10     string ( APPEND DEBUGGING_C_FLAGS " -g -DDEBUG" )
   11 else ()
   12     string ( APPEND DEBUGGING_C_FLAGS " -DNDEBUG" )
   13 endif ( ENABLE_DEBUG )
   14 
   15 if ( ENABLE_GDB )
   16     string ( APPEND DEBUGGING_C_FLAGS " -g -ggdb" )
   17 endif ( ENABLE_GDB )
   18 
   19 # ASAN and TSAN are mutually exclusive, so have them absolutely set SANITIZER_*_FLAGS first.
   20 if ( ENABLE_ADDRESS_SANITIZER )
   21     set ( ASAN_CXX_FLAGS "-fsanitize=address -fno-omit-frame-pointer" )
   22     set ( ASAN_LINKER_FLAGS "-fsanitize=address" )
   23     set ( CMAKE_REQUIRED_FLAGS "${ASAN_LINKER_FLAGS}" )
   24     check_cxx_compiler_flag ( "${ASAN_CXX_FLAGS}" HAVE_ADDRESS_SANITIZER )
   25     unset ( CMAKE_REQUIRED_FLAGS )
   26     if ( HAVE_ADDRESS_SANITIZER )
   27         set ( SANITIZER_CXX_FLAGS "${ASAN_CXX_FLAGS}" )
   28         set ( SANITIZER_LINKER_FLAGS "${ASAN_LINKER_FLAGS}" )
   29     else ()
   30         message ( SEND_ERROR "Could not enable the address sanitizer!" )
   31     endif ()
   32 endif ( ENABLE_ADDRESS_SANITIZER )
   33 
   34 if ( ENABLE_THREAD_SANITIZER )
   35     set ( TSAN_CXX_FLAGS "-fsanitize=thread -fno-omit-frame-pointer" )
   36     set ( TSAN_LINKER_FLAGS "-fsanitize=thread" )
   37     set ( CMAKE_REQUIRED_FLAGS "${TSAN_LINKER_FLAGS}" )
   38     check_cxx_compiler_flag ( "${TSAN_CXX_FLAGS}" HAVE_THREAD_SANITIZER )
   39     unset ( CMAKE_REQUIRED_FLAGS )
   40     if ( HAVE_THREAD_SANITIZER )
   41         set ( SANITIZER_CXX_FLAGS "${TSAN_CXX_FLAGS}" )
   42         set ( SANITIZER_LINKER_FLAGS "${TSAN_LINKER_FLAGS}" )
   43     else ()
   44         message ( SEND_ERROR "Could not enable the thread sanitizer!" )
   45     endif ()
   46 endif ( ENABLE_THREAD_SANITIZER )
   47 
   48 if ( ENABLE_UB_SANITIZER )
   49     set ( UBSAN_CXX_FLAGS "-fsanitize=undefined -fno-sanitize=alignment -fno-omit-frame-pointer" )
   50     set ( UBSAN_LINKER_FLAGS "-fsanitize=undefined -fno-sanitize=alignment" )
   51     set ( CMAKE_REQUIRED_FLAGS "${UBSAN_LINKER_FLAGS}" )
   52     check_cxx_compiler_flag ( "${UBSAN_CXX_FLAGS}" HAVE_UB_SANITIZER )
   53     unset ( CMAKE_REQUIRED_FLAGS )
   54     if ( HAVE_UB_SANITIZER )
   55         string ( APPEND SANITIZER_CXX_FLAGS " ${UBSAN_CXX_FLAGS}" )
   56         string ( APPEND SANITIZER_LINKER_FLAGS " ${UBSAN_LINKER_FLAGS}" )
   57     else ()
   58         message ( SEND_ERROR "Could not enable the undefined behavior sanitizer!" )
   59     endif ()
   60 endif ( ENABLE_UB_SANITIZER )
   61 
   62 if ( ENABLE_CODE_COVERAGE )
   63     include(${CMAKE_MODULE_PATH}/CodeCoverage.cmake)
   64 endif ( ENABLE_CODE_COVERAGE )
   65 
   66 
   67 # Accumulate extra flags and libraries
   68 #[[
   69 message("
   70     DEBUGGING_C_FLAGS = ${DEBUGGING_C_FLAGS}
   71     SANITIZER_CXX_FLAGS = ${SANITIZER_CXX_FLAGS}
   72     SANITIZER_LINKER_FLAGS = ${SANITIZER_LINKER_FLAGS}
   73     COVERAGE_COMPILER_FLAGS = ${COVERAGE_COMPILER_FLAGS}
   74     COVERAGE_LINKER_FLAGS = ${COVERAGE_LINKER_FLAGS}
   75     COVERAGE_LIBRARIES = ${COVERAGE_LIBRARIES}
   76 ")
   77 ]]
   78 set ( EXTRA_C_FLAGS "${EXTRA_C_FLAGS} ${HARDENED_CXX_FLAGS} ${DEBUGGING_C_FLAGS} ${SANITIZER_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" )
   79 set ( EXTRA_CXX_FLAGS "${EXTRA_CXX_FLAGS} ${HARDENED_CXX_FLAGS} ${DEBUGGING_C_FLAGS} ${SANITIZER_CXX_FLAGS} ${COVERAGE_COMPILER_FLAGS}" )
   80 set ( EXTRA_LINKER_FLAGS "${EXTRA_LINKER_FLAGS} ${HARDENED_LINKER_FLAGS} ${SANITIZER_LINKER_FLAGS} ${COVERAGE_LINKER_FLAGS}" )
   81 foreach (EXTRA_LIBRARY IN LISTS COVERAGE_LIBRARIES)
   82     list ( APPEND EXTRA_LIBRARIES ${EXTRA_LIBRARY} )
   83 endforeach ()