summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Holtermann <sebholt@xwmw.org>2017-11-19 12:34:43 (GMT)
committerSebastian Holtermann <sebholt@xwmw.org>2017-11-19 12:35:07 (GMT)
commitbe11a85286ad538654dacce63a6be0af0c3c5bec (patch)
tree00dfc9f12c506e2d77bf4f4b248c800a9ec0db9d
parentab9d5896ae43789872fca2e83d556912abb60254 (diff)
downloadCMake-be11a85286ad538654dacce63a6be0af0c3c5bec.zip
CMake-be11a85286ad538654dacce63a6be0af0c3c5bec.tar.gz
CMake-be11a85286ad538654dacce63a6be0af0c3c5bec.tar.bz2
Autogen: Use project relative paths in rcc custom command comment
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx22
1 files changed, 21 insertions, 1 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index b265f28..a2c9b42 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -147,6 +147,26 @@ static void AddCleanFile(cmMakefile* makefile, std::string const& fileName)
false);
}
+static std::string FileProjectRelativePath(cmMakefile* makefile,
+ std::string const& fileName)
+{
+ std::string res;
+ {
+ std::string pSource = cmSystemTools::RelativePath(
+ makefile->GetCurrentSourceDirectory(), fileName.c_str());
+ std::string pBinary = cmSystemTools::RelativePath(
+ makefile->GetCurrentBinaryDirectory(), fileName.c_str());
+ if (pSource.size() < pBinary.size()) {
+ res = std::move(pSource);
+ } else if (pBinary.size() < fileName.size()) {
+ res = std::move(pBinary);
+ } else {
+ res = fileName;
+ }
+ }
+ return res;
+}
+
/* @brief Tests if targetDepend is a STATIC_LIBRARY and if any of its
* recursive STATIC_LIBRARY dependencies depends on targetOrigin
* (STATIC_LIBRARY cycle).
@@ -646,7 +666,7 @@ void cmQtAutoGeneratorInitializer::InitCustomTargets()
commandLines.push_back(std::move(currentLine));
}
std::string ccComment = "Automatic RCC for ";
- ccComment += qrc.QrcFile;
+ ccComment += FileProjectRelativePath(makefile, qrc.QrcFile);
if (qrc.Generated) {
// Create custom rcc target