Merge topic 'cmp0171-diagnostic-context'

556bd0d722 CMP0171: Improve diagnostic context

Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !12043
This commit is contained in:
Brad King
2026-05-12 10:42:38 -04:00
committed by Kitware Robot
4 changed files with 11 additions and 1 deletions
+1 -1
View File
@@ -3101,7 +3101,7 @@ void cmGlobalGenerator::ReserveGlobalTargetCodegen()
switch (policyStatus) {
case cmPolicies::WARN:
this->GetCMakeInstance()->IssueDiagnostic(
tgt->GetMakefile()->IssueDiagnostic(
cmDiagnostics::CMD_AUTHOR,
cmStrCat(cmPolicies::GetPolicyWarning(cmPolicies::CMP0171), '\n',
"The target name \"codegen\" is reserved."),
@@ -0,0 +1 @@
add_subdirectory("CMP0171-WARN-QUIET")
@@ -0,0 +1,8 @@
# CMake should warn the user if they have a target named codegen... unless the
# user also suppresses the diagnostic.
cmake_diagnostic(SET CMD_AUTHOR IGNORE RECURSE)
add_custom_target(codegen
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_SOURCE_DIR}/generated.h.in
${CMAKE_CURRENT_BINARY_DIR}/generated.h
)
@@ -1,6 +1,7 @@
include(RunCMake)
run_cmake("CMP0171-WARN")
run_cmake("CMP0171-WARN-QUIET")
run_cmake_with_options(CMP0171-OLD "-DCMAKE_POLICY_DEFAULT_CMP0171=OLD")