summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Help/release/dev/FindOpenSSL-msvc-static-rt.rst6
-rw-r--r--Modules/FindOpenSSL.cmake17
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/IFW/cmCPackIFWGenerator.cxx1
-rw-r--r--Source/CPack/cmCPackArchiveGenerator.cxx1
-rw-r--r--Source/CPack/cmCPackCygwinBinaryGenerator.cxx1
-rw-r--r--Source/CPack/cmCPackCygwinSourceGenerator.cxx1
-rw-r--r--Source/CPack/cmCPackGenerator.cxx3
-rw-r--r--Source/CPack/cmCPackNSISGenerator.cxx1
-rw-r--r--Source/CPack/cmCPackOSXX11Generator.cxx1
-rw-r--r--Source/CPack/cmCPackPackageMakerGenerator.cxx1
-rw-r--r--Source/CPack/cmCPackSTGZGenerator.cxx1
-rw-r--r--Source/CPack/cpack.cxx3
-rw-r--r--Source/CTest/cmCTestBuildHandler.cxx1
-rw-r--r--Source/CTest/cmCTestLaunch.cxx3
-rw-r--r--Source/CTest/cmCTestScriptHandler.cxx14
-rw-r--r--Source/CTest/cmCTestScriptHandler.h2
-rw-r--r--Source/CTest/cmCTestStartCommand.cxx1
-rw-r--r--Source/CTest/cmCTestTestHandler.cxx3
-rw-r--r--Source/CTest/cmCTestUpdateHandler.cxx1
-rw-r--r--Source/cmAddDependenciesCommand.cxx1
-rw-r--r--Source/cmBuildCommand.cxx1
-rw-r--r--Source/cmCTest.cxx2
-rw-r--r--Source/cmEnableTestingCommand.cxx1
-rw-r--r--Source/cmExportCommand.cxx1
-rw-r--r--Source/cmExportFileGenerator.cxx14
-rw-r--r--Source/cmExportTryCompileFileGenerator.cxx8
-rw-r--r--Source/cmFileCommand.cxx1
-rw-r--r--Source/cmGetCMakePropertyCommand.cxx1
-rw-r--r--Source/cmGetPropertyCommand.cxx1
-rw-r--r--Source/cmGlobalGenerator.cxx56
-rw-r--r--Source/cmGlobalGenerator.h5
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx12
-rw-r--r--Source/cmGlobalVisualStudio10Generator.h2
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx9
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h2
-rw-r--r--Source/cmGlobalVisualStudioGenerator.cxx8
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h2
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx9
-rw-r--r--Source/cmGlobalXCodeGenerator.h2
-rw-r--r--Source/cmIfCommand.cxx1
-rw-r--r--Source/cmListFileCache.cxx2
-rw-r--r--Source/cmLocalGenerator.cxx2
-rw-r--r--Source/cmLocalGenerator.h2
-rw-r--r--Source/cmQtAutoGeneratorInitializer.cxx1118
-rw-r--r--Source/cmQtAutoGeneratorInitializer.h41
-rw-r--r--Source/cmSetTargetPropertiesCommand.cxx1
-rw-r--r--Source/cmSourceFile.cxx1
-rw-r--r--Source/cmSourceFileLocation.cxx1
-rw-r--r--Source/cmake.cxx12
50 files changed, 632 insertions, 751 deletions
diff --git a/Help/release/dev/FindOpenSSL-msvc-static-rt.rst b/Help/release/dev/FindOpenSSL-msvc-static-rt.rst
new file mode 100644
index 0000000..6e0ee27
--- /dev/null
+++ b/Help/release/dev/FindOpenSSL-msvc-static-rt.rst
@@ -0,0 +1,6 @@
+FindOpenSSL-msvc-static-rt
+--------------------------
+
+* The :module:`FindOpenSSL` module gained a new
+ ``OPENSSL_MSVC_STATIC_RT`` option to search for libraries using
+ the MSVC static runtime.
diff --git a/Modules/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake
index d75e8ab..a0f4c52 100644
--- a/Modules/FindOpenSSL.cmake
+++ b/Modules/FindOpenSSL.cmake
@@ -37,6 +37,7 @@
#
# Set ``OPENSSL_ROOT_DIR`` to the root directory of an OpenSSL installation.
# Set ``OPENSSL_USE_STATIC_LIBS`` to ``TRUE`` to look for static libraries.
+# Set ``OPENSSL_MSVC_STATIC_RT`` set ``TRUE`` to choose the MT version of the lib.
#=============================================================================
# Copyright 2006-2009 Kitware, Inc.
@@ -113,7 +114,7 @@ if(WIN32 AND NOT CYGWIN)
# /MD and /MDd are the standard values - if someone wants to use
# others, the libnames have to change here too
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b
- # TODO: handle /MT and static lib
+ # enable OPENSSL_MSVC_STATIC_RT to get the libs build /MT (Multithreaded no-DLL)
# In Visual C++ naming convention each of these four kinds of Windows libraries has it's standard suffix:
# * MD for dynamic-release
# * MDd for dynamic-debug
@@ -126,6 +127,12 @@ if(WIN32 AND NOT CYGWIN)
# ssleay32MD.lib is identical to ../ssleay32.lib
# enable OPENSSL_USE_STATIC_LIBS to use the static libs located in lib/VC/static
+ if (OPENSSL_MSVC_STATIC_RT)
+ set(_OPENSSL_MSVC_RT_MODE "MT")
+ else ()
+ set(_OPENSSL_MSVC_RT_MODE "MD")
+ endif ()
+
if(OPENSSL_USE_STATIC_LIBS)
set(_OPENSSL_PATH_SUFFIXES
"lib"
@@ -142,7 +149,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(LIB_EAY_DEBUG
NAMES
- libeay32MDd
+ libeay32${_OPENSSL_MSVC_RT_MODE}d
libeay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
@@ -151,7 +158,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(LIB_EAY_RELEASE
NAMES
- libeay32MD
+ libeay32${_OPENSSL_MSVC_RT_MODE}
libeay32
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
@@ -160,7 +167,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(SSL_EAY_DEBUG
NAMES
- ssleay32MDd
+ ssleay32${_OPENSSL_MSVC_RT_MODE}d
ssleay32d
${_OPENSSL_ROOT_HINTS_AND_PATHS}
PATH_SUFFIXES
@@ -169,7 +176,7 @@ if(WIN32 AND NOT CYGWIN)
find_library(SSL_EAY_RELEASE
NAMES
- ssleay32MD
+ ssleay32${_OPENSSL_MSVC_RT_MODE}
ssleay32
ssl
${_OPENSSL_ROOT_HINTS_AND_PATHS}
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 1fd5993..852d360 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 4)
-set(CMake_VERSION_PATCH 20151005)
+set(CMake_VERSION_PATCH 20151008)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/IFW/cmCPackIFWGenerator.cxx b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
index 43d34ee..4eb23c1 100644
--- a/Source/CPack/IFW/cmCPackIFWGenerator.cxx
+++ b/Source/CPack/IFW/cmCPackIFWGenerator.cxx
@@ -24,7 +24,6 @@
#include <cmsys/RegularExpression.hxx>
#include <cmGlobalGenerator.h>
-#include <cmLocalGenerator.h>
#include <cmSystemTools.h>
#include <cmMakefile.h>
#include <cmGeneratedFileStream.h>
diff --git a/Source/CPack/cmCPackArchiveGenerator.cxx b/Source/CPack/cmCPackArchiveGenerator.cxx
index 70de757..db985db 100644
--- a/Source/CPack/cmCPackArchiveGenerator.cxx
+++ b/Source/CPack/cmCPackArchiveGenerator.cxx
@@ -14,7 +14,6 @@
#include "cmake.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
diff --git a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
index 6605f16..1f905c0 100644
--- a/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinBinaryGenerator.cxx
@@ -14,7 +14,6 @@
#include "cmake.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
diff --git a/Source/CPack/cmCPackCygwinSourceGenerator.cxx b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
index f1e8539..f5cb53c 100644
--- a/Source/CPack/cmCPackCygwinSourceGenerator.cxx
+++ b/Source/CPack/cmCPackCygwinSourceGenerator.cxx
@@ -14,7 +14,6 @@
#include "cmake.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx
index def9fc7..2f69c25 100644
--- a/Source/CPack/cmCPackGenerator.cxx
+++ b/Source/CPack/cmCPackGenerator.cxx
@@ -16,7 +16,6 @@
#include "cmCPackLog.h"
#include "cmake.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmCPackComponentGroup.h"
#include "cmXMLSafe.h"
@@ -723,8 +722,6 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(
new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(
- gg.CreateLocalGenerator(mf.get()));
std::string realInstallDirectory = tempInstallDirectory;
if ( !installSubDirectory.empty() && installSubDirectory != "/" )
{
diff --git a/Source/CPack/cmCPackNSISGenerator.cxx b/Source/CPack/cmCPackNSISGenerator.cxx
index 6cdda28..52fbdaf 100644
--- a/Source/CPack/cmCPackNSISGenerator.cxx
+++ b/Source/CPack/cmCPackNSISGenerator.cxx
@@ -13,7 +13,6 @@
#include "cmCPackNSISGenerator.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
diff --git a/Source/CPack/cmCPackOSXX11Generator.cxx b/Source/CPack/cmCPackOSXX11Generator.cxx
index d533af8..8940f54 100644
--- a/Source/CPack/cmCPackOSXX11Generator.cxx
+++ b/Source/CPack/cmCPackOSXX11Generator.cxx
@@ -13,7 +13,6 @@
#include "cmake.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
diff --git a/Source/CPack/cmCPackPackageMakerGenerator.cxx b/Source/CPack/cmCPackPackageMakerGenerator.cxx
index 880663f..8fdc036 100644
--- a/Source/CPack/cmCPackPackageMakerGenerator.cxx
+++ b/Source/CPack/cmCPackPackageMakerGenerator.cxx
@@ -13,7 +13,6 @@
#include "cmake.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmGeneratedFileStream.h"
diff --git a/Source/CPack/cmCPackSTGZGenerator.cxx b/Source/CPack/cmCPackSTGZGenerator.cxx
index 109dcb7..68b893f 100644
--- a/Source/CPack/cmCPackSTGZGenerator.cxx
+++ b/Source/CPack/cmCPackSTGZGenerator.cxx
@@ -14,7 +14,6 @@
#include "cmake.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmCPackLog.h"
diff --git a/Source/CPack/cpack.cxx b/Source/CPack/cpack.cxx
index cb9cbc4..f6447ec 100644
--- a/Source/CPack/cpack.cxx
+++ b/Source/CPack/cpack.cxx
@@ -18,7 +18,6 @@
#include "cmCPackGenerator.h"
#include "cmake.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmCPackLog.h"
@@ -204,8 +203,6 @@ int main (int argc, char const* const* argv)
cmGlobalGenerator cmgg(&cminst);
cmsys::auto_ptr<cmMakefile> globalMF(
new cmMakefile(&cmgg, cminst.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> cmlg(
- cmgg.CreateLocalGenerator(globalMF.get()));
#if defined(__CYGWIN__)
globalMF->AddDefinition("CMAKE_LEGACY_CYGWIN_WIN32", "0");
#endif
diff --git a/Source/CTest/cmCTestBuildHandler.cxx b/Source/CTest/cmCTestBuildHandler.cxx
index 6dbb245..0d74f48 100644
--- a/Source/CTest/cmCTestBuildHandler.cxx
+++ b/Source/CTest/cmCTestBuildHandler.cxx
@@ -15,7 +15,6 @@
#include "cmCTest.h"
#include "cmake.h"
#include "cmMakefile.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmXMLWriter.h"
diff --git a/Source/CTest/cmCTestLaunch.cxx b/Source/CTest/cmCTestLaunch.cxx
index fb0cce6..ca5d05a 100644
--- a/Source/CTest/cmCTestLaunch.cxx
+++ b/Source/CTest/cmCTestLaunch.cxx
@@ -728,7 +728,6 @@ int cmCTestLaunch::Main(int argc, const char* const argv[])
//----------------------------------------------------------------------------
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmake.h"
#include <cmsys/auto_ptr.hxx>
@@ -739,8 +738,6 @@ void cmCTestLaunch::LoadConfig()
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(
- gg.CreateLocalGenerator(mf.get()));
std::string fname = this->LogDir;
fname += "CTestLaunchConfig.cmake";
if(cmSystemTools::FileExists(fname.c_str()) &&
diff --git a/Source/CTest/cmCTestScriptHandler.cxx b/Source/CTest/cmCTestScriptHandler.cxx
index c1ba279..2f125aa 100644
--- a/Source/CTest/cmCTestScriptHandler.cxx
+++ b/Source/CTest/cmCTestScriptHandler.cxx
@@ -16,7 +16,6 @@
#include "cmake.h"
#include "cmFunctionBlocker.h"
#include "cmMakefile.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmGeneratedFileStream.h"
@@ -86,7 +85,6 @@ cmCTestScriptHandler::cmCTestScriptHandler()
this->EmptyBinDir = false;
this->EmptyBinDirOnce = false;
this->Makefile = 0;
- this->LocalGenerator = 0;
this->CMake = 0;
this->GlobalGenerator = 0;
@@ -128,9 +126,6 @@ void cmCTestScriptHandler::Initialize()
delete this->Makefile;
this->Makefile = 0;
- delete this->LocalGenerator;
- this->LocalGenerator = 0;
-
delete this->GlobalGenerator;
this->GlobalGenerator = 0;
@@ -141,7 +136,6 @@ void cmCTestScriptHandler::Initialize()
cmCTestScriptHandler::~cmCTestScriptHandler()
{
delete this->Makefile;
- delete this->LocalGenerator;
delete this->GlobalGenerator;
delete this->CMake;
}
@@ -179,15 +173,14 @@ int cmCTestScriptHandler::ProcessHandler()
void cmCTestScriptHandler::UpdateElapsedTime()
{
- if (this->LocalGenerator)
+ if (this->Makefile)
{
// set the current elapsed time
char timeString[20];
int itime = static_cast<unsigned int>(cmSystemTools::GetTime()
- this->ScriptStartTime);
sprintf(timeString,"%i",itime);
- this->LocalGenerator->GetMakefile()->AddDefinition("CTEST_ELAPSED_TIME",
- timeString);
+ this->Makefile->AddDefinition("CTEST_ELAPSED_TIME", timeString);
}
}
@@ -316,7 +309,6 @@ void cmCTestScriptHandler::CreateCMake()
{
delete this->CMake;
delete this->GlobalGenerator;
- delete this->LocalGenerator;
delete this->Makefile;
}
this->CMake = new cmake;
@@ -327,8 +319,6 @@ void cmCTestScriptHandler::CreateCMake()
cmState::Snapshot snapshot = this->CMake->GetCurrentSnapshot();
this->Makefile = new cmMakefile(this->GlobalGenerator, snapshot);
- this->LocalGenerator =
- this->GlobalGenerator->CreateLocalGenerator(this->Makefile);
this->CMake->SetProgressCallback(ctestScriptProgressCallback, this->CTest);
diff --git a/Source/CTest/cmCTestScriptHandler.h b/Source/CTest/cmCTestScriptHandler.h
index 42c2f20..c9d0b6a 100644
--- a/Source/CTest/cmCTestScriptHandler.h
+++ b/Source/CTest/cmCTestScriptHandler.h
@@ -18,7 +18,6 @@
#include "cmListFileCache.h"
class cmMakefile;
-class cmLocalGenerator;
class cmGlobalGenerator;
class cmake;
class cmCTestCommand;
@@ -166,7 +165,6 @@ private:
double ScriptStartTime;
cmMakefile *Makefile;
- cmLocalGenerator *LocalGenerator;
cmGlobalGenerator *GlobalGenerator;
cmake *CMake;
};
diff --git a/Source/CTest/cmCTestStartCommand.cxx b/Source/CTest/cmCTestStartCommand.cxx
index e19e4f4..36576c5 100644
--- a/Source/CTest/cmCTestStartCommand.cxx
+++ b/Source/CTest/cmCTestStartCommand.cxx
@@ -12,7 +12,6 @@
#include "cmCTestStartCommand.h"
#include "cmCTest.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmCTestVC.h"
#include "cmGeneratedFileStream.h"
diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx
index f9678e7..968a307 100644
--- a/Source/CTest/cmCTestTestHandler.cxx
+++ b/Source/CTest/cmCTestTestHandler.cxx
@@ -24,7 +24,6 @@
#include <cmsys/FStream.hxx>
#include "cmMakefile.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmCommand.h"
#include "cmSystemTools.h"
#include "cmXMLWriter.h"
@@ -1593,8 +1592,6 @@ void cmCTestTestHandler::GetListOfTests()
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(
- gg.CreateLocalGenerator(mf.get()));
mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
this->CTest->GetConfigType().c_str());
diff --git a/Source/CTest/cmCTestUpdateHandler.cxx b/Source/CTest/cmCTestUpdateHandler.cxx
index 963e501..bf2f34a 100644
--- a/Source/CTest/cmCTestUpdateHandler.cxx
+++ b/Source/CTest/cmCTestUpdateHandler.cxx
@@ -15,7 +15,6 @@
#include "cmCTest.h"
#include "cmake.h"
#include "cmMakefile.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmVersion.h"
#include "cmGeneratedFileStream.h"
diff --git a/Source/cmAddDependenciesCommand.cxx b/Source/cmAddDependenciesCommand.cxx
index 3a74946..01e5253 100644
--- a/Source/cmAddDependenciesCommand.cxx
+++ b/Source/cmAddDependenciesCommand.cxx
@@ -10,7 +10,6 @@
See the License for more information.
============================================================================*/
#include "cmAddDependenciesCommand.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
// cmDependenciesCommand
diff --git a/Source/cmBuildCommand.cxx b/Source/cmBuildCommand.cxx
index 62fafa5..64d4fca 100644
--- a/Source/cmBuildCommand.cxx
+++ b/Source/cmBuildCommand.cxx
@@ -11,7 +11,6 @@
============================================================================*/
#include "cmBuildCommand.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
//----------------------------------------------------------------------
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index 6e55d89..67eb042 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -14,7 +14,6 @@
#include "cmCTest.h"
#include "cmake.h"
#include "cmMakefile.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include <cmsys/Base64.h>
#include <cmsys/Directory.hxx>
@@ -520,7 +519,6 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command)
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
if ( !this->ReadCustomConfigurationFileTree(this->BinaryDir.c_str(),
mf.get()) )
{
diff --git a/Source/cmEnableTestingCommand.cxx b/Source/cmEnableTestingCommand.cxx
index aa41ef7..6a7fd46 100644
--- a/Source/cmEnableTestingCommand.cxx
+++ b/Source/cmEnableTestingCommand.cxx
@@ -10,7 +10,6 @@
See the License for more information.
============================================================================*/
#include "cmEnableTestingCommand.h"
-#include "cmLocalGenerator.h"
// we do this in the final pass so that we now the subdirs have all
// been defined
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index 96ea77b..6a1d7f3 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -11,7 +11,6 @@
============================================================================*/
#include "cmExportCommand.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmGeneratedFileStream.h"
#include "cmake.h"
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 9a7d73f..881acee 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -436,7 +436,9 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets)
{
- cmTarget *target = tei->Target;
+ cmGeneratorTarget *target = tei->Target->GetMakefile()
+ ->GetGlobalGenerator()
+ ->GetGeneratorTarget(tei->Target);
assert(preprocessRule == cmGeneratorExpression::InstallInterface);
const char *propName = "INTERFACE_INCLUDE_DIRECTORIES";
@@ -450,12 +452,12 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
true);
this->ReplaceInstallPrefix(dirs);
cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(dirs);
- std::string exportDirs = cge->Evaluate(target->GetMakefile(), "",
- false, target);
+ std::string exportDirs = cge->Evaluate(target->Target->GetMakefile(), "",
+ false, target->Target);
if (cge->GetHadContextSensitiveCondition())
{
- cmMakefile* mf = target->GetMakefile();
+ cmMakefile* mf = target->Target->GetMakefile();
std::ostringstream e;
e << "Target \"" << target->GetName() << "\" is installed with "
"INCLUDES DESTINATION set to a context sensitive path. Paths which "
@@ -486,10 +488,10 @@ void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
true);
if (!prepro.empty())
{
- this->ResolveTargetsInGeneratorExpressions(prepro, target,
+ this->ResolveTargetsInGeneratorExpressions(prepro, target->Target,
missingTargets);
- if (!checkInterfaceDirs(prepro, target, propName))
+ if (!checkInterfaceDirs(prepro, target->Target, propName))
{
return;
}
diff --git a/Source/cmExportTryCompileFileGenerator.cxx b/Source/cmExportTryCompileFileGenerator.cxx
index ba66531..026584c 100644
--- a/Source/cmExportTryCompileFileGenerator.cxx
+++ b/Source/cmExportTryCompileFileGenerator.cxx
@@ -76,8 +76,12 @@ std::string cmExportTryCompileFileGenerator::FindTargets(
dummyHead.SetType(cmTarget::EXECUTABLE, "try_compile_dummy_exe");
dummyHead.SetMakefile(tgt->GetMakefile());
- std::string result = cge->Evaluate(tgt->GetMakefile(), this->Config,
- false, &dummyHead, tgt, &dagChecker);
+ cmGeneratorTarget* gtgt =
+ tgt->GetMakefile()->GetGlobalGenerator()->GetGeneratorTarget(tgt);
+
+ std::string result = cge->Evaluate(gtgt->Target->GetMakefile(), this->Config,
+ false, &dummyHead,
+ gtgt->Target, &dagChecker);
const std::set<cmTarget const*> &allTargets = cge->GetAllTargetsSeen();
for(std::set<cmTarget const*>::const_iterator li = allTargets.begin();
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index 87faf84..df95d9d 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -15,7 +15,6 @@
#include "cmHexFileConverter.h"
#include "cmInstallType.h"
#include "cmFileTimeComparison.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmCryptoHash.h"
#include "cmAlgorithms.h"
diff --git a/Source/cmGetCMakePropertyCommand.cxx b/Source/cmGetCMakePropertyCommand.cxx
index 248ce59..1a91183 100644
--- a/Source/cmGetCMakePropertyCommand.cxx
+++ b/Source/cmGetCMakePropertyCommand.cxx
@@ -12,7 +12,6 @@
#include "cmGetCMakePropertyCommand.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmake.h"
#include "cmState.h"
#include "cmAlgorithms.h"
diff --git a/Source/cmGetPropertyCommand.cxx b/Source/cmGetPropertyCommand.cxx
index 4c42f53..617a811 100644
--- a/Source/cmGetPropertyCommand.cxx
+++ b/Source/cmGetPropertyCommand.cxx
@@ -15,7 +15,6 @@
#include "cmState.h"
#include "cmTest.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmSourceFile.h"
#include "cmPropertyDefinition.h"
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 4a48b5d..05f1029 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -1251,7 +1251,7 @@ bool cmGlobalGenerator::Compute()
#ifdef CMAKE_BUILD_WITH_CMAKE
// Iterate through all targets and set up automoc for those which have
// the AUTOMOC, AUTOUIC or AUTORCC property set
- std::vector<cmTarget const*> autogenTargets =
+ std::vector<cmGeneratorTarget const*> autogenTargets =
this->CreateQtAutoGeneratorsTargets();
#endif
@@ -1264,8 +1264,8 @@ bool cmGlobalGenerator::Compute()
}
#ifdef CMAKE_BUILD_WITH_CMAKE
- for (std::vector<cmTarget const*>::iterator it = autogenTargets.begin();
- it != autogenTargets.end(); ++it)
+ for (std::vector<cmGeneratorTarget const*>::iterator it =
+ autogenTargets.begin(); it != autogenTargets.end(); ++it)
{
cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(*it);
}
@@ -1282,12 +1282,7 @@ bool cmGlobalGenerator::Compute()
}
}
- return true;
-}
-
-void cmGlobalGenerator::Generate()
-{
- unsigned int i;
+ this->AddExtraIDETargets();
// Trace the dependencies, after that no custom commands should be added
// because their dependencies might not be handled correctly
@@ -1307,22 +1302,27 @@ void cmGlobalGenerator::Generate()
// Compute the inter-target dependencies.
if(!this->ComputeTargetDepends())
{
- return;
+ return false;
+ }
+
+ for (i = 0; i < this->LocalGenerators.size(); ++i)
+ {
+ this->LocalGenerators[i]->ComputeHomeRelativeOutputPath();
}
+ return true;
+}
+
+void cmGlobalGenerator::Generate()
+{
// Create a map from local generator to the complete set of targets
// it builds by default.
this->InitializeProgressMarks();
this->ProcessEvaluationFiles();
- for (i = 0; i < this->LocalGenerators.size(); ++i)
- {
- this->LocalGenerators[i]->ComputeHomeRelativeOutputPath();
- }
-
// Generate project files
- for (i = 0; i < this->LocalGenerators.size(); ++i)
+ for (unsigned int i = 0; i < this->LocalGenerators.size(); ++i)
{
this->SetCurrentMakefile(this->LocalGenerators[i]->GetMakefile());
this->LocalGenerators[i]->Generate();
@@ -1403,18 +1403,18 @@ bool cmGlobalGenerator::ComputeTargetDepends()
}
//----------------------------------------------------------------------------
-std::vector<const cmTarget*>
+std::vector<const cmGeneratorTarget*>
cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
{
- std::vector<const cmTarget*> autogenTargets;
+ std::vector<const cmGeneratorTarget*> autogenTargets;
#ifdef CMAKE_BUILD_WITH_CMAKE
for(unsigned int i=0; i < this->LocalGenerators.size(); ++i)
{
cmTargets& targets =
this->LocalGenerators[i]->GetMakefile()->GetTargets();
- std::vector<std::string> targetNames;
- targetNames.reserve(targets.size());
+ std::vector<cmGeneratorTarget*> filteredTargets;
+ filteredTargets.reserve(targets.size());
for(cmTargets::iterator ti = targets.begin();
ti != targets.end(); ++ti)
{
@@ -1449,17 +1449,17 @@ cmGlobalGenerator::CreateQtAutoGeneratorsTargets()
continue;
}
- cmQtAutoGeneratorInitializer::InitializeAutogenSources(&ti->second);
- targetNames.push_back(ti->second.GetName());
+ cmGeneratorTarget* gt = this->GetGeneratorTarget(&ti->second);
+
+ cmQtAutoGeneratorInitializer::InitializeAutogenSources(gt);
+ filteredTargets.push_back(gt);
}
- for(std::vector<std::string>::iterator ti = targetNames.begin();
- ti != targetNames.end(); ++ti)
+ for(std::vector<cmGeneratorTarget*>::iterator ti = filteredTargets.begin();
+ ti != filteredTargets.end(); ++ti)
{
- cmTarget* target = this->LocalGenerators[i]
- ->GetMakefile()->FindTarget(*ti, true);
cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
- this->LocalGenerators[i], target);
- autogenTargets.push_back(target);
+ this->LocalGenerators[i], *ti);
+ autogenTargets.push_back(*ti);
}
}
#endif
diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h
index ba74c9e..b22c695 100644
--- a/Source/cmGlobalGenerator.h
+++ b/Source/cmGlobalGenerator.h
@@ -83,7 +83,8 @@ public:
*/
virtual void Configure();
- virtual bool Compute();
+ bool Compute();
+ virtual void AddExtraIDETargets() {}
enum TargetTypes {
AllTargets,
@@ -384,7 +385,7 @@ protected:
virtual bool CheckALLOW_DUPLICATE_CUSTOM_TARGETS() const;
- std::vector<cmTarget const*> CreateQtAutoGeneratorsTargets();
+ std::vector<const cmGeneratorTarget*> CreateQtAutoGeneratorsTargets();
std::string SelectMakeProgram(const std::string& makeProgram,
const std::string& makeDefault = "") const;
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index 59e8f8c..161b532 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -325,19 +325,9 @@ cmLocalGenerator* cmGlobalVisualStudio10Generator::CreateLocalGenerator(
return new cmLocalVisualStudio10Generator(this, mf);
}
-//----------------------------------------------------------------------------
-bool cmGlobalVisualStudio10Generator::Compute()
-{
- if (!cmGlobalVisualStudio8Generator::Compute())
- {
- return false;
- }
- this->LongestSource = LongestSourcePath();
- return true;
-}
-
void cmGlobalVisualStudio10Generator::Generate()
{
+ this->LongestSource = LongestSourcePath();
this->cmGlobalVisualStudio8Generator::Generate();
if(this->LongestSource.Length > 0)
{
diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h
index f4861dc..7600a0d 100644
--- a/Source/cmGlobalVisualStudio10Generator.h
+++ b/Source/cmGlobalVisualStudio10Generator.h
@@ -45,8 +45,6 @@ public:
std::vector<std::string> const& makeOptions = std::vector<std::string>()
);
- virtual bool Compute();
-
///! create the correct local generator
virtual cmLocalGenerator *CreateLocalGenerator(cmMakefile* mf);
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 70c00e9..86a8f87 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -348,13 +348,9 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
}
//----------------------------------------------------------------------------
-bool cmGlobalVisualStudio8Generator::Compute()
+void cmGlobalVisualStudio8Generator::AddExtraIDETargets()
{
- if (!cmGlobalVisualStudio7Generator::Compute())
- {
- return false;
- }
-
+ cmGlobalVisualStudio7Generator::AddExtraIDETargets();
if(this->AddCheckTarget())
{
// All targets depend on the build-system check target.
@@ -368,7 +364,6 @@ bool cmGlobalVisualStudio8Generator::Compute()
}
}
}
- return true;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 1c61103..9d6c64f 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -67,7 +67,7 @@ public:
return !this->WindowsCEVersion.empty(); }
protected:
- virtual bool Compute();
+ virtual void AddExtraIDETargets();
virtual const char* GetIDEVersion() { return "8.0"; }
virtual std::string FindDevEnvCommand();
diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx
index 7552d67..d45aa27 100644
--- a/Source/cmGlobalVisualStudioGenerator.cxx
+++ b/Source/cmGlobalVisualStudioGenerator.cxx
@@ -64,13 +64,8 @@ std::string cmGlobalVisualStudioGenerator::GetRegistryBase(
}
//----------------------------------------------------------------------------
-bool cmGlobalVisualStudioGenerator::Compute()
+void cmGlobalVisualStudioGenerator::AddExtraIDETargets()
{
- if (!cmGlobalGenerator::Compute())
- {
- return false;
- }
-
// Add a special target that depends on ALL projects for easy build
// of one configuration only.
const char* no_working_dir = 0;
@@ -144,7 +139,6 @@ bool cmGlobalVisualStudioGenerator::Compute()
static_cast<cmLocalVisualStudioGenerator*>(*lgi);
lg->AddCMakeListsRules();
}
- return true;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index c940eb3..41d0b88 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -111,7 +111,7 @@ public:
cmGeneratorTarget*, std::vector<cmCustomCommand>& commands,
std::string const& configName);
protected:
- virtual bool Compute();
+ virtual void AddExtraIDETargets();
// Does this VS version link targets to each other if there are
// dependencies in the SLN file? This was done for VS versions
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 33babec..746e1a7 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -376,14 +376,8 @@ cmGlobalXCodeGenerator::CreateLocalGenerator(cmMakefile* mf)
return new cmLocalXCodeGenerator(this, mf);
}
-//----------------------------------------------------------------------------
-bool cmGlobalXCodeGenerator::Compute()
+void cmGlobalXCodeGenerator::AddExtraIDETargets()
{
- if (!cmGlobalGenerator::Compute())
- {
- return false;
- }
-
std::map<std::string, std::vector<cmLocalGenerator*> >::iterator it;
// make sure extra targets are added before calling
// the parent generate which will call trace depends
@@ -394,7 +388,6 @@ bool cmGlobalXCodeGenerator::Compute()
// add ALL_BUILD, INSTALL, etc
this->AddExtraTargets(root, it->second);
}
- return true;
}
void cmGlobalXCodeGenerator::Generate()
diff --git a/Source/cmGlobalXCodeGenerator.h b/Source/cmGlobalXCodeGenerator.h
index 102c036..9daf0ab 100644
--- a/Source/cmGlobalXCodeGenerator.h
+++ b/Source/cmGlobalXCodeGenerator.h
@@ -87,7 +87,7 @@ public:
virtual bool SetGeneratorToolset(std::string const& ts, cmMakefile* mf);
void AppendFlag(std::string& flags, std::string const& flag);
protected:
- virtual bool Compute();
+ virtual void AddExtraIDETargets();
virtual void Generate();
private:
cmXCodeObject* CreateOrGetPBXGroup(cmTarget& cmtarget,
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index 20448c1..a03808f 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -11,6 +11,7 @@
============================================================================*/
#include "cmIfCommand.h"
#include "cmStringCommand.h"
+#include "cmOutputConverter.h"
#include "cmConditionEvaluator.h"
diff --git a/Source/cmListFileCache.cxx b/Source/cmListFileCache.cxx
index bff2986..5050229 100644
--- a/Source/cmListFileCache.cxx
+++ b/Source/cmListFileCache.cxx
@@ -12,7 +12,7 @@
#include "cmListFileCache.h"
#include "cmListFileLexer.h"
-#include "cmLocalGenerator.h"
+#include "cmOutputConverter.h"
#include "cmSystemTools.h"
#include "cmMakefile.h"
#include "cmVersion.h"
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 3230403..b26151c 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -1180,7 +1180,7 @@ void cmLocalGenerator::AddCompileOptions(
//----------------------------------------------------------------------------
void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
- cmGeneratorTarget* target,
+ cmGeneratorTarget const* target,
const std::string& lang,
const std::string& config,
bool stripImplicitInclDirs
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index 6ea414a..33fede1 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -171,7 +171,7 @@ public:
/** Get the include flags for the current makefile and language. */
void GetIncludeDirectories(std::vector<std::string>& dirs,
- cmGeneratorTarget* target,
+ cmGeneratorTarget const* target,
const std::string& lang = "C",
const std::string& config = "",
bool stripImplicitInclDirs = true) const;
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx
index 24e7ed8..2703f4c 100644
--- a/Source/cmQtAutoGeneratorInitializer.cxx
+++ b/Source/cmQtAutoGeneratorInitializer.cxx
@@ -25,22 +25,421 @@
# include "cmGlobalVisualStudioGenerator.h"
#endif
-std::string cmQtAutoGeneratorInitializer::GetAutogenTargetName(
- cmTarget const* target)
+static void SetupSourceFiles(cmGeneratorTarget const* target,
+ std::vector<std::string>& skipMoc,
+ std::vector<std::string>& mocSources,
+ std::vector<std::string>& mocHeaders,
+ std::vector<std::string>& skipUic)
+{
+ cmMakefile* makefile = target->Target->GetMakefile();
+
+ std::vector<cmSourceFile*> srcFiles;
+ target->GetConfigCommonSourceFiles(srcFiles);
+
+ std::vector<std::string> newRccFiles;
+
+ for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
+ fileIt != srcFiles.end();
+ ++fileIt)
+ {
+ cmSourceFile* sf = *fileIt;
+ std::string absFile = cmsys::SystemTools::GetRealPath(
+ sf->GetFullPath());
+ bool skipFileForMoc =
+ cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC"));
+ bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"));
+
+ if(cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC")))
+ {
+ skipUic.push_back(absFile);
+ }
+
+ std::string ext = sf->GetExtension();
+
+ if (target->GetPropertyAsBool("AUTORCC"))
+ {
+ if (ext == "qrc"
+ && !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")))
+ {
+ std::string basename = cmsys::SystemTools::
+ GetFilenameWithoutLastExtension(absFile);
+
+ std::string rcc_output_dir = target->Target->GetSupportDirectory();
+ cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
+ std::string rcc_output_file = rcc_output_dir;
+ rcc_output_file += "/qrc_" + basename + ".cpp";
+ makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
+ rcc_output_file.c_str(), false);
+ makefile->GetOrCreateSource(rcc_output_file, true);
+ newRccFiles.push_back(rcc_output_file);
+ }
+ }
+
+ if (!generated)
+ {
+ if (skipFileForMoc)
+ {
+ skipMoc.push_back(absFile);
+ }
+ else
+ {
+ cmSystemTools::FileFormat fileType = cmSystemTools::GetFileFormat(
+ ext.c_str());
+ if (fileType == cmSystemTools::CXX_FILE_FORMAT)
+ {
+ mocSources.push_back(absFile);
+ }
+ else if (fileType == cmSystemTools::HEADER_FILE_FORMAT)
+ {
+ mocHeaders.push_back(absFile);
+ }
+ }
+ }
+ }
+
+ for(std::vector<std::string>::const_iterator fileIt = newRccFiles.begin();
+ fileIt != newRccFiles.end();
+ ++fileIt)
+ {
+ const_cast<cmTarget*>(target->Target)->AddSource(*fileIt);
+ }
+}
+
+static void GetCompileDefinitionsAndDirectories(
+ cmGeneratorTarget const* target,
+ const std::string& config,
+ std::string &incs,
+ std::string &defs)
+{
+ std::vector<std::string> includeDirs;
+ cmLocalGenerator *localGen = target->GetLocalGenerator();
+ // Get the include dirs for this target, without stripping the implicit
+ // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667
+ localGen->GetIncludeDirectories(includeDirs, target, "CXX", config, false);
+
+ incs = cmJoin(includeDirs, ";");
+
+ std::set<std::string> defines;
+ localGen->AddCompileDefinitions(defines, target->Target, config, "CXX");
+
+ defs += cmJoin(defines, ";");
+}
+
+static void SetupAutoMocTarget(cmGeneratorTarget const* target,
+ const std::string &autogenTargetName,
+ std::vector<std::string> const& skipMoc,
+ std::vector<std::string> const& mocHeaders,
+ std::map<std::string, std::string> &configIncludes,
+ std::map<std::string, std::string> &configDefines)
+{
+ cmMakefile* makefile = target->Target->GetMakefile();
+
+ const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
+ std::string _moc_options = (tmp!=0 ? tmp : "");
+ makefile->AddDefinition("_moc_options",
+ cmOutputConverter::EscapeForCMake(_moc_options).c_str());
+ makefile->AddDefinition("_skip_moc",
+ cmOutputConverter::EscapeForCMake(cmJoin(skipMoc, ";")).c_str());
+ makefile->AddDefinition("_moc_headers",
+ cmOutputConverter::EscapeForCMake(cmJoin(mocHeaders, ";")).c_str());
+ bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE");
+ makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE");
+
+ std::string _moc_incs;
+ std::string _moc_compile_defs;
+ std::vector<std::string> configs;
+ const std::string& config = makefile->GetConfigurations(configs);
+ GetCompileDefinitionsAndDirectories(target, config,
+ _moc_incs, _moc_compile_defs);
+
+ makefile->AddDefinition("_moc_incs",
+ cmOutputConverter::EscapeForCMake(_moc_incs).c_str());
+ makefile->AddDefinition("_moc_compile_defs",
+ cmOutputConverter::EscapeForCMake(_moc_compile_defs).c_str());
+
+ for (std::vector<std::string>::const_iterator li = configs.begin();
+ li != configs.end(); ++li)
+ {
+ std::string config_moc_incs;
+ std::string config_moc_compile_defs;
+ GetCompileDefinitionsAndDirectories(target, *li,
+ config_moc_incs,
+ config_moc_compile_defs);
+ if (config_moc_incs != _moc_incs)
+ {
+ configIncludes[*li] =
+ cmOutputConverter::EscapeForCMake(config_moc_incs);
+ if(_moc_incs.empty())
+ {
+ _moc_incs = config_moc_incs;
+ }
+ }
+ if (config_moc_compile_defs != _moc_compile_defs)
+ {
+ configDefines[*li] =
+ cmOutputConverter::EscapeForCMake(config_moc_compile_defs);
+ if(_moc_compile_defs.empty())
+ {
+ _moc_compile_defs = config_moc_compile_defs;
+ }
+ }
+ }
+
+ const char *qtVersion = makefile->GetDefinition("_target_qt_version");
+ if (strcmp(qtVersion, "5") == 0)
+ {
+ cmTarget *qt5Moc = makefile->FindTargetToUse("Qt5::moc");
+ if (!qt5Moc)
+ {
+ cmSystemTools::Error("Qt5::moc target not found ",
+ autogenTargetName.c_str());
+ return;
+ }
+ makefile->AddDefinition("_qt_moc_executable",
+ qt5Moc->ImportedGetLocation(""));
+ }
+ else if (strcmp(qtVersion, "4") == 0)
+ {
+ cmTarget *qt4Moc = makefile->FindTargetToUse("Qt4::moc");
+ if (!qt4Moc)
+ {
+ cmSystemTools::Error("Qt4::moc target not found ",
+ autogenTargetName.c_str());
+ return;
+ }
+ makefile->AddDefinition("_qt_moc_executable",
+ qt4Moc->ImportedGetLocation(""));
+ }
+ else
+ {
+ cmSystemTools::Error("The CMAKE_AUTOMOC feature supports only Qt 4 and "
+ "Qt 5 ", autogenTargetName.c_str());
+ }
+}
+
+static void GetUicOpts(cmGeneratorTarget const* target,
+ const std::string& config,
+ std::string &optString)
+{
+ std::vector<std::string> opts;
+ target->GetAutoUicOptions(opts, config);
+ optString = cmJoin(opts, ";");
+}
+
+static void SetupAutoUicTarget(cmGeneratorTarget const* target,
+ std::vector<std::string> const& skipUic,
+ std::map<std::string, std::string> &configUicOptions)
+{
+ cmMakefile *makefile = target->Target->GetMakefile();
+
+ std::set<std::string> skipped;
+ skipped.insert(skipUic.begin(), skipUic.end());
+
+ makefile->AddDefinition("_skip_uic",
+ cmOutputConverter::EscapeForCMake(cmJoin(skipUic, ";")).c_str());
+
+ std::vector<cmSourceFile*> uiFilesWithOptions
+ = makefile->GetQtUiFilesWithOptions();
+
+ const char *qtVersion = makefile->GetDefinition("_target_qt_version");
+
+ std::string _uic_opts;
+ std::vector<std::string> configs;
+ const std::string& config = makefile->GetConfigurations(configs);
+ GetUicOpts(target, config, _uic_opts);
+
+ if (!_uic_opts.empty())
+ {
+ _uic_opts = cmOutputConverter::EscapeForCMake(_uic_opts);
+ makefile->AddDefinition("_uic_target_options", _uic_opts.c_str());
+ }
+ for (std::vector<std::string>::const_iterator li = configs.begin();
+ li != configs.end(); ++li)
+ {
+ std::string config_uic_opts;
+ GetUicOpts(target, *li, config_uic_opts);
+ if (config_uic_opts != _uic_opts)
+ {
+ configUicOptions[*li] =
+ cmOutputConverter::EscapeForCMake(config_uic_opts);
+ if(_uic_opts.empty())
+ {
+ _uic_opts = config_uic_opts;
+ }
+ }
+ }
+
+ std::string uiFileFiles;
+ std::string uiFileOptions;
+ const char* sep = "";
+
+ for(std::vector<cmSourceFile*>::const_iterator fileIt =
+ uiFilesWithOptions.begin();
+ fileIt != uiFilesWithOptions.end();
+ ++fileIt)
+ {
+ cmSourceFile* sf = *fileIt;
+ std::string absFile = cmsys::SystemTools::GetRealPath(
+ sf->GetFullPath());
+
+ if (!skipped.insert(absFile).second)
+ {
+ continue;
+ }
+ uiFileFiles += sep;
+ uiFileFiles += absFile;
+ uiFileOptions += sep;
+ std::string opts = sf->GetProperty("AUTOUIC_OPTIONS");
+ cmSystemTools::ReplaceString(opts, ";", "@list_sep@");
+ uiFileOptions += opts;
+ sep = ";";
+ }
+
+ makefile->AddDefinition("_qt_uic_options_files",
+ cmOutputConverter::EscapeForCMake(uiFileFiles).c_str());
+ makefile->AddDefinition("_qt_uic_options_options",
+ cmOutputConverter::EscapeForCMake(uiFileOptions).c_str());
+
+ std::string targetName = target->GetName();
+ if (strcmp(qtVersion, "5") == 0)
+ {
+ cmTarget *qt5Uic = makefile->FindTargetToUse("Qt5::uic");
+ if (!qt5Uic)
+ {
+ // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
+ }
+ else
+ {
+ makefile->AddDefinition("_qt_uic_executable",
+ qt5Uic->ImportedGetLocation(""));
+ }
+ }
+ else if (strcmp(qtVersion, "4") == 0)
+ {
+ cmTarget *qt4Uic = makefile->FindTargetToUse("Qt4::uic");
+ if (!qt4Uic)
+ {
+ cmSystemTools::Error("Qt4::uic target not found ",
+ targetName.c_str());
+ return;
+ }
+ makefile->AddDefinition("_qt_uic_executable",
+ qt4Uic->ImportedGetLocation(""));
+ }
+ else
+ {
+ cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and "
+ "Qt 5 ", targetName.c_str());
+ }
+}
+
+static std::string GetRccExecutable(cmGeneratorTarget const* target)
+{
+ cmMakefile *makefile = target->Target->GetMakefile();
+ const char *qtVersion = makefile->GetDefinition("_target_qt_version");
+ if (!qtVersion)
+ {
+ qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
+ if (!qtVersion)
+ {
+ qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
+ }
+ if (const char *targetQtVersion =
+ target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION",
+ ""))
+ {
+ qtVersion = targetQtVersion;
+ }
+ }
+
+ std::string targetName = target->GetName();
+ if (strcmp(qtVersion, "5") == 0)
+ {
+ cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc");
+ if (!qt5Rcc)
+ {
+ cmSystemTools::Error("Qt5::rcc target not found ",
+ targetName.c_str());
+ return std::string();
+ }
+ return qt5Rcc->ImportedGetLocation("");
+ }
+ else if (strcmp(qtVersion, "4") == 0)
+ {
+ cmTarget *qt4Rcc = makefile->FindTargetToUse("Qt4::rcc");
+ if (!qt4Rcc)
+ {
+ cmSystemTools::Error("Qt4::rcc target not found ",
+ targetName.c_str());
+ return std::string();
+ }
+ return qt4Rcc->ImportedGetLocation("");
+ }
+
+ cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and "
+ "Qt 5 ", targetName.c_str());
+ return std::string();
+}
+
+static void MergeRccOptions(std::vector<std::string> &opts,
+ const std::vector<std::string> &fileOpts,
+ bool isQt5)
+{
+ static const char* valueOptions[] = {
+ "name",
+ "root",
+ "compress",
+ "threshold"
+ };
+ std::vector<std::string> extraOpts;
+ for(std::vector<std::string>::const_iterator it = fileOpts.begin();
+ it != fileOpts.end(); ++it)
+ {
+ std::vector<std::string>::iterator existingIt
+ = std::find(opts.begin(), opts.end(), *it);
+ if (existingIt != opts.end())
+ {
+ const char *o = it->c_str();
+ if (*o == '-')
+ {
+ ++o;
+ }
+ if (isQt5 && *o == '-')
+ {
+ ++o;
+ }
+ if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions),
+ cmStrCmp(*it)) != cmArrayEnd(valueOptions))
+ {
+ assert(existingIt + 1 != opts.end());
+ *(existingIt + 1) = *(it + 1);
+ ++it;
+ }
+ }
+ else
+ {
+ extraOpts.push_back(*it);
+ }
+ }
+ opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
+}
+
+std::string GetAutogenTargetName(
+ cmGeneratorTarget const* target)
{
std::string autogenTargetName = target->GetName();
autogenTargetName += "_automoc";
return autogenTargetName;
}
-std::string cmQtAutoGeneratorInitializer::GetAutogenTargetDir(
- cmTarget const* target)
+std::string GetAutogenTargetDir(
+ cmGeneratorTarget const* target)
{
- cmMakefile* makefile = target->GetMakefile();
+ cmMakefile* makefile = target->Target->GetMakefile();
std::string targetDir = makefile->GetCurrentBinaryDirectory();
targetDir += makefile->GetCMakeInstance()->GetCMakeFilesDirectory();
targetDir += "/";
- targetDir += cmQtAutoGeneratorInitializer::GetAutogenTargetName(target);
+ targetDir += GetAutogenTargetName(target);
targetDir += ".dir/";
return targetDir;
}
@@ -76,12 +475,12 @@ static std::string ReadAll(const std::string& filename)
return stream.str();
}
-std::string cmQtAutoGeneratorInitializer::ListQt5RccInputs(cmSourceFile* sf,
- cmTarget const* target,
+static std::string ListQt5RccInputs(cmSourceFile* sf,
+ cmGeneratorTarget const* target,
std::vector<std::string>& depends)
{
std::string rccCommand
- = cmQtAutoGeneratorInitializer::GetRccExecutable(target);
+ = GetRccExecutable(target);
std::vector<std::string> qrcEntries;
std::vector<std::string> command;
@@ -147,7 +546,7 @@ std::string cmQtAutoGeneratorInitializer::ListQt5RccInputs(cmSourceFile* sf,
return cmJoin(qrcEntries, "@list_sep@");
}
-std::string cmQtAutoGeneratorInitializer::ListQt4RccInputs(cmSourceFile* sf,
+static std::string ListQt4RccInputs(cmSourceFile* sf,
std::vector<std::string>& depends)
{
const std::string qrcContents = ReadAll(sf->GetFullPath());
@@ -183,15 +582,125 @@ std::string cmQtAutoGeneratorInitializer::ListQt4RccInputs(cmSourceFile* sf,
return entriesList;
}
+static void SetupAutoRccTarget(cmGeneratorTarget const* target)
+{
+ std::string _rcc_files;
+ const char* sepRccFiles = "";
+ cmMakefile *makefile = target->Target->GetMakefile();
+
+ std::vector<cmSourceFile*> srcFiles;
+ target->GetConfigCommonSourceFiles(srcFiles);
+
+ std::string qrcInputs;
+ const char* qrcInputsSep = "";
+
+ std::string rccFileFiles;
+ std::string rccFileOptions;
+ const char *optionSep = "";
+
+ const char *qtVersion = makefile->GetDefinition("_target_qt_version");
+
+ std::vector<std::string> rccOptions;
+ if (const char* opts = target->GetProperty("AUTORCC_OPTIONS"))
+ {
+ cmSystemTools::ExpandListArgument(opts, rccOptions);
+ }
+ std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
+ if (qtMajorVersion == "")
+ {
+ qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
+ }
+
+ for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
+ fileIt != srcFiles.end();
+ ++fileIt)
+ {
+ cmSourceFile* sf = *fileIt;
+ std::string ext = sf->GetExtension();
+ if (ext == "qrc")
+ {
+ std::string absFile = cmsys::SystemTools::GetRealPath(
+ sf->GetFullPath());
+ bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"));
-void cmQtAutoGeneratorInitializer::InitializeAutogenSources(cmTarget* target)
+ if (!skip)
+ {
+ _rcc_files += sepRccFiles;
+ _rcc_files += absFile;
+ sepRccFiles = ";";
+
+ if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS"))
+ {
+ std::vector<std::string> optsVec;
+ cmSystemTools::ExpandListArgument(prop, optsVec);
+ MergeRccOptions(rccOptions, optsVec,
+ strcmp(qtVersion, "5") == 0);
+ }
+
+ if (!rccOptions.empty())
+ {
+ rccFileFiles += optionSep;
+ rccFileFiles += absFile;
+ rccFileOptions += optionSep;
+ }
+ const char *listSep = "";
+ for(std::vector<std::string>::const_iterator it = rccOptions.begin();
+ it != rccOptions.end();
+ ++it)
+ {
+ rccFileOptions += listSep;
+ rccFileOptions += *it;
+ listSep = "@list_sep@";
+ }
+ optionSep = ";";
+
+ std::vector<std::string> depends;
+
+ std::string entriesList;
+ if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED")))
+ {
+ if (qtMajorVersion == "5")
+ {
+ entriesList = ListQt5RccInputs(sf, target, depends);
+ }
+ else
+ {
+ entriesList = ListQt4RccInputs(sf, depends);
+ }
+ if (entriesList.empty())
+ {
+ return;
+ }
+ }
+ qrcInputs += qrcInputsSep;
+ qrcInputs += entriesList;
+ qrcInputsSep = ";";
+ }
+ }
+ }
+ makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(),
+ cmOutputConverter::EscapeForCMake(qrcInputs).c_str());
+
+ makefile->AddDefinition("_rcc_files",
+ cmOutputConverter::EscapeForCMake(_rcc_files).c_str());
+
+ makefile->AddDefinition("_qt_rcc_options_files",
+ cmOutputConverter::EscapeForCMake(rccFileFiles).c_str());
+ makefile->AddDefinition("_qt_rcc_options_options",
+ cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
+
+ makefile->AddDefinition("_qt_rcc_executable",
+ GetRccExecutable(target).c_str());
+}
+
+void cmQtAutoGeneratorInitializer::InitializeAutogenSources(
+ cmGeneratorTarget* target)
{
- cmMakefile* makefile = target->GetMakefile();
+ cmMakefile* makefile = target->Target->GetMakefile();
if (target->GetPropertyAsBool("AUTOMOC"))
{
- std::string automocTargetName =
- cmQtAutoGeneratorInitializer::GetAutogenTargetName(target);
+ std::string automocTargetName = GetAutogenTargetName(target);
std::string mocCppFile = makefile->GetCurrentBinaryDirectory();
mocCppFile += "/";
mocCppFile += automocTargetName;
@@ -200,15 +709,15 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenSources(cmTarget* target)
makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
mocCppFile.c_str(), false);
- target->AddSource(mocCppFile);
+ target->Target->AddSource(mocCppFile);
}
}
void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
cmLocalGenerator* lg,
- cmTarget* target)
+ cmGeneratorTarget* target)
{
- cmMakefile* makefile = target->GetMakefile();
+ cmMakefile* makefile = target->Target->GetMakefile();
std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
if (qtMajorVersion == "")
@@ -217,11 +726,9 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
}
// create a custom target for running generators at buildtime:
- std::string autogenTargetName =
- cmQtAutoGeneratorInitializer::GetAutogenTargetName(target);
+ std::string autogenTargetName = GetAutogenTargetName(target);
- std::string targetDir =
- cmQtAutoGeneratorInitializer::GetAutogenTargetDir(target);
+ std::string targetDir = GetAutogenTargetDir(target);
cmCustomCommandLine currentLine;
currentLine.push_back(cmSystemTools::GetCMakeCommand());
@@ -307,9 +814,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
)
{
std::vector<cmSourceFile*> srcFiles;
- cmGeneratorTarget* gtgt =
- lg->GetGlobalGenerator()->GetGeneratorTarget(target);
- gtgt->GetConfigCommonSourceFiles(srcFiles);
+ target->GetConfigCommonSourceFiles(srcFiles);
for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
fileIt != srcFiles.end();
++fileIt)
@@ -328,7 +833,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
std::string basename = cmsys::SystemTools::
GetFilenameWithoutLastExtension(absFile);
- std::string rcc_output_dir = target->GetSupportDirectory();
+ std::string rcc_output_dir = target->Target->GetSupportDirectory();
cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
std::string rcc_output_file = rcc_output_dir;
rcc_output_file += "/qrc_" + basename + ".cpp";
@@ -338,12 +843,11 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
{
if (qtMajorVersion == "5")
{
- cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf, target,
- depends);
+ ListQt5RccInputs(sf, target, depends);
}
else
{
- cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends);
+ ListQt4RccInputs(sf, depends);
}
#if defined(_WIN32) && !defined(__CYGWIN__)
// Cannot use PRE_BUILD because the resource files themselves
@@ -370,7 +874,7 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
workingDirectory.c_str());
cc.SetEscapeOldStyle(false);
cc.SetEscapeAllowMakeVars(true);
- target->AddPreBuildCommand(cc);
+ target->Target->AddPreBuildCommand(cc);
}
else
#endif
@@ -399,66 +903,39 @@ void cmQtAutoGeneratorInitializer::InitializeAutogenTarget(
else
{
// inherit FOLDER property from target (#13688)
- copyTargetProperty(autogenTarget, target, "FOLDER");
+ copyTargetProperty(gt->Target, target->Target, "FOLDER");
}
- target->AddUtility(autogenTargetName);
+ target->Target->AddUtility(autogenTargetName);
}
}
-static void GetCompileDefinitionsAndDirectories(cmTarget const* target,
- const std::string& config,
- std::string &incs,
- std::string &defs)
-{
- cmMakefile* makefile = target->GetMakefile();
- cmGlobalGenerator* globalGen = makefile->GetGlobalGenerator();
- std::vector<std::string> includeDirs;
- cmGeneratorTarget *gtgt = globalGen->GetGeneratorTarget(target);
- cmLocalGenerator *localGen = gtgt->GetLocalGenerator();
- // Get the include dirs for this target, without stripping the implicit
- // include dirs off, see http://public.kitware.com/Bug/view.php?id=13667
- localGen->GetIncludeDirectories(includeDirs, gtgt, "CXX", config, false);
-
- incs = cmJoin(includeDirs, ";");
-
- std::set<std::string> defines;
- localGen->AddCompileDefinitions(defines, target, config, "CXX");
-
- defs += cmJoin(defines, ";");
-}
-
void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
- cmTarget const* target)
+ cmGeneratorTarget const* target)
{
- cmMakefile* makefile = target->GetMakefile();
+ cmMakefile* makefile = target->Target->GetMakefile();
// forget the variables added here afterwards again:
cmMakefile::ScopePushPop varScope(makefile);
static_cast<void>(varScope);
// create a custom target for running generators at buildtime:
- std::string autogenTargetName =
- cmQtAutoGeneratorInitializer::GetAutogenTargetName(target);
+ std::string autogenTargetName = GetAutogenTargetName(target);
makefile->AddDefinition("_moc_target_name",
cmOutputConverter::EscapeForCMake(autogenTargetName).c_str());
makefile->AddDefinition("_origin_target_name",
cmOutputConverter::EscapeForCMake(target->GetName()).c_str());
- std::string targetDir =
- cmQtAutoGeneratorInitializer::GetAutogenTargetDir(target);
+ std::string targetDir = GetAutogenTargetDir(target);
const char *qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
if (!qtVersion)
{
qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
}
- cmGeneratorTarget *gtgt = target->GetMakefile()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(target);
if (const char *targetQtVersion =
- gtgt->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", ""))
+ target->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", ""))
{
qtVersion = targetQtVersion;
}
@@ -479,25 +956,23 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
|| target->GetPropertyAsBool("AUTOUIC")
|| target->GetPropertyAsBool("AUTORCC"))
{
- cmQtAutoGeneratorInitializer::SetupSourceFiles(target, skipMoc,
- mocSources, mocHeaders, skipUic);
+ SetupSourceFiles(target, skipMoc, mocSources, mocHeaders, skipUic);
}
makefile->AddDefinition("_cpp_files",
cmOutputConverter::EscapeForCMake(cmJoin(mocSources, ";")).c_str());
if (target->GetPropertyAsBool("AUTOMOC"))
{
- cmQtAutoGeneratorInitializer::SetupAutoMocTarget(target, autogenTargetName,
+ SetupAutoMocTarget(target, autogenTargetName,
skipMoc, mocHeaders,
configIncludes, configDefines);
}
if (target->GetPropertyAsBool("AUTOUIC"))
{
- cmQtAutoGeneratorInitializer::SetupAutoUicTarget(target, skipUic,
- configUicOptions);
+ SetupAutoUicTarget(target, skipUic, configUicOptions);
}
if (target->GetPropertyAsBool("AUTORCC"))
{
- cmQtAutoGeneratorInitializer::SetupAutoRccTarget(target);
+ SetupAutoRccTarget(target);
}
const char* cmakeRoot = makefile->GetSafeDefinition("CMAKE_ROOT");
@@ -567,508 +1042,3 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget(
}
}
}
-
-void cmQtAutoGeneratorInitializer::SetupSourceFiles(cmTarget const* target,
- std::vector<std::string>& skipMoc,
- std::vector<std::string>& mocSources,
- std::vector<std::string>& mocHeaders,
- std::vector<std::string>& skipUic)
-{
- cmMakefile* makefile = target->GetMakefile();
-
- std::vector<cmSourceFile*> srcFiles;
- cmGeneratorTarget *gtgt = target->GetMakefile()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(target);
- gtgt->GetConfigCommonSourceFiles(srcFiles);
-
- std::vector<std::string> newRccFiles;
-
- for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
- fileIt != srcFiles.end();
- ++fileIt)
- {
- cmSourceFile* sf = *fileIt;
- std::string absFile = cmsys::SystemTools::GetRealPath(
- sf->GetFullPath());
- bool skipFileForMoc =
- cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOMOC"));
- bool generated = cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED"));
-
- if(cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTOUIC")))
- {
- skipUic.push_back(absFile);
- }
-
- std::string ext = sf->GetExtension();
-
- if (target->GetPropertyAsBool("AUTORCC"))
- {
- if (ext == "qrc"
- && !cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC")))
- {
- std::string basename = cmsys::SystemTools::
- GetFilenameWithoutLastExtension(absFile);
-
- std::string rcc_output_dir = target->GetSupportDirectory();
- cmSystemTools::MakeDirectory(rcc_output_dir.c_str());
- std::string rcc_output_file = rcc_output_dir;
- rcc_output_file += "/qrc_" + basename + ".cpp";
- makefile->AppendProperty("ADDITIONAL_MAKE_CLEAN_FILES",
- rcc_output_file.c_str(), false);
- makefile->GetOrCreateSource(rcc_output_file, true);
- newRccFiles.push_back(rcc_output_file);
- }
- }
-
- if (!generated)
- {
- if (skipFileForMoc)
- {
- skipMoc.push_back(absFile);
- }
- else
- {
- cmSystemTools::FileFormat fileType = cmSystemTools::GetFileFormat(
- ext.c_str());
- if (fileType == cmSystemTools::CXX_FILE_FORMAT)
- {
- mocSources.push_back(absFile);
- }
- else if (fileType == cmSystemTools::HEADER_FILE_FORMAT)
- {
- mocHeaders.push_back(absFile);
- }
- }
- }
- }
-
- for(std::vector<std::string>::const_iterator fileIt = newRccFiles.begin();
- fileIt != newRccFiles.end();
- ++fileIt)
- {
- const_cast<cmTarget*>(target)->AddSource(*fileIt);
- }
-}
-
-void cmQtAutoGeneratorInitializer::SetupAutoMocTarget(cmTarget const* target,
- const std::string &autogenTargetName,
- std::vector<std::string> const& skipMoc,
- std::vector<std::string> const& mocHeaders,
- std::map<std::string, std::string> &configIncludes,
- std::map<std::string, std::string> &configDefines)
-{
- cmMakefile* makefile = target->GetMakefile();
-
- const char* tmp = target->GetProperty("AUTOMOC_MOC_OPTIONS");
- std::string _moc_options = (tmp!=0 ? tmp : "");
- makefile->AddDefinition("_moc_options",
- cmOutputConverter::EscapeForCMake(_moc_options).c_str());
- makefile->AddDefinition("_skip_moc",
- cmOutputConverter::EscapeForCMake(cmJoin(skipMoc, ";")).c_str());
- makefile->AddDefinition("_moc_headers",
- cmOutputConverter::EscapeForCMake(cmJoin(mocHeaders, ";")).c_str());
- bool relaxedMode = makefile->IsOn("CMAKE_AUTOMOC_RELAXED_MODE");
- makefile->AddDefinition("_moc_relaxed_mode", relaxedMode ? "TRUE" : "FALSE");
-
- std::string _moc_incs;
- std::string _moc_compile_defs;
- std::vector<std::string> configs;
- const std::string& config = makefile->GetConfigurations(configs);
- GetCompileDefinitionsAndDirectories(target, config,
- _moc_incs, _moc_compile_defs);
-
- makefile->AddDefinition("_moc_incs",
- cmOutputConverter::EscapeForCMake(_moc_incs).c_str());
- makefile->AddDefinition("_moc_compile_defs",
- cmOutputConverter::EscapeForCMake(_moc_compile_defs).c_str());
-
- for (std::vector<std::string>::const_iterator li = configs.begin();
- li != configs.end(); ++li)
- {
- std::string config_moc_incs;
- std::string config_moc_compile_defs;
- GetCompileDefinitionsAndDirectories(target, *li,
- config_moc_incs,
- config_moc_compile_defs);
- if (config_moc_incs != _moc_incs)
- {
- configIncludes[*li] =
- cmOutputConverter::EscapeForCMake(config_moc_incs);
- if(_moc_incs.empty())
- {
- _moc_incs = config_moc_incs;
- }
- }
- if (config_moc_compile_defs != _moc_compile_defs)
- {
- configDefines[*li] =
- cmOutputConverter::EscapeForCMake(config_moc_compile_defs);
- if(_moc_compile_defs.empty())
- {
- _moc_compile_defs = config_moc_compile_defs;
- }
- }
- }
-
- const char *qtVersion = makefile->GetDefinition("_target_qt_version");
- if (strcmp(qtVersion, "5") == 0)
- {
- cmTarget *qt5Moc = makefile->FindTargetToUse("Qt5::moc");
- if (!qt5Moc)
- {
- cmSystemTools::Error("Qt5::moc target not found ",
- autogenTargetName.c_str());
- return;
- }
- makefile->AddDefinition("_qt_moc_executable",
- qt5Moc->ImportedGetLocation(""));
- }
- else if (strcmp(qtVersion, "4") == 0)
- {
- cmTarget *qt4Moc = makefile->FindTargetToUse("Qt4::moc");
- if (!qt4Moc)
- {
- cmSystemTools::Error("Qt4::moc target not found ",
- autogenTargetName.c_str());
- return;
- }
- makefile->AddDefinition("_qt_moc_executable",
- qt4Moc->ImportedGetLocation(""));
- }
- else
- {
- cmSystemTools::Error("The CMAKE_AUTOMOC feature supports only Qt 4 and "
- "Qt 5 ", autogenTargetName.c_str());
- }
-}
-
-static void GetUicOpts(cmTarget const* target, const std::string& config,
- std::string &optString)
-{
- cmGeneratorTarget *gtgt = target->GetMakefile()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(target);
- std::vector<std::string> opts;
- gtgt->GetAutoUicOptions(opts, config);
- optString = cmJoin(opts, ";");
-}
-
-void cmQtAutoGeneratorInitializer::SetupAutoUicTarget(cmTarget const* target,
- std::vector<std::string> const& skipUic,
- std::map<std::string, std::string> &configUicOptions)
-{
- cmMakefile *makefile = target->GetMakefile();
-
- std::set<std::string> skipped;
- skipped.insert(skipUic.begin(), skipUic.end());
-
- makefile->AddDefinition("_skip_uic",
- cmOutputConverter::EscapeForCMake(cmJoin(skipUic, ";")).c_str());
-
- std::vector<cmSourceFile*> uiFilesWithOptions
- = makefile->GetQtUiFilesWithOptions();
-
- const char *qtVersion = makefile->GetDefinition("_target_qt_version");
-
- std::string _uic_opts;
- std::vector<std::string> configs;
- const std::string& config = makefile->GetConfigurations(configs);
- GetUicOpts(target, config, _uic_opts);
-
- if (!_uic_opts.empty())
- {
- _uic_opts = cmOutputConverter::EscapeForCMake(_uic_opts);
- makefile->AddDefinition("_uic_target_options", _uic_opts.c_str());
- }
- for (std::vector<std::string>::const_iterator li = configs.begin();
- li != configs.end(); ++li)
- {
- std::string config_uic_opts;
- GetUicOpts(target, *li, config_uic_opts);
- if (config_uic_opts != _uic_opts)
- {
- configUicOptions[*li] =
- cmOutputConverter::EscapeForCMake(config_uic_opts);
- if(_uic_opts.empty())
- {
- _uic_opts = config_uic_opts;
- }
- }
- }
-
- std::string uiFileFiles;
- std::string uiFileOptions;
- const char* sep = "";
-
- for(std::vector<cmSourceFile*>::const_iterator fileIt =
- uiFilesWithOptions.begin();
- fileIt != uiFilesWithOptions.end();
- ++fileIt)
- {
- cmSourceFile* sf = *fileIt;
- std::string absFile = cmsys::SystemTools::GetRealPath(
- sf->GetFullPath());
-
- if (!skipped.insert(absFile).second)
- {
- continue;
- }
- uiFileFiles += sep;
- uiFileFiles += absFile;
- uiFileOptions += sep;
- std::string opts = sf->GetProperty("AUTOUIC_OPTIONS");
- cmSystemTools::ReplaceString(opts, ";", "@list_sep@");
- uiFileOptions += opts;
- sep = ";";
- }
-
- makefile->AddDefinition("_qt_uic_options_files",
- cmOutputConverter::EscapeForCMake(uiFileFiles).c_str());
- makefile->AddDefinition("_qt_uic_options_options",
- cmOutputConverter::EscapeForCMake(uiFileOptions).c_str());
-
- std::string targetName = target->GetName();
- if (strcmp(qtVersion, "5") == 0)
- {
- cmTarget *qt5Uic = makefile->FindTargetToUse("Qt5::uic");
- if (!qt5Uic)
- {
- // Project does not use Qt5Widgets, but has AUTOUIC ON anyway
- }
- else
- {
- makefile->AddDefinition("_qt_uic_executable",
- qt5Uic->ImportedGetLocation(""));
- }
- }
- else if (strcmp(qtVersion, "4") == 0)
- {
- cmTarget *qt4Uic = makefile->FindTargetToUse("Qt4::uic");
- if (!qt4Uic)
- {
- cmSystemTools::Error("Qt4::uic target not found ",
- targetName.c_str());
- return;
- }
- makefile->AddDefinition("_qt_uic_executable",
- qt4Uic->ImportedGetLocation(""));
- }
- else
- {
- cmSystemTools::Error("The CMAKE_AUTOUIC feature supports only Qt 4 and "
- "Qt 5 ", targetName.c_str());
- }
-}
-
-void cmQtAutoGeneratorInitializer::MergeRccOptions(
- std::vector<std::string> &opts,
- const std::vector<std::string> &fileOpts,
- bool isQt5)
-{
- static const char* valueOptions[] = {
- "name",
- "root",
- "compress",
- "threshold"
- };
- std::vector<std::string> extraOpts;
- for(std::vector<std::string>::const_iterator it = fileOpts.begin();
- it != fileOpts.end(); ++it)
- {
- std::vector<std::string>::iterator existingIt
- = std::find(opts.begin(), opts.end(), *it);
- if (existingIt != opts.end())
- {
- const char *o = it->c_str();
- if (*o == '-')
- {
- ++o;
- }
- if (isQt5 && *o == '-')
- {
- ++o;
- }
- if (std::find_if(cmArrayBegin(valueOptions), cmArrayEnd(valueOptions),
- cmStrCmp(*it)) != cmArrayEnd(valueOptions))
- {
- assert(existingIt + 1 != opts.end());
- *(existingIt + 1) = *(it + 1);
- ++it;
- }
- }
- else
- {
- extraOpts.push_back(*it);
- }
- }
- opts.insert(opts.end(), extraOpts.begin(), extraOpts.end());
-}
-
-void cmQtAutoGeneratorInitializer::SetupAutoRccTarget(cmTarget const* target)
-{
- std::string _rcc_files;
- const char* sepRccFiles = "";
- cmMakefile *makefile = target->GetMakefile();
-
- std::vector<cmSourceFile*> srcFiles;
- cmGeneratorTarget *gtgt = target->GetMakefile()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(target);
- gtgt->GetConfigCommonSourceFiles(srcFiles);
-
- std::string qrcInputs;
- const char* qrcInputsSep = "";
-
- std::string rccFileFiles;
- std::string rccFileOptions;
- const char *optionSep = "";
-
- const char *qtVersion = makefile->GetDefinition("_target_qt_version");
-
- std::vector<std::string> rccOptions;
- if (const char* opts = target->GetProperty("AUTORCC_OPTIONS"))
- {
- cmSystemTools::ExpandListArgument(opts, rccOptions);
- }
- std::string qtMajorVersion = makefile->GetSafeDefinition("QT_VERSION_MAJOR");
- if (qtMajorVersion == "")
- {
- qtMajorVersion = makefile->GetSafeDefinition("Qt5Core_VERSION_MAJOR");
- }
-
- for(std::vector<cmSourceFile*>::const_iterator fileIt = srcFiles.begin();
- fileIt != srcFiles.end();
- ++fileIt)
- {
- cmSourceFile* sf = *fileIt;
- std::string ext = sf->GetExtension();
- if (ext == "qrc")
- {
- std::string absFile = cmsys::SystemTools::GetRealPath(
- sf->GetFullPath());
- bool skip = cmSystemTools::IsOn(sf->GetPropertyForUser("SKIP_AUTORCC"));
-
- if (!skip)
- {
- _rcc_files += sepRccFiles;
- _rcc_files += absFile;
- sepRccFiles = ";";
-
- if (const char *prop = sf->GetProperty("AUTORCC_OPTIONS"))
- {
- std::vector<std::string> optsVec;
- cmSystemTools::ExpandListArgument(prop, optsVec);
- cmQtAutoGeneratorInitializer::MergeRccOptions(rccOptions, optsVec,
- strcmp(qtVersion, "5") == 0);
- }
-
- if (!rccOptions.empty())
- {
- rccFileFiles += optionSep;
- rccFileFiles += absFile;
- rccFileOptions += optionSep;
- }
- const char *listSep = "";
- for(std::vector<std::string>::const_iterator it = rccOptions.begin();
- it != rccOptions.end();
- ++it)
- {
- rccFileOptions += listSep;
- rccFileOptions += *it;
- listSep = "@list_sep@";
- }
- optionSep = ";";
-
- std::vector<std::string> depends;
-
- std::string entriesList;
- if (!cmSystemTools::IsOn(sf->GetPropertyForUser("GENERATED")))
- {
- if (qtMajorVersion == "5")
- {
- entriesList = cmQtAutoGeneratorInitializer::ListQt5RccInputs(sf,
- target,
- depends);
- }
- else
- {
- entriesList =
- cmQtAutoGeneratorInitializer::ListQt4RccInputs(sf, depends);
- }
- if (entriesList.empty())
- {
- return;
- }
- }
- qrcInputs += qrcInputsSep;
- qrcInputs += entriesList;
- qrcInputsSep = ";";
- }
- }
- }
- makefile->AddDefinition("_qt_rcc_inputs_" + target->GetName(),
- cmOutputConverter::EscapeForCMake(qrcInputs).c_str());
-
- makefile->AddDefinition("_rcc_files",
- cmOutputConverter::EscapeForCMake(_rcc_files).c_str());
-
- makefile->AddDefinition("_qt_rcc_options_files",
- cmOutputConverter::EscapeForCMake(rccFileFiles).c_str());
- makefile->AddDefinition("_qt_rcc_options_options",
- cmOutputConverter::EscapeForCMake(rccFileOptions).c_str());
-
- makefile->AddDefinition("_qt_rcc_executable",
- cmQtAutoGeneratorInitializer::GetRccExecutable(target).c_str());
-}
-
-std::string cmQtAutoGeneratorInitializer::GetRccExecutable(
- cmTarget const* target)
-{
- cmGeneratorTarget *gtgt = target->GetMakefile()
- ->GetGlobalGenerator()
- ->GetGeneratorTarget(target);
- cmMakefile *makefile = target->GetMakefile();
- const char *qtVersion = makefile->GetDefinition("_target_qt_version");
- if (!qtVersion)
- {
- qtVersion = makefile->GetDefinition("Qt5Core_VERSION_MAJOR");
- if (!qtVersion)
- {
- qtVersion = makefile->GetDefinition("QT_VERSION_MAJOR");
- }
- if (const char *targetQtVersion =
- gtgt->GetLinkInterfaceDependentStringProperty("QT_MAJOR_VERSION", ""))
- {
- qtVersion = targetQtVersion;
- }
- }
-
- std::string targetName = target->GetName();
- if (strcmp(qtVersion, "5") == 0)
- {
- cmTarget *qt5Rcc = makefile->FindTargetToUse("Qt5::rcc");
- if (!qt5Rcc)
- {
- cmSystemTools::Error("Qt5::rcc target not found ",
- targetName.c_str());
- return std::string();
- }
- return qt5Rcc->ImportedGetLocation("");
- }
- else if (strcmp(qtVersion, "4") == 0)
- {
- cmTarget *qt4Rcc = makefile->FindTargetToUse("Qt4::rcc");
- if (!qt4Rcc)
- {
- cmSystemTools::Error("Qt4::rcc target not found ",
- targetName.c_str());
- return std::string();
- }
- return qt4Rcc->ImportedGetLocation("");
- }
-
- cmSystemTools::Error("The CMAKE_AUTORCC feature supports only Qt 4 and "
- "Qt 5 ", targetName.c_str());
- return std::string();
-}
diff --git a/Source/cmQtAutoGeneratorInitializer.h b/Source/cmQtAutoGeneratorInitializer.h
index c22f172..eaf140d 100644
--- a/Source/cmQtAutoGeneratorInitializer.h
+++ b/Source/cmQtAutoGeneratorInitializer.h
@@ -21,47 +21,16 @@
#include <map>
class cmSourceFile;
-class cmTarget;
+class cmGeneratorTarget;
class cmLocalGenerator;
class cmQtAutoGeneratorInitializer
{
public:
- static void InitializeAutogenSources(cmTarget* target);
- static void InitializeAutogenTarget(cmLocalGenerator* lg, cmTarget* target);
- static void SetupAutoGenerateTarget(cmTarget const* target);
-
- static std::string GetAutogenTargetName(cmTarget const* target);
- static std::string GetAutogenTargetDir(cmTarget const* target);
-
-private:
- static void SetupSourceFiles(cmTarget const* target,
- std::vector<std::string>& skipMoc,
- std::vector<std::string>& mocSources,
- std::vector<std::string>& mocHeaders,
- std::vector<std::string>& skipUic);
-
- static void SetupAutoMocTarget(cmTarget const* target,
- const std::string &autogenTargetName,
- const std::vector<std::string>& skipMoc,
- const std::vector<std::string>& mocHeaders,
- std::map<std::string, std::string> &configIncludes,
- std::map<std::string, std::string> &configDefines);
- static void SetupAutoUicTarget(cmTarget const* target,
- const std::vector<std::string>& skipUic,
- std::map<std::string, std::string> &configUicOptions);
- static void SetupAutoRccTarget(cmTarget const* target);
-
- static void MergeRccOptions(std::vector<std::string> &opts,
- const std::vector<std::string> &fileOpts, bool isQt5);
-
- static std::string GetRccExecutable(cmTarget const* target);
-
- static std::string ListQt5RccInputs(cmSourceFile* sf, cmTarget const* target,
- std::vector<std::string>& depends);
-
- static std::string ListQt4RccInputs(cmSourceFile* sf,
- std::vector<std::string>& depends);
+ static void InitializeAutogenSources(cmGeneratorTarget* target);
+ static void InitializeAutogenTarget(cmLocalGenerator* lg,
+ cmGeneratorTarget* target);
+ static void SetupAutoGenerateTarget(cmGeneratorTarget const* target);
};
#endif
diff --git a/Source/cmSetTargetPropertiesCommand.cxx b/Source/cmSetTargetPropertiesCommand.cxx
index 06217bb..b1c13ac 100644
--- a/Source/cmSetTargetPropertiesCommand.cxx
+++ b/Source/cmSetTargetPropertiesCommand.cxx
@@ -10,7 +10,6 @@
See the License for more information.
============================================================================*/
#include "cmSetTargetPropertiesCommand.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
// cmSetTargetPropertiesCommand
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx
index 86f0a7a..37383be 100644
--- a/Source/cmSourceFile.cxx
+++ b/Source/cmSourceFile.cxx
@@ -12,7 +12,6 @@
#include "cmSourceFile.h"
#include "cmGlobalGenerator.h"
-#include "cmLocalGenerator.h"
#include "cmMakefile.h"
#include "cmSystemTools.h"
#include "cmake.h"
diff --git a/Source/cmSourceFileLocation.cxx b/Source/cmSourceFileLocation.cxx
index 4a87cc2..b8d5c02 100644
--- a/Source/cmSourceFileLocation.cxx
+++ b/Source/cmSourceFileLocation.cxx
@@ -12,7 +12,6 @@
#include "cmSourceFileLocation.h"
#include "cmMakefile.h"
-#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmSystemTools.h"
#include "cmAlgorithms.h"
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 386f6a5..2aa092a 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -378,20 +378,19 @@ void cmake::ReadListFile(const std::vector<std::string>& args,
this->SetHomeOutputDirectory(cmSystemTools::GetCurrentWorkingDirectory());
cmState::Snapshot snapshot = this->GetCurrentSnapshot();
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(gg, snapshot));
- cmsys::auto_ptr<cmLocalGenerator> lg(gg->CreateLocalGenerator(mf.get()));
- lg->GetMakefile()->SetCurrentBinaryDirectory
+ mf->SetCurrentBinaryDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
- lg->GetMakefile()->SetCurrentSourceDirectory
+ mf->SetCurrentSourceDirectory
(cmSystemTools::GetCurrentWorkingDirectory());
if (this->GetWorkingMode() != NORMAL_MODE)
{
std::string file(cmSystemTools::CollapseFullPath(path));
cmSystemTools::ConvertToUnixSlashes(file);
- lg->GetMakefile()->SetScriptModeFile(file.c_str());
+ mf->SetScriptModeFile(file.c_str());
- lg->GetMakefile()->SetArgcArgv(args);
+ mf->SetArgcArgv(args);
}
- if (!lg->GetMakefile()->ReadListFile(path))
+ if (!mf->ReadListFile(path))
{
cmSystemTools::Error("Error processing file: ", path);
}
@@ -1906,7 +1905,6 @@ int cmake::CheckBuildSystem()
cm.SetHomeOutputDirectory("");
cmGlobalGenerator gg(&cm);
cmsys::auto_ptr<cmMakefile> mf(new cmMakefile(&gg, cm.GetCurrentSnapshot()));
- cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator(mf.get()));
if(!mf->ReadListFile(this->CheckBuildSystemArgument.c_str()) ||
cmSystemTools::GetErrorOccuredFlag())
{