|
@@ -4,6 +4,8 @@
|
|
|
#include "cmQtAutoGeneratorCommon.h"
|
|
#include "cmQtAutoGeneratorCommon.h"
|
|
|
|
|
|
|
|
#include "cmAlgorithms.h"
|
|
#include "cmAlgorithms.h"
|
|
|
|
|
+#include "cmConfigure.h"
|
|
|
|
|
+#include "cmCustomCommand.h"
|
|
|
#include "cmCustomCommandLines.h"
|
|
#include "cmCustomCommandLines.h"
|
|
|
#include "cmFilePathChecksum.h"
|
|
#include "cmFilePathChecksum.h"
|
|
|
#include "cmGeneratorTarget.h"
|
|
#include "cmGeneratorTarget.h"
|
|
@@ -19,13 +21,8 @@
|
|
|
#include "cmTarget.h"
|
|
#include "cmTarget.h"
|
|
|
#include "cm_sys_stat.h"
|
|
#include "cm_sys_stat.h"
|
|
|
#include "cmake.h"
|
|
#include "cmake.h"
|
|
|
-
|
|
|
|
|
-#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
|
|
|
-#include "cmGlobalVisualStudioGenerator.h"
|
|
|
|
|
-#endif
|
|
|
|
|
-
|
|
|
|
|
-#include "cmConfigure.h"
|
|
|
|
|
#include "cmsys/FStream.hxx"
|
|
#include "cmsys/FStream.hxx"
|
|
|
|
|
+
|
|
|
#include <algorithm>
|
|
#include <algorithm>
|
|
|
#include <map>
|
|
#include <map>
|
|
|
#include <set>
|
|
#include <set>
|
|
@@ -710,12 +707,13 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|
|
|
cmLocalGenerator* localGen, cmGeneratorTarget* target)
|
|
cmLocalGenerator* localGen, cmGeneratorTarget* target)
|
|
|
{
|
|
{
|
|
|
cmMakefile* makefile = target->Target->GetMakefile();
|
|
cmMakefile* makefile = target->Target->GetMakefile();
|
|
|
|
|
+ cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator();
|
|
|
|
|
|
|
|
// Create a custom target for running generators at buildtime
|
|
// Create a custom target for running generators at buildtime
|
|
|
const bool mocEnabled = target->GetPropertyAsBool("AUTOMOC");
|
|
const bool mocEnabled = target->GetPropertyAsBool("AUTOMOC");
|
|
|
const bool uicEnabled = target->GetPropertyAsBool("AUTOUIC");
|
|
const bool uicEnabled = target->GetPropertyAsBool("AUTOUIC");
|
|
|
const bool rccEnabled = target->GetPropertyAsBool("AUTORCC");
|
|
const bool rccEnabled = target->GetPropertyAsBool("AUTORCC");
|
|
|
- const bool multiConfig = AutogenMultiConfig(target->GetGlobalGenerator());
|
|
|
|
|
|
|
+ const bool multiConfig = AutogenMultiConfig(globalGen);
|
|
|
const std::string autogenTargetName = GetAutogenTargetName(target);
|
|
const std::string autogenTargetName = GetAutogenTargetName(target);
|
|
|
const std::string autogenBuildDir = GetAutogenTargetBuildDir(target);
|
|
const std::string autogenBuildDir = GetAutogenTargetBuildDir(target);
|
|
|
const std::string workingDirectory =
|
|
const std::string workingDirectory =
|
|
@@ -724,6 +722,15 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|
|
|
std::set<std::string> autogenDependsSet;
|
|
std::set<std::string> autogenDependsSet;
|
|
|
std::vector<std::string> autogenProvides;
|
|
std::vector<std::string> autogenProvides;
|
|
|
|
|
|
|
|
|
|
+ bool usePRE_BUILD = false;
|
|
|
|
|
+ if (globalGen->GetName().find("Visual Studio") != std::string::npos) {
|
|
|
|
|
+ // Under VS use a PRE_BUILD event instead of a separate target to
|
|
|
|
|
+ // reduce the number of targets loaded into the IDE.
|
|
|
|
|
+ // This also works around a VS 11 bug that may skip updating the target:
|
|
|
|
|
+ // https://connect.microsoft.com/VisualStudio/feedback/details/769495
|
|
|
|
|
+ usePRE_BUILD = true;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
// Remove build directories on cleanup
|
|
// Remove build directories on cleanup
|
|
|
AddCleanFile(makefile, autogenBuildDir);
|
|
AddCleanFile(makefile, autogenBuildDir);
|
|
|
|
|
|
|
@@ -791,18 +798,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|
|
|
target->AddIncludeDirectory(includeDir, true);
|
|
target->AddIncludeDirectory(includeDir, true);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
|
|
|
- bool usePRE_BUILD = false;
|
|
|
|
|
- cmGlobalGenerator* gg = localGen->GetGlobalGenerator();
|
|
|
|
|
- if (gg->GetName().find("Visual Studio") != std::string::npos) {
|
|
|
|
|
- // Under VS use a PRE_BUILD event instead of a separate target to
|
|
|
|
|
- // reduce the number of targets loaded into the IDE.
|
|
|
|
|
- // This also works around a VS 11 bug that may skip updating the target:
|
|
|
|
|
- // https://connect.microsoft.com/VisualStudio/feedback/details/769495
|
|
|
|
|
- usePRE_BUILD = true;
|
|
|
|
|
- }
|
|
|
|
|
-#endif
|
|
|
|
|
-
|
|
|
|
|
// Add user defined autogen target dependencies
|
|
// Add user defined autogen target dependencies
|
|
|
{
|
|
{
|
|
|
const std::string deps = GetSafeProperty(target, "AUTOGEN_TARGET_DEPENDS");
|
|
const std::string deps = GetSafeProperty(target, "AUTOGEN_TARGET_DEPENDS");
|
|
@@ -938,7 +933,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|
|
|
// Convert std::set to std::vector
|
|
// Convert std::set to std::vector
|
|
|
const std::vector<std::string> autogenDepends(autogenDependsSet.begin(),
|
|
const std::vector<std::string> autogenDepends(autogenDependsSet.begin(),
|
|
|
autogenDependsSet.end());
|
|
autogenDependsSet.end());
|
|
|
-#if defined(_WIN32) && !defined(__CYGWIN__)
|
|
|
|
|
|
|
+ // Disable PRE_BUILD on demand
|
|
|
if (usePRE_BUILD) {
|
|
if (usePRE_BUILD) {
|
|
|
if (!generatedSources.empty() || !qrcSources.empty()) {
|
|
if (!generatedSources.empty() || !qrcSources.empty()) {
|
|
|
// - Cannot use PRE_BUILD with generated files
|
|
// - Cannot use PRE_BUILD with generated files
|
|
@@ -947,14 +942,15 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|
|
|
// target needs to re-build at all.
|
|
// target needs to re-build at all.
|
|
|
usePRE_BUILD = false;
|
|
usePRE_BUILD = false;
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- if (usePRE_BUILD) {
|
|
|
|
|
- // If the autogen target depends on an other target don't use PRE_BUILD
|
|
|
|
|
- for (std::vector<std::string>::const_iterator it = autogenDepends.begin();
|
|
|
|
|
- it != autogenDepends.end(); ++it) {
|
|
|
|
|
- if (makefile->FindTargetToUse(*it) != CM_NULLPTR) {
|
|
|
|
|
- usePRE_BUILD = false;
|
|
|
|
|
- break;
|
|
|
|
|
|
|
+ if (usePRE_BUILD) {
|
|
|
|
|
+ // If the autogen target depends on an other target don't use PRE_BUILD
|
|
|
|
|
+ for (std::vector<std::string>::const_iterator it =
|
|
|
|
|
+ autogenDepends.begin();
|
|
|
|
|
+ it != autogenDepends.end(); ++it) {
|
|
|
|
|
+ if (makefile->FindTargetToUse(*it) != CM_NULLPTR) {
|
|
|
|
|
+ usePRE_BUILD = false;
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -969,9 +965,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
|
|
|
cc.SetEscapeOldStyle(false);
|
|
cc.SetEscapeOldStyle(false);
|
|
|
cc.SetEscapeAllowMakeVars(true);
|
|
cc.SetEscapeAllowMakeVars(true);
|
|
|
target->Target->AddPreBuildCommand(cc);
|
|
target->Target->AddPreBuildCommand(cc);
|
|
|
- } else
|
|
|
|
|
-#endif
|
|
|
|
|
- {
|
|
|
|
|
|
|
+ } else {
|
|
|
cmTarget* autogenTarget = makefile->AddUtilityCommand(
|
|
cmTarget* autogenTarget = makefile->AddUtilityCommand(
|
|
|
autogenTargetName, true, workingDirectory.c_str(),
|
|
autogenTargetName, true, workingDirectory.c_str(),
|
|
|
/*byproducts=*/autogenProvides, autogenDepends, commandLines, false,
|
|
/*byproducts=*/autogenProvides, autogenDepends, commandLines, false,
|