mirror of
https://gitlab.kitware.com/cmake/cmake.git
synced 2026-09-25 04:09:36 +03:00
builddb: support builds with empty configuration
Rotates the UUID to indicate changed behavior. See: https://discourse.cmake.org/t/15654
This commit is contained in:
@@ -87,7 +87,7 @@ Build database support
|
||||
In order to activate support for exporting build databases, set
|
||||
|
||||
* variable ``CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE`` to
|
||||
* value ``73194a1d-c0b5-41b9-9190-a4512925e192``.
|
||||
* value ``70ef007e-b743-492d-9407-e35eeac03a40``.
|
||||
|
||||
This UUID may change in future versions of CMake. Be sure to use the value
|
||||
documented here by the source tree of the version of CMake with which you are
|
||||
|
||||
@@ -48,7 +48,7 @@ cmExperimental::FeatureData const LookupTable[] = {
|
||||
cmExperimental::TryCompileCondition::Always },
|
||||
// ExportBuildDatabase
|
||||
{ "ExportBuildDatabase",
|
||||
"73194a1d-c0b5-41b9-9190-a4512925e192",
|
||||
"70ef007e-b743-492d-9407-e35eeac03a40",
|
||||
"CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE",
|
||||
"CMake's support for exporting build databases is experimental. It is "
|
||||
"meant only for experimentation and feedback to CMake developers.",
|
||||
|
||||
@@ -141,7 +141,7 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t, cmLocalGenerator* lg)
|
||||
}
|
||||
|
||||
auto configs =
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::ExcludeEmptyConfig);
|
||||
this->Makefile->GetGeneratorConfigs(cmMakefile::IncludeEmptyConfig);
|
||||
std::string build_db_languages[] = { "CXX" };
|
||||
for (auto const& language : build_db_languages) {
|
||||
for (auto const& config : configs) {
|
||||
|
||||
@@ -3447,6 +3447,31 @@ bool cmGlobalGenerator::AddBuildDatabaseTargets()
|
||||
|
||||
std::string module_languages[] = { "CXX" };
|
||||
|
||||
// Handle config-less builds.
|
||||
if (configs.empty()) {
|
||||
std::vector<std::string> all_lang_paths;
|
||||
for (auto const& lang : module_languages) {
|
||||
auto comment = cmStrCat("Combining module command databases for ", lang);
|
||||
auto output = cmStrCat(mf->GetHomeOutputDirectory(), "/build_database_",
|
||||
lang, ".json");
|
||||
mf->GetOrCreateGeneratedSource(output);
|
||||
AddMergeTarget(
|
||||
cmStrCat(TargetPrefix, '-', lang), comment.c_str(), output,
|
||||
[this, lang]() { return this->PerLanguageModuleDbs[lang]; });
|
||||
all_lang_paths.emplace_back(std::move(output));
|
||||
}
|
||||
|
||||
// Add the overall target.
|
||||
auto const* comment = "Combining module command databases";
|
||||
auto output =
|
||||
cmStrCat(mf->GetHomeOutputDirectory(), "/build_database.json");
|
||||
mf->GetOrCreateGeneratedSource(output);
|
||||
AddMergeTarget(std::string{ TargetPrefix }, comment, output,
|
||||
[all_lang_paths]() { return all_lang_paths; });
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
// Add per-configuration targets.
|
||||
for (auto const& config : configs) {
|
||||
// Add per-language targets.
|
||||
|
||||
@@ -4,7 +4,7 @@ set(CMAKE_INTERMEDIATE_DIR_STRATEGY FULL CACHE STRING "" FORCE)
|
||||
# here.
|
||||
set(CMAKE_CXX_SCANDEP_SOURCE "")
|
||||
|
||||
set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "73194a1d-c0b5-41b9-9190-a4512925e192")
|
||||
set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "70ef007e-b743-492d-9407-e35eeac03a40")
|
||||
|
||||
enable_language(CXX)
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "73194a1d-c0b5-41b9-9190-a4512925e192")
|
||||
set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "70ef007e-b743-492d-9407-e35eeac03a40")
|
||||
|
||||
# _MBCS default append for MSVC ABI workaround: see CMP0204
|
||||
# So, force add the default value for all platforms to be consistent.
|
||||
|
||||
Reference in New Issue
Block a user