mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-04-20 02:40:03 +02:00
64 lines
2.0 KiB
CMake
64 lines
2.0 KiB
CMake
include(CheckCXXCompilerFlag)
|
|
include(CheckCCompilerFlag)
|
|
|
|
|
|
function(enable_cxx_warning flag target)
|
|
string(REPLACE "-W" "HAS_" flag_name ${flag})
|
|
check_cxx_compiler_flag(${flag} ${flag_name})
|
|
if(${flag_name})
|
|
target_compile_options(${target} INTERFACE ${flag})
|
|
message(STATUS "Adding: ${flag} to ${target}")
|
|
else()
|
|
message(STATUS "Flag: ${flag} not supported")
|
|
endif()
|
|
endfunction()
|
|
|
|
function(enable_c_warning flag target)
|
|
string(REPLACE "-W" "HAS_" flag_name ${flag})
|
|
check_c_compiler_flag(${flag} ${flag_name})
|
|
if(${flag_name})
|
|
target_compile_options(${target} INTERFACE ${flag})
|
|
message(STATUS "Adding: ${flag} to ${target}")
|
|
else()
|
|
message(STATUS "Flag: ${flag} not supported")
|
|
endif()
|
|
endfunction()
|
|
|
|
|
|
function(disable_cxx_warning flag target)
|
|
string(REPLACE "-W" "HAS_" flag_name ${flag})
|
|
check_cxx_compiler_flag(${flag} ${flag_name})
|
|
|
|
if(${flag_name})
|
|
string(REPLACE "-W" "-Wno-" neg_flag ${flag})
|
|
message(STATUS "Adding: ${neg_flag} to ${target}")
|
|
target_compile_options(${target} INTERFACE ${neg_flag})
|
|
else()
|
|
message(STATUS "Warning: ${flag} not supported no need to disable")
|
|
endif()
|
|
endfunction()
|
|
|
|
function(disable_c_warning flag target)
|
|
string(REPLACE "-W" "HAS_" flag_name ${flag})
|
|
check_c_compiler_flag(${flag} ${flag_name})
|
|
if(${flag_name})
|
|
string(REPLACE "-W" "-Wno-" neg_flag ${flag})
|
|
message(STATUS "Adding: ${neg_flag} to ${target}")
|
|
target_compile_options(${target} INTERFACE ${neg_flag})
|
|
else()
|
|
message(STATUS "Warning: ${flag} not supported no need to disable")
|
|
endif()
|
|
endfunction()
|
|
|
|
|
|
function(sls_disable_c_warning flag)
|
|
disable_c_warning(${flag} slsProjectCSettings)
|
|
endfunction()
|
|
|
|
function(sls_enable_cxx_warning flag)
|
|
enable_cxx_warning(${flag} slsProjectWarnings)
|
|
endfunction()
|
|
|
|
function(sls_disable_cxx_warning flag)
|
|
disable_cxx_warning(${flag} slsProjectWarnings)
|
|
endfunction() |