Cleanup: remove_cc_flag use in CMake

- Pass multiple arguments at once.
- Move comments above each argument.
- Quote the arguments (for consistency).
This commit is contained in:
Campbell Barton
2023-07-05 13:27:21 +10:00
parent 25cc1b3029
commit 093a948322
5 changed files with 21 additions and 9 deletions

View File

@@ -781,8 +781,12 @@ macro(remove_strict_flags)
endif()
if(MSVC)
remove_cc_flag(/w34100) # Restore warn C4100 (unreferenced formal parameter) back to w4
remove_cc_flag(/w34189) # Restore warn C4189 (unused variable) back to w4
remove_cc_flag(
# Restore warn C4100 (unreferenced formal parameter) back to w4.
"/w34100"
# Restore warn C4189 (unused variable) back to w4.
"/w34189"
)
endif()
endmacro()
@@ -801,7 +805,10 @@ macro(remove_extra_strict_flags)
endif()
if(MSVC)
remove_cc_flag(/w34100) # Restore warn C4100 (unreferenced formal parameter) back to w4
remove_cc_flag(
# Restore warn C4100 (unreferenced formal parameter) back to w4.
"/w34100"
)
endif()
endmacro()

View File

@@ -154,8 +154,11 @@ if(NOT WITH_PYTHON_MODULE)
endif()
configure_file(${CMAKE_SOURCE_DIR}/release/windows/manifest/blender.exe.manifest.in ${CMAKE_CURRENT_BINARY_DIR}/blender.exe.manifest @ONLY)
remove_cc_flag("/MDd" "/MD" "/Zi")
remove_cc_flag(
"/MDd"
"/MD"
"/Zi"
)
if(MSVC_CLANG) # Clangs version of cl doesn't support all flags
string(APPEND CMAKE_CXX_FLAGS " ${CXX_WARN_FLAGS} /nologo /J /Gd /EHsc -Wno-unused-command-line-argument -Wno-microsoft-enum-forward-reference ")

View File

@@ -18,7 +18,7 @@ if(WIN32)
# Some files in extern are being included which brings up a bunch of
# "unreferenced formal parameter" warnings.
# So restore warn C4100 (unreferenced formal parameter) back to w4
remove_cc_flag(/w34100)
remove_cc_flag("/w34100")
endif()

View File

@@ -40,7 +40,7 @@ if(WIN32)
# Some USD library headers trigger the "unreferenced formal parameter"
# warning alert.
# Silence them by restore warn C4100 back to w4
remove_cc_flag(/w34100)
remove_cc_flag("/w34100")
endif()
set(INC

View File

@@ -147,8 +147,10 @@ endif()
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
string(APPEND GENSRC_FLAGS " -Wno-missing-variable-declarations")
elseif(MSVC)
# Restore warn C4100 (unreferenced formal parameter) back to w4
remove_cc_flag(/w34100)
remove_cc_flag(
# Restore warn C4100 (unreferenced formal parameter) back to w4.
"/w34100"
)
endif()
set(GENSRC_C ${GENSRC})