summaryrefslogtreecommitdiffstats
path: root/Source/cmGlobalGenerator.cxx
diff options
context:
space:
mode:
authorCraig Scott <craig.scott@crascit.com>2022-05-10 12:52:18 (GMT)
committerCraig Scott <craig.scott@crascit.com>2022-05-13 08:03:36 (GMT)
commita6c34b0353e62457465248334703cbd641b2545c (patch)
tree7d51fc255e6b3fc36c474a80e08704be0c9f3208 /Source/cmGlobalGenerator.cxx
parent8aa29a1793f8f5c34b92864e53d6806725e5aa57 (diff)
downloadCMake-a6c34b0353e62457465248334703cbd641b2545c.zip
CMake-a6c34b0353e62457465248334703cbd641b2545c.tar.gz
CMake-a6c34b0353e62457465248334703cbd641b2545c.tar.bz2
project(): Add new CMAKE_PROJECT_TOP_LEVEL_INCLUDES file injection point
Fixes: #22685
Diffstat (limited to 'Source/cmGlobalGenerator.cxx')
-rw-r--r--Source/cmGlobalGenerator.cxx27
1 files changed, 27 insertions, 0 deletions
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 09e2abe..3831546 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -688,6 +688,33 @@ void cmGlobalGenerator::EnableLanguage(
if (!this->FindMakeProgram(mf)) {
return;
}
+
+ // One-time includes of user-provided project setup files
+ std::string includes =
+ mf->GetSafeDefinition("CMAKE_PROJECT_TOP_LEVEL_INCLUDES");
+ std::vector<std::string> includesList = cmExpandedList(includes);
+ for (std::string const& setupFile : includesList) {
+ std::string absSetupFile = cmSystemTools::CollapseFullPath(
+ setupFile, mf->GetCurrentSourceDirectory());
+ if (!cmSystemTools::FileExists(absSetupFile)) {
+ cmSystemTools::Error(
+ "CMAKE_PROJECT_TOP_LEVEL_INCLUDES file does not exist: " +
+ setupFile);
+ return;
+ }
+ if (cmSystemTools::FileIsDirectory(absSetupFile)) {
+ cmSystemTools::Error(
+ "CMAKE_PROJECT_TOP_LEVEL_INCLUDES file is a directory: " +
+ setupFile);
+ return;
+ }
+ if (!mf->ReadListFile(absSetupFile)) {
+ cmSystemTools::Error(
+ "Failed reading CMAKE_PROJECT_TOP_LEVEL_INCLUDES file: " +
+ setupFile);
+ return;
+ }
+ }
}
// Check that the languages are supported by the generator and its