Commit 1eb1b409 authored by Sebastian Holtermann's avatar Sebastian Holtermann
Browse files

Autogen: Remove VS specific code exclusion

The amount of disabled code was small.
Also the #ifdef tests were confusing and made
testing on non Windows machines more difficult.
parent 54ec2a8b
......@@ -4,6 +4,8 @@
#include "cmQtAutoGeneratorCommon.h"
#include "cmAlgorithms.h"
#include "cmConfigure.h"
#include "cmCustomCommand.h"
#include "cmCustomCommandLines.h"
#include "cmFilePathChecksum.h"
#include "cmGeneratorTarget.h"
......@@ -19,13 +21,8 @@
#include "cmTarget.h"
#include "cm_sys_stat.h"
#include "cmake.h"
#if defined(_WIN32) && !defined(__CYGWIN__)
#include "cmGlobalVisualStudioGenerator.h"
#endif
#include "cmConfigure.h"
#include "cmsys/FStream.hxx"
#include <algorithm>
#include <map>
#include <set>
......@@ -710,12 +707,13 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
cmLocalGenerator* localGen, cmGeneratorTarget* target)
{
cmMakefile* makefile = target->Target->GetMakefile();
cmGlobalGenerator* globalGen = localGen->GetGlobalGenerator();
// Create a custom target for running generators at buildtime
const bool mocEnabled = target->GetPropertyAsBool("AUTOMOC");
const bool uicEnabled = target->GetPropertyAsBool("AUTOUIC");
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 autogenBuildDir = GetAutogenTargetBuildDir(target);
const std::string workingDirectory =
......@@ -724,6 +722,15 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
std::set<std::string> autogenDependsSet;
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
AddCleanFile(makefile, autogenBuildDir);
......@@ -791,18 +798,6 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
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
{
const std::string deps = GetSafeProperty(target, "AUTOGEN_TARGET_DEPENDS");
......@@ -938,7 +933,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// Convert std::set to std::vector
const std::vector<std::string> autogenDepends(autogenDependsSet.begin(),
autogenDependsSet.end());
#if defined(_WIN32) && !defined(__CYGWIN__)
// Disable PRE_BUILD on demand
if (usePRE_BUILD) {
if (!generatedSources.empty() || !qrcSources.empty()) {
// - Cannot use PRE_BUILD with generated files
......@@ -947,10 +942,10 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
// target needs to re-build at all.
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();
for (std::vector<std::string>::const_iterator it =
autogenDepends.begin();
it != autogenDepends.end(); ++it) {
if (makefile->FindTargetToUse(*it) != CM_NULLPTR) {
usePRE_BUILD = false;
......@@ -958,6 +953,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
}
}
}
}
if (usePRE_BUILD) {
// Add the pre-build command directly to bypass the OBJECT_LIBRARY
// rejection in cmMakefile::AddCustomCommandToTarget because we know
......@@ -969,9 +965,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
cc.SetEscapeOldStyle(false);
cc.SetEscapeAllowMakeVars(true);
target->Target->AddPreBuildCommand(cc);
} else
#endif
{
} else {
cmTarget* autogenTarget = makefile->AddUtilityCommand(
autogenTargetName, true, workingDirectory.c_str(),
/*byproducts=*/autogenProvides, autogenDepends, commandLines, false,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment