mirror of
https://github.com/slsdetectorgroup/slsDetectorPackage.git
synced 2025-06-12 04:47:14 +02:00
Warnings (#313)
This commit is contained in:
@ -1,10 +1,64 @@
|
||||
include(CheckCXXCompilerFlag)
|
||||
function(sls_add_flag_if_available flag target)
|
||||
check_cxx_compiler_flag(${flag} flag_supported)
|
||||
if(flag_supported)
|
||||
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("Adding: ${flag} to ${target}")
|
||||
else()
|
||||
message("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("Adding: ${flag} to ${target}")
|
||||
else()
|
||||
message("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("Adding: ${neg_flag} to ${target}")
|
||||
target_compile_options(${target} INTERFACE ${neg_flag})
|
||||
else()
|
||||
message("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("Adding: ${neg_flag} to ${target}")
|
||||
target_compile_options(${target} INTERFACE ${neg_flag})
|
||||
else()
|
||||
message("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()
|
Reference in New Issue
Block a user