Skip to content

Commit

Permalink
Use set_source_files_properties for warning flags in CMake.
Browse files Browse the repository at this point in the history
Fixes #3029
  • Loading branch information
tobbi committed Aug 19, 2024
1 parent ec7ce7d commit 7f82f7c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ endif()
target_link_libraries(supertux2 supertux2_lib)

set_target_properties(supertux2_lib PROPERTIES OUTPUT_NAME supertux2_lib)
set_target_properties(supertux2_lib PROPERTIES COMPILE_FLAGS "${SUPERTUX2_EXTRA_WARNING_FLAGS}")
set_source_files_properties(${SUPERTUX_SOURCES_CXX} PROPERTIES COMPILE_OPTIONS "${SUPERTUX2_EXTRA_WARNING_FLAGS}")
if(EMSCRIPTEN)
target_link_options(supertux2 PUBLIC -sEXPORTED_FUNCTIONS=['_main','_set_resolution','_save_config','_onDownloadProgress','_onDownloadFinished','_onDownloadError','_onDownloadAborted','_getExceptionMessage'] PUBLIC -sEXPORTED_RUNTIME_METHODS=['ccall','cwrap'])
endif()
Expand Down
8 changes: 3 additions & 5 deletions mk/cmake/SuperTux/WarningFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_LD_FLAGS_PROFILE "-lgmon" CACHE STRING "Profile flags")

if(WERROR)
string(CONCAT SUPERTUX2_EXTRA_WARNING_FLAGS "-Werror ")
string(CONCAT SUPERTUX2_EXTRA_WARNING_FLAGS "-Werror;")
endif()

if(WARNINGS)
Expand Down Expand Up @@ -75,7 +75,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
foreach(flag IN LISTS ALL_WARNING_FLAGS)
check_cxx_compiler_flag(${flag} HAVE_FLAG_${flag})
if(HAVE_FLAG_${flag})
string(APPEND SUPERTUX2_EXTRA_WARNING_FLAGS "${flag} ")
string(APPEND SUPERTUX2_EXTRA_WARNING_FLAGS "${flag};")
endif()
unset(HAVE_FLAG CACHE)
endforeach(flag IN LISTS ALL_WARNING_FLAGS)
Expand All @@ -87,9 +87,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
check_cxx_compiler_flag(-Wpoison-system-directories HAVE_POISON_SYSTEM_DIRECTORIES_WARNING)
endif()
if(HAVE_POISON_SYSTEM_DIRECTORIES_WARNING)
string(CONCAT SUPERTUX2_EXTRA_WARNING_FLAGS
"${SUPERTUX2_EXTRA_WARNING_FLAGS} "
"-Wno-poison-system-directories ")
string(APPEND SUPERTUX2_EXTRA_WARNING_FLAGS "-Wno-poison-system-directories;")
endif()
endif()
endif()
Expand Down

0 comments on commit 7f82f7c

Please sign in to comment.