Merge topic 'build-database-fixes'

12d73c9f78 cmExperimental: recycle build database uuid
d02ca76184 cmDyndepCollation: record required modules to the build database
8a773168fd Tests/CXXModules: help diagnose build database errors
7ca4ac8e13 cmBuildDatabase: fix language comparison for visibility

Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: buildbot <buildbot@kitware.com>
Merge-request: !10414
This commit is contained in:
Brad King 2025-03-05 13:32:40 +00:00 committed by Kitware Robot
commit 3524abf345
20 changed files with 37 additions and 22 deletions

View File

@ -105,7 +105,7 @@ Build database support
In order to activate support for exporting build databases, set
* variable ``CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE`` to
* value ``4bd552e2-b7fb-429a-ab23-c83ef53f3f13``.
* value ``73194a1d-c0b5-41b9-9190-a4512925e192``.
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

View File

@ -447,7 +447,7 @@ cmBuildDatabase cmBuildDatabase::ForTarget(cmGeneratorTarget* gt,
bool isCXXModule = false;
bool isPrivate = true;
if (sf->GetLanguage() != "CXX"_s) {
if (sf->GetLanguage() == "CXX"_s) {
auto const* fs = gt->GetFileSetForSource(config, sf);
if (fs && fs->GetType() == "CXX_MODULES"_s) {
isCXXModule = true;

View File

@ -644,6 +644,9 @@ bool cmDyndepCollation::WriteDyndepMetadata(
result = false;
}
}
for (auto const& req : object.Requires) {
bdb_entry->second->Requires.push_back(req.LogicalName);
}
} else if (export_info.DatabaseInfo) {
cmSystemTools::Error(cmStrCat(
"Failed to find module database entry for ", file_set.SourcePath));

View File

@ -68,7 +68,7 @@ cmExperimental::FeatureData LookupTable[] = {
false },
// ExportBuildDatabase
{ "ExportBuildDatabase",
"4bd552e2-b7fb-429a-ab23-c83ef53f3f13",
"73194a1d-c0b5-41b9-9190-a4512925e192",
"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.",

View File

@ -2,7 +2,7 @@
# here.
set(CMAKE_CXX_SCANDEP_SOURCE "")
set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "4bd552e2-b7fb-429a-ab23-c83ef53f3f13")
set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "73194a1d-c0b5-41b9-9190-a4512925e192")
enable_language(CXX)

View File

@ -70,7 +70,19 @@ function (check_build_database expect_basename fname component)
file(READ "${RunCMake_TEST_BINARY_DIR}/${fname}" actual)
file(READ "${expected_file}" expect)
set(RunCMake_TEST_FAILED_before "${RunCMake_TEST_FAILED}")
set(RunCMake_TEST_FAILED "")
check_json("${actual}" "${expect}")
if (RunCMake_TEST_FAILED)
string(PREPEND RunCMake_TEST_FAILED
"${RunCMake_TEST_FAILED_before}\n"
"actual file: ${RunCMake_TEST_BINARY_DIR}/${fname}\n"
"expect file: ${expected_file}\n")
else ()
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED_before}")
endif ()
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}" PARENT_SCOPE)
endfunction ()

View File

@ -138,7 +138,7 @@
"-Dfrom_source_option"
],
"object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "PATH:<BINARY_DIR>/CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable<BMIEXT>"
},
@ -285,7 +285,7 @@
"-Dfrom_source_option"
],
"object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<BINARY_DIR>/CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable<BMIEXT>"
},

View File

@ -138,7 +138,7 @@
"-Dfrom_source_option"
],
"object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<BINARY_DIR>/CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable<BMIEXT>"
},

View File

@ -138,7 +138,7 @@
"-Dfrom_source_option"
],
"object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "PATH:<BINARY_DIR>/CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable<BMIEXT>"
},

View File

@ -138,7 +138,7 @@
"-Dfrom_source_option"
],
"object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "PATH:<BINARY_DIR>/CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable<BMIEXT>"
},

View File

@ -138,7 +138,7 @@
"-Dfrom_source_option"
],
"object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "PATH:<BINARY_DIR>/CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable<BMIEXT>"
},
@ -285,7 +285,7 @@
"-Dfrom_source_option"
],
"object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "PATH:<BINARY_DIR>/CMakeFiles/export_build_database.dir<CONFIG_OTHER_DIR>/importable<BMIEXT>"
},

View File

@ -138,7 +138,7 @@
"-Dfrom_source_option"
],
"object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "PATH:<BINARY_DIR>/CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable<BMIEXT>"
},

View File

@ -180,7 +180,7 @@
"-Dtarget_interface_option"
],
"object": "PATH:CMakeFiles/use_import_interfaces.dir<CONFIG_DIR>/use.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<IGNORE>"
},
@ -263,7 +263,7 @@
"-Dtarget_interface_option"
],
"object": "PATH:CMakeFiles/use_import_interfaces.dir<CONFIG_OTHER_DIR>/use.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<IGNORE>"
},

View File

@ -127,7 +127,7 @@
"-Dtarget_interface_option"
],
"object": "PATH:CMakeFiles/use_import_interfaces.dir<CONFIG_DIR>/use.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<IGNORE>"
},

View File

@ -127,7 +127,7 @@
"-Dtarget_interface_option"
],
"object": "PATH:CMakeFiles/use_import_interfaces.dir<CONFIG_DIR>/use.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<IGNORE>"
},

View File

@ -127,7 +127,7 @@
"-Dtarget_interface_option"
],
"object": "PATH:CMakeFiles/use_import_interfaces.dir<CONFIG_DIR>/use.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<IGNORE>"
},

View File

@ -180,7 +180,7 @@
"-Dtarget_interface_option"
],
"object": "PATH:CMakeFiles/use_import_interfaces.dir<CONFIG_DIR>/use.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<IGNORE>"
},
@ -263,7 +263,7 @@
"-Dtarget_interface_option"
],
"object": "PATH:CMakeFiles/use_import_interfaces.dir<CONFIG_OTHER_DIR>/use.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<IGNORE>"
},

View File

@ -127,7 +127,7 @@
"-Dtarget_interface_option"
],
"object": "PATH:CMakeFiles/use_import_interfaces.dir<CONFIG_DIR>/use.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<IGNORE>"
},

View File

@ -138,7 +138,7 @@
"-Dfrom_source_option"
],
"object": "PATH:CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable.cxx<OBJEXT>",
"private": true,
"private": false,
"provides": {
"importable": "<BINARY_DIR>/CMakeFiles/export_build_database.dir<CONFIG_DIR>/importable<BMIEXT>"
},

View File

@ -1,4 +1,4 @@
set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "4bd552e2-b7fb-429a-ab23-c83ef53f3f13")
set(CMAKE_EXPERIMENTAL_EXPORT_BUILD_DATABASE "73194a1d-c0b5-41b9-9190-a4512925e192")
get_property(is_multiconfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if (is_multiconfig)