2022-05-14 15:07:12 +02:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/common_compile_options.cmake)
|
|
|
|
|
|
|
|
add_compile_options(-Wno-maybe-uninitialized)
|
2023-03-27 18:55:08 -06:00
|
|
|
add_compile_options(-Wno-shorten-64-to-32)
|
2022-05-14 15:07:12 +02:00
|
|
|
add_compile_options(-fsigned-char)
|
2023-09-05 07:40:57 +02:00
|
|
|
add_compile_options(-ggnu-pubnames)
|
2022-12-12 22:57:36 +01:00
|
|
|
if (NOT WIN32)
|
|
|
|
add_compile_options(-fPIC)
|
|
|
|
endif()
|
2023-09-05 07:40:57 +02:00
|
|
|
|
2024-01-16 14:56:23 +04:00
|
|
|
if (LINUX)
|
|
|
|
add_compile_options(-D_FILE_OFFSET_BITS=64)
|
|
|
|
endif()
|
|
|
|
|
2023-12-20 09:36:02 -07:00
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
|
|
add_compile_options(-ggdb3)
|
|
|
|
add_compile_options(-Og)
|
|
|
|
else()
|
|
|
|
add_compile_options(-O2)
|
|
|
|
add_compile_options(-g1)
|
|
|
|
endif()
|
|
|
|
|
2023-09-05 07:40:57 +02:00
|
|
|
function(add_linker_flag_if_supported flag)
|
|
|
|
include(CheckLinkerFlag)
|
|
|
|
|
|
|
|
check_linker_flag(CXX ${flag} LAGOM_LINKER_SUPPORTS_${flag})
|
|
|
|
if (${LAGOM_LINKER_SUPPORTS_${flag}})
|
|
|
|
add_link_options(${flag})
|
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
add_linker_flag_if_supported(LINKER:--gdb-index)
|
2023-09-10 22:09:22 +02:00
|
|
|
|
|
|
|
if (NOT ENABLE_FUZZERS)
|
|
|
|
add_linker_flag_if_supported(LINKER:-Bsymbolic-non-weak-functions)
|
|
|
|
endif()
|
2024-02-24 12:17:57 -05:00
|
|
|
|
|
|
|
if (ENABLE_LAGOM_COVERAGE_COLLECTION)
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang$" AND NOT ENABLE_FUZZERS)
|
|
|
|
add_compile_options(-fprofile-instr-generate -fcoverage-mapping)
|
|
|
|
add_link_options(-fprofile-instr-generate)
|
|
|
|
else()
|
|
|
|
message(FATAL_ERROR
|
|
|
|
"Collecting code coverage is unsupported in this configuration.")
|
|
|
|
endif()
|
|
|
|
endif()
|