mirror of
https://github.com/SFML/SFML.git
synced 2024-11-25 04:41:05 +08:00
Set compiler warnings on a per-target, not per-file basis
No 1st party SFML targets contain 3rd party source code so it's safe and correct to apply warnings to the entire target.
This commit is contained in:
parent
f320fc0db4
commit
8a4563361f
@ -2,8 +2,8 @@
|
||||
#
|
||||
# https://github.com/lefticus/cppbestpractices/blob/master/02-Use_the_Tools_Available.md
|
||||
|
||||
# Helper function to enable compiler warnings for a specific set of files
|
||||
function(set_file_warnings)
|
||||
# Helper function to enable compiler warnings for a specific target
|
||||
function(set_target_warnings target)
|
||||
option(WARNINGS_AS_ERRORS "Treat compiler warnings as errors" TRUE)
|
||||
|
||||
set(MSVC_WARNINGS
|
||||
@ -106,7 +106,5 @@ function(set_file_warnings)
|
||||
message(AUTHOR_WARNING "No compiler warnings set for '${CMAKE_CXX_COMPILER_ID}' compiler.")
|
||||
endif()
|
||||
|
||||
foreach(WARNING ${FILE_WARNINGS})
|
||||
set_property(SOURCE ${ARGV} APPEND_STRING PROPERTY COMPILE_FLAGS " ${WARNING}")
|
||||
endforeach()
|
||||
target_compile_options(${target} PRIVATE ${FILE_WARNINGS})
|
||||
endfunction()
|
||||
|
@ -84,7 +84,7 @@ macro(sfml_add_library module)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
set_file_warnings(${THIS_SOURCES})
|
||||
set_target_warnings(${target})
|
||||
|
||||
# define the export symbol of the module
|
||||
string(REPLACE "-" "_" NAME_UPPER "${target}")
|
||||
@ -286,7 +286,7 @@ macro(sfml_add_example target)
|
||||
add_executable(${target} ${target_input})
|
||||
endif()
|
||||
|
||||
set_file_warnings(${target_input})
|
||||
set_target_warnings(${target})
|
||||
|
||||
# set the debug suffix
|
||||
set_target_properties(${target} PROPERTIES DEBUG_POSTFIX -d)
|
||||
|
Loading…
Reference in New Issue
Block a user