Ninja Multi-Config: Fix cross-config codegen target suffix

The target that runs codegen for all cross-configs was named
`codegen:codegen`. Name it `codegen:all` to follow the documented
`<target>:all` convention, as the `all` target already does.

Amends commit 197cb419d1 (add_custom_command: Add CODEGEN support,
2024-05-27, v3.31.0-rc1~394^2).
This commit is contained in:
Tyler Yankee committed 2026-10-25 19:52:43 -04:00
1 parent f54117c6b1
commit fe95f96096
4 files changed
+29 -2

No files matched your search

+1 -2
View File
@@ -1959,8 +1959,7 @@ void cmGlobalNinjaGenerator::WriteFolderTargets(std::ostream& os)
build.ExplicitDeps.push_back(
this->BuildAlias(buildDirCodegenTarget, config));
}
build.Outputs.front() =
this->BuildAlias(buildDirCodegenTarget, "codegen");
build.Outputs.front() = this->BuildAlias(buildDirCodegenTarget, "all");
this->WriteBuild(os, build);
}
}
+17
View File
@@ -32,10 +32,27 @@ run_codegen("add-dependencies-not-all")
block()
if(RunCMake_GENERATOR_IS_MULTI_CONFIG)
set(RunCMake_TEST_OPTIONS "-DCMAKE_CONFIGURATION_TYPES=Debug\\;Release")
if(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
list(APPEND RunCMake_TEST_OPTIONS
-DCMAKE_CROSS_CONFIGS=all
-DCMAKE_DEFAULT_BUILD_TYPE=Release
)
endif()
else()
set(RunCMake_TEST_OPTIONS -DCMAKE_BUILD_TYPE=Debug)
endif()
run_codegen("per-config")
if(RunCMake_GENERATOR STREQUAL "Ninja Multi-Config")
set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/per-config-build)
set(RunCMake_TEST_NO_CLEAN 1)
run_cmake_command(per-config-default-build ${CMAKE_COMMAND} --build . --target codegen)
file(REMOVE_RECURSE
${RunCMake_TEST_BINARY_DIR}/Debug
${RunCMake_TEST_BINARY_DIR}/Release
)
run_cmake_command(per-config-all-build ${CMAKE_COMMAND} --build . --target codegen:all)
endif()
endblock()
# Error handling
@@ -0,0 +1,6 @@
foreach(config IN ITEMS Debug Release)
set(filename "${RunCMake_TEST_BINARY_DIR}/${config}/generated.h")
if (NOT EXISTS "${filename}")
string(APPEND RunCMake_TEST_FAILED "expected file NOT created:\n ${filename}\n")
endif()
endforeach()
@@ -0,0 +1,5 @@
set(filename "${RunCMake_TEST_BINARY_DIR}/Release/generated.h")
if (NOT EXISTS "${filename}")
set(RunCMake_TEST_FAILED "expected file NOT created:\n ${filename}")
return()
endif()