diff options
author | Marc Chevrier <marc.chevrier@gmail.com> | 2020-12-04 17:35:04 (GMT) |
---|---|---|
committer | Marc Chevrier <marc.chevrier@gmail.com> | 2020-12-23 14:47:46 (GMT) |
commit | cfd8a5ac1f443725342517ddbaee51692d8d0324 (patch) | |
tree | bf2224cb9c6b6ba1a7aed1eb2fbcaf31799cbc17 /Source/cmLocalUnixMakefileGenerator3.cxx | |
parent | a526f71266c2fed017c65a3d90b63286221476c0 (diff) | |
download | CMake-cfd8a5ac1f443725342517ddbaee51692d8d0324.zip CMake-cfd8a5ac1f443725342517ddbaee51692d8d0324.tar.gz CMake-cfd8a5ac1f443725342517ddbaee51692d8d0324.tar.bz2 |
Makefiles: Add support of DEPFILE for add_custom_command
Issue: #20286
Fixes: #21415
Diffstat (limited to 'Source/cmLocalUnixMakefileGenerator3.cxx')
-rw-r--r-- | Source/cmLocalUnixMakefileGenerator3.cxx | 39 |
1 files changed, 27 insertions, 12 deletions
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx index 08cefb7..358df9d 100644 --- a/Source/cmLocalUnixMakefileGenerator3.cxx +++ b/Source/cmLocalUnixMakefileGenerator3.cxx @@ -13,6 +13,7 @@ #include <cm/string_view> #include <cm/vector> #include <cmext/algorithm> +#include <cmext/string_view> #include "cmsys/FStream.hxx" #include "cmsys/Terminal.h" @@ -1435,7 +1436,7 @@ bool cmLocalUnixMakefileGenerator3::UpdateDependencies( this->Makefile->GetSafeDefinition("CMAKE_DEPENDS_DEPENDENCY_FILES"); if (!depends.empty()) { // dependencies are managed by compiler - auto depFiles = cmExpandedList(depends); + auto depFiles = cmExpandedList(depends, true); std::string const internalDepFile = targetDir + "/compiler_depend.internal"; std::string const depFile = targetDir + "/compiler_depend.make"; @@ -1998,18 +1999,32 @@ void cmLocalUnixMakefileGenerator3::WriteDependLanguageInfo( cmakefileStream << "\n# The set of dependency files which are needed:\n"; cmakefileStream << "set(CMAKE_DEPENDS_DEPENDENCY_FILES\n"; for (auto const& compilerLang : compilerLangs) { - auto depFormat = this->Makefile->GetSafeDefinition( - cmStrCat("CMAKE_", compilerLang.first, "_DEPFILE_FORMAT")); auto const& compilerPairs = compilerLang.second; - for (auto const& compilerPair : compilerPairs) { - for (auto const& src : compilerPair.second) { - cmakefileStream << " \"" << src << "\" \"" - << this->MaybeConvertToRelativePath( - this->GetBinaryDirectory(), compilerPair.first) - << "\" \"" << depFormat << "\" \"" - << this->MaybeConvertToRelativePath( - this->GetBinaryDirectory(), compilerPair.first) - << ".d\"\n"; + if (compilerLang.first == "CUSTOM"_s) { + for (auto const& compilerPair : compilerPairs) { + for (auto const& src : compilerPair.second) { + cmakefileStream << R"( "" ")" + << this->MaybeConvertToRelativePath( + this->GetBinaryDirectory(), compilerPair.first) + << R"(" "custom" ")" + << this->MaybeConvertToRelativePath( + this->GetBinaryDirectory(), src) + << "\"\n"; + } + } + } else { + auto depFormat = this->Makefile->GetSafeDefinition( + cmStrCat("CMAKE_", compilerLang.first, "_DEPFILE_FORMAT")); + for (auto const& compilerPair : compilerPairs) { + for (auto const& src : compilerPair.second) { + cmakefileStream << " \"" << src << "\" \"" + << this->MaybeConvertToRelativePath( + this->GetBinaryDirectory(), compilerPair.first) + << "\" \"" << depFormat << "\" \"" + << this->MaybeConvertToRelativePath( + this->GetBinaryDirectory(), compilerPair.first) + << ".d\"\n"; + } } } } |