diff options
author | Craig Scott <craig.scott@crascit.com> | 2022-05-10 12:52:18 (GMT) |
---|---|---|
committer | Craig Scott <craig.scott@crascit.com> | 2022-05-13 08:03:36 (GMT) |
commit | a6c34b0353e62457465248334703cbd641b2545c (patch) | |
tree | 7d51fc255e6b3fc36c474a80e08704be0c9f3208 /Source/cmGlobalGenerator.cxx | |
parent | 8aa29a1793f8f5c34b92864e53d6806725e5aa57 (diff) | |
download | CMake-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.cxx | 27 |
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 |