mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-23 09:37:51 +08:00
COMPILE_WARNING_AS_ERROR: Fix internal formatting of options table
In commit 76a08cd253
(COMPILE_WARNING_AS_ERROR: Add options to treat
warnings as errors, 2022-04-21, v3.24.0-rc1~173^2) we formatted the
options table entries as command-line string fragments. Since they are
part of the `CMAKE_${lang}_COMPILE_OPTIONS_*` tables, they should be
formatted as `;`-separated lists of compiler options.
This commit is contained in:
@@ -13,5 +13,5 @@ include(Compiler/PGI)
|
|||||||
macro(__compiler_nvhpc lang)
|
macro(__compiler_nvhpc lang)
|
||||||
# Logic specific to NVHPC.
|
# Logic specific to NVHPC.
|
||||||
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
|
set(CMAKE_INCLUDE_SYSTEM_FLAG_${lang} "-isystem ")
|
||||||
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror all-warnings")
|
set(CMAKE_${lang}_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror" "all-warnings")
|
||||||
endmacro()
|
endmacro()
|
||||||
|
@@ -31,7 +31,7 @@ endif()
|
|||||||
|
|
||||||
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
|
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
|
||||||
# Starting in 10.2, nvcc supported treating all warnings as errors
|
# Starting in 10.2, nvcc supported treating all warnings as errors
|
||||||
set(CMAKE_CUDA_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror all-warnings")
|
set(CMAKE_CUDA_COMPILE_OPTIONS_WARNING_AS_ERROR "-Werror" "all-warnings")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
|
if (CMAKE_CUDA_COMPILER_VERSION VERSION_GREATER_EQUAL 10.2.89)
|
||||||
|
@@ -1028,10 +1028,14 @@ void cmLocalGenerator::AddCompileOptions(std::vector<BT<std::string>>& flags,
|
|||||||
// Add Warning as errors flags
|
// Add Warning as errors flags
|
||||||
if (!this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
|
if (!this->GetCMakeInstance()->GetIgnoreWarningAsError()) {
|
||||||
const cmValue wError = target->GetProperty("COMPILE_WARNING_AS_ERROR");
|
const cmValue wError = target->GetProperty("COMPILE_WARNING_AS_ERROR");
|
||||||
const cmValue wErrorFlag = this->Makefile->GetDefinition(
|
const cmValue wErrorOpts = this->Makefile->GetDefinition(
|
||||||
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_WARNING_AS_ERROR"));
|
cmStrCat("CMAKE_", lang, "_COMPILE_OPTIONS_WARNING_AS_ERROR"));
|
||||||
if (wError.IsOn() && wErrorFlag.IsSet()) {
|
if (wError.IsOn() && wErrorOpts.IsSet()) {
|
||||||
flags.emplace_back(wErrorFlag);
|
std::string wErrorFlags;
|
||||||
|
this->AppendCompileOptions(wErrorFlags, *wErrorOpts);
|
||||||
|
if (!wErrorFlags.empty()) {
|
||||||
|
flags.emplace_back(std::move(wErrorFlags));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user