summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
Diffstat (limited to 'Source')
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.cxx141
-rw-r--r--Source/CPack/WiX/cmCPackWIXGenerator.h6
-rw-r--r--Source/CursesDialog/form/fty_ipv4.c2
-rw-r--r--Source/cmAddCompileOptionsCommand.h1
-rw-r--r--Source/cmAddTestCommand.h3
-rw-r--r--Source/cmComputeLinkInformation.cxx31
-rw-r--r--Source/cmComputeTargetDepends.cxx2
-rw-r--r--Source/cmCoreTryCompile.cxx62
-rw-r--r--Source/cmCustomCommand.cxx28
-rw-r--r--Source/cmCustomCommand.h1
-rw-r--r--Source/cmDocumentGeneratorExpressions.h8
-rw-r--r--Source/cmDocumentVariables.cxx42
-rw-r--r--Source/cmExportBuildFileGenerator.cxx9
-rw-r--r--Source/cmExportCommand.cxx2
-rw-r--r--Source/cmExportCommand.h7
-rw-r--r--Source/cmExportFileGenerator.cxx79
-rw-r--r--Source/cmExportFileGenerator.h15
-rw-r--r--Source/cmExportInstallFileGenerator.cxx31
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx18
-rw-r--r--Source/cmExtraSublimeTextGenerator.cxx2
-rw-r--r--Source/cmFindCommon.cxx24
-rw-r--r--Source/cmGeneratorExpression.cxx36
-rw-r--r--Source/cmGeneratorExpression.h3
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.cxx19
-rw-r--r--Source/cmGeneratorExpressionDAGChecker.h5
-rw-r--r--Source/cmGeneratorExpressionEvaluator.cxx165
-rw-r--r--Source/cmGlobalGenerator.cxx35
-rw-r--r--Source/cmGlobalNinjaGenerator.cxx48
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx5
-rw-r--r--Source/cmIDEOptions.cxx5
-rw-r--r--Source/cmIDEOptions.h1
-rw-r--r--Source/cmIncludeCommand.h9
-rw-r--r--Source/cmInstallCommand.cxx57
-rw-r--r--Source/cmInstallCommand.h10
-rw-r--r--Source/cmInstallCommandArguments.cxx34
-rw-r--r--Source/cmInstallCommandArguments.h13
-rw-r--r--Source/cmInstallExportGenerator.cxx3
-rw-r--r--Source/cmInstallExportGenerator.h3
-rw-r--r--Source/cmLocalGenerator.cxx33
-rw-r--r--Source/cmLocalGenerator.h7
-rw-r--r--Source/cmLocalNinjaGenerator.cxx1
-rw-r--r--Source/cmLocalUnixMakefileGenerator3.cxx5
-rw-r--r--Source/cmLocalVisualStudio6Generator.cxx20
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx4
-rw-r--r--Source/cmMakefile.cxx44
-rw-r--r--Source/cmMakefile.h5
-rw-r--r--Source/cmMakefileExecutableTargetGenerator.cxx16
-rw-r--r--Source/cmMakefileLibraryTargetGenerator.cxx20
-rw-r--r--Source/cmMakefileTargetGenerator.cxx22
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx28
-rw-r--r--Source/cmNinjaTargetGenerator.cxx23
-rw-r--r--Source/cmOrderDirectories.cxx22
-rw-r--r--Source/cmPolicies.cxx57
-rw-r--r--Source/cmPolicies.h2
-rw-r--r--Source/cmProjectCommand.h8
-rw-r--r--Source/cmQtAutomoc.cxx10
-rw-r--r--Source/cmSetPropertyCommand.cxx6
-rw-r--r--Source/cmSystemTools.cxx10
-rw-r--r--Source/cmTarget.cxx593
-rw-r--r--Source/cmTarget.h60
-rw-r--r--Source/cmTargetCompileDefinitionsCommand.h1
-rw-r--r--Source/cmTargetExport.h3
-rw-r--r--Source/cmTargetIncludeDirectoriesCommand.h1
-rw-r--r--Source/cmTargetLinkLibrariesCommand.cxx161
-rw-r--r--Source/cmTargetLinkLibrariesCommand.h54
-rw-r--r--Source/cmTryCompileCommand.h4
-rw-r--r--Source/cmVS10LinkFlagTable.h2
-rw-r--r--Source/cmVS11LinkFlagTable.h2
-rw-r--r--Source/cmVS12LinkFlagTable.h2
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx5
-rw-r--r--Source/cm_sha2.c12
-rw-r--r--Source/cmake.cxx8
-rw-r--r--Source/kwsys/SystemTools.cxx12
74 files changed, 1648 insertions, 582 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index 2c2f791..b3e2854 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -2,5 +2,5 @@
set(CMake_VERSION_MAJOR 2)
set(CMake_VERSION_MINOR 8)
set(CMake_VERSION_PATCH 11)
-set(CMake_VERSION_TWEAK 20130702)
+set(CMake_VERSION_TWEAK 20130726)
#set(CMake_VERSION_RC 1)
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
index e8b0ea9..cc9dec7 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx
@@ -100,6 +100,11 @@ bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles)
command << " -nologo";
command << " -out " << QuotePath(packageFileNames.at(0));
command << " -ext WixUIExtension";
+ const char* const cultures = GetOption("CPACK_WIX_CULTURES");
+ if(cultures)
+ {
+ command << " -cultures:" << cultures;
+ }
command << " " << objectFiles;
return RunWiXCommand(command.str());
@@ -224,6 +229,9 @@ bool cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_ICON");
CopyDefinition(includeFile, "CPACK_WIX_UI_BANNER");
CopyDefinition(includeFile, "CPACK_WIX_UI_DIALOG");
+ SetOptionIfNotSet("CPACK_WIX_PROGRAM_MENU_FOLDER",
+ GetOption("CPACK_PACKAGE_NAME"));
+ CopyDefinition(includeFile, "CPACK_WIX_PROGRAM_MENU_FOLDER");
return true;
}
@@ -339,25 +347,114 @@ bool cmCPackWIXGenerator::CreateWiXSourceFiles()
featureDefinitions.BeginElement("FeatureRef");
featureDefinitions.AddAttribute("Id", "ProductFeature");
+ const char *cpackPackageExecutables = GetOption("CPACK_PACKAGE_EXECUTABLES");
+ std::vector<std::string> cpackPkgExecutables;
+ std::string regKey;
+ if ( cpackPackageExecutables )
+ {
+ cmSystemTools::ExpandListArgument(cpackPackageExecutables,
+ cpackPkgExecutables);
+ if ( cpackPkgExecutables.size() % 2 != 0 )
+ {
+ cmCPackLogger(cmCPackLog::LOG_ERROR,
+ "CPACK_PACKAGE_EXECUTABLES should contain pairs of <executable> and "
+ "<icon name>." << std::endl);
+ cpackPkgExecutables.clear();
+ }
+
+ const char *cpackVendor = GetOption("CPACK_PACKAGE_VENDOR");
+ const char *cpackPkgName = GetOption("CPACK_PACKAGE_NAME");
+ if (!cpackVendor || !cpackPkgName)
+ {
+ cmCPackLogger(cmCPackLog::LOG_WARNING, "CPACK_PACKAGE_VENDOR and "
+ "CPACK_PACKAGE_NAME must be defined for shortcut creation" << std::endl);
+ cpackPkgExecutables.clear();
+ }
+ else
+ {
+ regKey = std::string("Software/") + cpackVendor + "/" + cpackPkgName;
+ }
+ }
+
+ std::vector<std::string> dirIdExecutables;
AddDirectoryAndFileDefinitons(
toplevel, "INSTALL_ROOT",
directoryDefinitions, fileDefinitions, featureDefinitions,
- directoryCounter, fileCounter);
+ directoryCounter, fileCounter, cpackPkgExecutables, dirIdExecutables);
- featureDefinitions.EndElement();
- featureDefinitions.EndElement();
- fileDefinitions.EndElement();
+ directoryDefinitions.EndElement();
+ directoryDefinitions.EndElement();
- for(size_t i = 1; i < install_root.size(); ++i)
+ if (dirIdExecutables.size() > 0 && dirIdExecutables.size() % 3 == 0)
{
- directoryDefinitions.EndElement();
- }
+ fileDefinitions.BeginElement("DirectoryRef");
+ fileDefinitions.AddAttribute("Id", "PROGRAM_MENU_FOLDER");
+ fileDefinitions.BeginElement("Component");
+ fileDefinitions.AddAttribute("Id", "SHORTCUT");
+ fileDefinitions.AddAttribute("Guid", "*");
- directoryDefinitions.EndElement();
- directoryDefinitions.EndElement();
+ std::vector<std::string>::iterator it;
+ for ( it = dirIdExecutables.begin() ;
+ it != dirIdExecutables.end();
+ ++it)
+ {
+ std::string fileName = *it++;
+ std::string iconName = *it++;
+ std::string directoryId = *it;
+
+ fileDefinitions.BeginElement("Shortcut");
+ std::string shortcutName = fileName; // the iconName is mor likely to contain blanks early on
+ std::string::size_type const dotPos = shortcutName.find('.');
+ if(std::string::npos == dotPos)
+ { shortcutName = shortcutName.substr(0, dotPos); }
+ fileDefinitions.AddAttribute("Id", "SHORTCUT_" + shortcutName);
+ fileDefinitions.AddAttribute("Name", iconName);
+ std::string target = "[" + directoryId + "]" + fileName;
+ fileDefinitions.AddAttribute("Target", target);
+ fileDefinitions.AddAttribute("WorkingDirectory", directoryId);
+ fileDefinitions.EndElement();
+ }
+ fileDefinitions.BeginElement("Shortcut");
+ fileDefinitions.AddAttribute("Id", "UNINSTALL");
+ std::string pkgName = GetOption("CPACK_PACKAGE_NAME");
+ fileDefinitions.AddAttribute("Name", "Uninstall " + pkgName);
+ fileDefinitions.AddAttribute("Description", "Uninstalls " + pkgName);
+ fileDefinitions.AddAttribute("Target", "[SystemFolder]msiexec.exe");
+ fileDefinitions.AddAttribute("Arguments", "/x [ProductCode]");
+ fileDefinitions.EndElement();
+ fileDefinitions.BeginElement("RemoveFolder");
+ fileDefinitions.AddAttribute("Id", "PROGRAM_MENU_FOLDER");
+ fileDefinitions.AddAttribute("On", "uninstall");
+ fileDefinitions.EndElement();
+ fileDefinitions.BeginElement("RegistryValue");
+ fileDefinitions.AddAttribute("Root", "HKCU");
+ fileDefinitions.AddAttribute("Key", regKey);
+ fileDefinitions.AddAttribute("Name", "installed");
+ fileDefinitions.AddAttribute("Type", "integer");
+ fileDefinitions.AddAttribute("Value", "1");
+ fileDefinitions.AddAttribute("KeyPath", "yes");
+
+ featureDefinitions.BeginElement("ComponentRef");
+ featureDefinitions.AddAttribute("Id", "SHORTCUT");
+ featureDefinitions.EndElement();
+ directoryDefinitions.BeginElement("Directory");
+ directoryDefinitions.AddAttribute("Id", "ProgramMenuFolder");
+ directoryDefinitions.BeginElement("Directory");
+ directoryDefinitions.AddAttribute("Id", "PROGRAM_MENU_FOLDER");
+ const char *startMenuFolder = GetOption("CPACK_WIX_PROGRAM_MENU_FOLDER");
+ directoryDefinitions.AddAttribute("Name", startMenuFolder);
+ }
+
+ featureDefinitions.EndElement();
+ featureDefinitions.EndElement();
+ fileDefinitions.EndElement();
directoryDefinitions.EndElement();
std::string wixTemplate = FindTemplate("WIX.template.in");
+ if(GetOption("CPACK_WIX_TEMPLATE") != 0)
+ {
+ wixTemplate = GetOption("CPACK_WIX_TEMPLATE");
+ }
if(wixTemplate.empty())
{
cmCPackLogger(cmCPackLog::LOG_ERROR,
@@ -435,7 +532,9 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
cmWIXSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions,
size_t& directoryCounter,
- size_t& fileCounter)
+ size_t& fileCounter,
+ const std::vector<std::string>& pkgExecutables,
+ std::vector<std::string>& dirIdExecutables)
{
cmsys::Directory dir;
dir.Load(topdir.c_str());
@@ -467,8 +566,9 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
fileDefinitions,
featureDefinitions,
directoryCounter,
- fileCounter);
-
+ fileCounter,
+ pkgExecutables,
+ dirIdExecutables);
directoryDefinitions.EndElement();
}
else
@@ -499,6 +599,23 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
featureDefinitions.BeginElement("ComponentRef");
featureDefinitions.AddAttribute("Id", componentId);
featureDefinitions.EndElement();
+
+ std::vector<std::string>::const_iterator it;
+ for (it = pkgExecutables.begin() ;
+ it != pkgExecutables.end() ;
+ ++it)
+ {
+ std::string execName = *it++;
+ std::string iconName = *it;
+
+ if (cmSystemTools::LowerCase(fileName) ==
+ cmSystemTools::LowerCase(execName) + ".exe")
+ {
+ dirIdExecutables.push_back(fileName);
+ dirIdExecutables.push_back(iconName);
+ dirIdExecutables.push_back(directoryId);
+ }
+ }
}
}
}
diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.h b/Source/CPack/WiX/cmCPackWIXGenerator.h
index 0e95d70..aaccf9d 100644
--- a/Source/CPack/WiX/cmCPackWIXGenerator.h
+++ b/Source/CPack/WiX/cmCPackWIXGenerator.h
@@ -83,7 +83,11 @@ private:
cmWIXSourceWriter& fileDefinitions,
cmWIXSourceWriter& featureDefinitions,
size_t& directoryCounter,
- size_t& fileCounter);
+ size_t& fileCounter,
+ const std::vector<std::string>& pkgExecutables,
+ std::vector<std::string>& dirIdExecutables
+ );
+
bool RequireOption(const std::string& name, std::string& value) const;
diff --git a/Source/CursesDialog/form/fty_ipv4.c b/Source/CursesDialog/form/fty_ipv4.c
index 4ac8a50..c855af6 100644
--- a/Source/CursesDialog/form/fty_ipv4.c
+++ b/Source/CursesDialog/form/fty_ipv4.c
@@ -30,7 +30,7 @@ static bool Check_IPV4_Field(FIELD * field, const void * argp)
{
char *bp = field_buffer(field,0);
int num = 0, len;
- unsigned int d1, d2, d3, d4;
+ unsigned int d1=256, d2=256, d3=256, d4=256;
argp=0; /* Silence unused parameter warning. */
diff --git a/Source/cmAddCompileOptionsCommand.h b/Source/cmAddCompileOptionsCommand.h
index 4504795..e9bbf28 100644
--- a/Source/cmAddCompileOptionsCommand.h
+++ b/Source/cmAddCompileOptionsCommand.h
@@ -62,7 +62,6 @@ public:
"Arguments to add_compile_options may use \"generator "
"expressions\" with the syntax \"$<...>\". "
CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS
;
}
diff --git a/Source/cmAddTestCommand.h b/Source/cmAddTestCommand.h
index 6a0cd9d..ec7fda3 100644
--- a/Source/cmAddTestCommand.h
+++ b/Source/cmAddTestCommand.h
@@ -71,6 +71,9 @@ public:
" add_test(NAME <name> [CONFIGURATIONS [Debug|Release|...]]\n"
" [WORKING_DIRECTORY dir]\n"
" COMMAND <command> [arg1 [arg2 ...]])\n"
+ "Add a test called <name>. "
+ "The test name may not contain spaces, quotes, or other characters "
+ "special in CMake syntax. "
"If COMMAND specifies an executable target (created by "
"add_executable) it will automatically be replaced by the location "
"of the executable created at build time. "
diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx
index 0ba0139..fb7b5b6 100644
--- a/Source/cmComputeLinkInformation.cxx
+++ b/Source/cmComputeLinkInformation.cxx
@@ -1345,12 +1345,23 @@ void cmComputeLinkInformation::AddFrameworkItem(std::string const& item)
return;
}
+ std::string fw_path = this->SplitFramework.match(1);
+ std::string fw = this->SplitFramework.match(2);
+ std::string full_fw = fw_path;
+ full_fw += "/";
+ full_fw += fw;
+ full_fw += ".framework";
+ full_fw += "/";
+ full_fw += fw;
+
// Add the directory portion to the framework search path.
- this->AddFrameworkPath(this->SplitFramework.match(1));
+ this->AddFrameworkPath(fw_path);
+
+ // add runtime information
+ this->AddLibraryRuntimeInfo(full_fw);
// Add the item using the -framework option.
this->Items.push_back(Item("-framework", false));
- std::string fw = this->SplitFramework.match(2);
fw = this->LocalGenerator->EscapeForShell(fw.c_str());
this->Items.push_back(Item(fw, false));
}
@@ -1813,9 +1824,10 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath)
if(fullPath.find(".framework") != std::string::npos)
{
cmsys::RegularExpression splitFramework;
- splitFramework.compile("^(.*)/(.*).framework/.*/(.*)$");
+ splitFramework.compile("^(.*)/(.*).framework/(.*)$");
if(splitFramework.find(fullPath) &&
- (splitFramework.match(2) == splitFramework.match(3)))
+ (std::string::npos !=
+ splitFramework.match(3).find(splitFramework.match(2))))
{
is_shared_library = true;
}
@@ -1884,8 +1896,6 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
}
if(use_build_rpath || use_link_rpath)
{
- std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
- cmSystemTools::ConvertToUnixSlashes(rootPath);
std::vector<std::string> const& rdirs = this->GetRuntimeSearchPath();
for(std::vector<std::string>::const_iterator ri = rdirs.begin();
ri != rdirs.end(); ++ri)
@@ -1909,14 +1919,9 @@ void cmComputeLinkInformation::GetRPath(std::vector<std::string>& runtimeDirs,
!cmSystemTools::IsSubDirectory(ri->c_str(), topSourceDir) &&
!cmSystemTools::IsSubDirectory(ri->c_str(), topBinaryDir))
{
- std::string d = *ri;
- if (d.find(rootPath) == 0)
- {
- d = d.substr(rootPath.size());
- }
- if(emitted.insert(d).second)
+ if(emitted.insert(*ri).second)
{
- runtimeDirs.push_back(d);
+ runtimeDirs.push_back(*ri);
}
}
}
diff --git a/Source/cmComputeTargetDepends.cxx b/Source/cmComputeTargetDepends.cxx
index 8fd95b9..0829add 100644
--- a/Source/cmComputeTargetDepends.cxx
+++ b/Source/cmComputeTargetDepends.cxx
@@ -282,6 +282,8 @@ void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
if(emitted.insert(*lib).second)
{
this->AddTargetDepend(depender_index, lib->c_str(), true);
+ this->AddInterfaceDepends(depender_index, lib->c_str(),
+ true, emitted);
}
}
}
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 860417f..086f27a 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -12,6 +12,7 @@
#include "cmCoreTryCompile.h"
#include "cmake.h"
#include "cmCacheManager.h"
+#include "cmLocalGenerator.h"
#include "cmGlobalGenerator.h"
#include "cmExportTryCompileFileGenerator.h"
#include <cmsys/Directory.hxx>
@@ -32,18 +33,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
std::vector<std::string> compileDefs;
std::string outputVariable;
std::string copyFile;
+ std::string copyFileError;
std::vector<cmTarget*> targets;
std::string libsToLink = " ";
bool useOldLinkLibs = true;
char targetNameBuf[64];
bool didOutputVariable = false;
bool didCopyFile = false;
+ bool didCopyFileError = false;
bool useSources = argv[2] == "SOURCES";
std::vector<std::string> sources;
enum Doing { DoingNone, DoingCMakeFlags, DoingCompileDefinitions,
DoingLinkLibraries, DoingOutputVariable, DoingCopyFile,
- DoingSources };
+ DoingCopyFileError, DoingSources };
Doing doing = useSources? DoingSources : DoingNone;
for(size_t i=3; i < argv.size(); ++i)
{
@@ -74,6 +77,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
doing = DoingCopyFile;
didCopyFile = true;
}
+ else if(argv[i] == "COPY_FILE_ERROR")
+ {
+ doing = DoingCopyFileError;
+ didCopyFileError = true;
+ }
else if(doing == DoingCMakeFlags)
{
cmakeFlags.push_back(argv[i]);
@@ -121,6 +129,11 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
copyFile = argv[i].c_str();
doing = DoingNone;
}
+ else if(doing == DoingCopyFileError)
+ {
+ copyFileError = argv[i].c_str();
+ doing = DoingNone;
+ }
else if(doing == DoingSources)
{
sources.push_back(argv[i]);
@@ -149,6 +162,20 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
return -1;
}
+ if(didCopyFileError && copyFileError.empty())
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "COPY_FILE_ERROR must be followed by a variable name");
+ return -1;
+ }
+
+ if(didCopyFileError && !didCopyFile)
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR,
+ "COPY_FILE_ERROR may be used only with COPY_FILE");
+ return -1;
+ }
+
if(didOutputVariable && outputVariable.empty())
{
this->Makefile->IssueMessage(cmake::FATAL_ERROR,
@@ -214,8 +241,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
}
// Detect languages to enable.
- cmGlobalGenerator* gg =
- this->Makefile->GetCMakeInstance()->GetGlobalGenerator();
+ cmLocalGenerator* lg = this->Makefile->GetLocalGenerator();
+ cmGlobalGenerator* gg = lg->GetGlobalGenerator();
std::set<std::string> testLangs;
for(std::vector<std::string>::iterator si = sources.begin();
si != sources.end(); ++si)
@@ -295,13 +322,12 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
for(std::set<std::string>::iterator li = testLangs.begin();
li != testLangs.end(); ++li)
{
- fprintf(fout, "SET(CMAKE_%s_FLAGS \"", li->c_str());
std::string langFlags = "CMAKE_" + *li + "_FLAGS";
- if(const char* flags = this->Makefile->GetDefinition(langFlags.c_str()))
- {
- fprintf(fout, " %s ", flags);
- }
- fprintf(fout, " ${COMPILE_DEFINITIONS}\")\n");
+ const char* flags = this->Makefile->GetDefinition(langFlags.c_str());
+ fprintf(fout, "SET(CMAKE_%s_FLAGS %s)\n", li->c_str(),
+ lg->EscapeForCMake(flags?flags:"").c_str());
+ fprintf(fout, "SET(CMAKE_%s_FLAGS \"${CMAKE_%s_FLAGS}"
+ " ${COMPILE_DEFINITIONS}\")\n", li->c_str(), li->c_str());
}
fprintf(fout, "INCLUDE_DIRECTORIES(${INCLUDE_DIRECTORIES})\n");
fprintf(fout, "SET(CMAKE_SUPPRESS_REGENERATION 1)\n");
@@ -444,6 +470,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if (this->SrcFileSignature)
{
+ std::string copyFileErrorMessage;
this->FindOutputFile(targetName);
if ((res==0) && (copyFile.size()))
@@ -461,10 +488,23 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
{
emsg << this->FindErrorMessage.c_str();
}
- this->Makefile->IssueMessage(cmake::FATAL_ERROR, emsg.str());
- return -1;
+ if(copyFileError.empty())
+ {
+ this->Makefile->IssueMessage(cmake::FATAL_ERROR, emsg.str());
+ return -1;
+ }
+ else
+ {
+ copyFileErrorMessage = emsg.str();
+ }
}
}
+
+ if(!copyFileError.empty())
+ {
+ this->Makefile->AddDefinition(copyFileError.c_str(),
+ copyFileErrorMessage.c_str());
+ }
}
return res;
}
diff --git a/Source/cmCustomCommand.cxx b/Source/cmCustomCommand.cxx
index bd860ee..3620a38 100644
--- a/Source/cmCustomCommand.cxx
+++ b/Source/cmCustomCommand.cxx
@@ -13,6 +13,8 @@
#include "cmMakefile.h"
+#include <cmsys/auto_ptr.hxx>
+
//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand()
{
@@ -36,6 +38,32 @@ cmCustomCommand::cmCustomCommand(const cmCustomCommand& r):
}
//----------------------------------------------------------------------------
+cmCustomCommand& cmCustomCommand::operator=(cmCustomCommand const& r)
+{
+ if(this == &r)
+ {
+ return *this;
+ }
+
+ this->Outputs = r.Outputs;
+ this->Depends = r.Depends;
+ this->CommandLines = r.CommandLines;
+ this->HaveComment = r.HaveComment;
+ this->Comment = r.Comment;
+ this->WorkingDirectory = r.WorkingDirectory;
+ this->EscapeAllowMakeVars = r.EscapeAllowMakeVars;
+ this->EscapeOldStyle = r.EscapeOldStyle;
+ this->ImplicitDepends = r.ImplicitDepends;
+
+ cmsys::auto_ptr<cmListFileBacktrace>
+ newBacktrace(new cmListFileBacktrace(*r.Backtrace));
+ delete this->Backtrace;
+ this->Backtrace = newBacktrace.release();
+
+ return *this;
+}
+
+//----------------------------------------------------------------------------
cmCustomCommand::cmCustomCommand(cmMakefile* mf,
const std::vector<std::string>& outputs,
const std::vector<std::string>& depends,
diff --git a/Source/cmCustomCommand.h b/Source/cmCustomCommand.h
index dd92e34..e20d2bf 100644
--- a/Source/cmCustomCommand.h
+++ b/Source/cmCustomCommand.h
@@ -27,6 +27,7 @@ public:
/** Default and copy constructors for STL containers. */
cmCustomCommand();
cmCustomCommand(const cmCustomCommand& r);
+ cmCustomCommand& operator=(cmCustomCommand const& r);
/** Main constructor specifies all information for the command. */
cmCustomCommand(cmMakefile* mf,
diff --git a/Source/cmDocumentGeneratorExpressions.h b/Source/cmDocumentGeneratorExpressions.h
index 841061c..46cd77e 100644
--- a/Source/cmDocumentGeneratorExpressions.h
+++ b/Source/cmDocumentGeneratorExpressions.h
@@ -95,12 +95,4 @@
"the target on which the generator expression is evaluated.\n" \
""
-#define CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS \
- "Language related expressions:\n" \
- " $<LINK_LANGUAGE> = The link language of the target " \
- "being generated.\n" \
- " $<LINK_LANGUAGE:lang> = '1' if the link language of the " \
- "target being generated matches lang, else '0'.\n" \
- ""
-
#endif
diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx
index 0a78ccf..cfd5e76 100644
--- a/Source/cmDocumentVariables.cxx
+++ b/Source/cmDocumentVariables.cxx
@@ -514,6 +514,13 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"analysis of libraries linked by a target.",
false,
"Variables that Provide Information");
+ cm->DefineProperty
+ ("CMAKE_MINIMUM_REQUIRED_VERSION", cmProperty::VARIABLE,
+ "Version specified to cmake_minimum_required command",
+ "Variable containing the VERSION component specified in the "
+ "cmake_minimum_required command.",
+ false,
+ "Variables that Provide Information");
// Variables defined by cmake, that change the behavior
@@ -561,16 +568,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables That Change Behavior");
cm->DefineProperty
- ("CMAKE_SYSROOT", cmProperty::VARIABLE,
- "Path to pass to the compiler in the --sysroot flag.",
- "The CMAKE_SYSROOT content is passed to the compiler in the --sysroot "
- "flag, if supported. The path is also stripped from the RPATH if "
- "necessary on installation. The CMAKE_SYSROOT is also used to prefix "
- "paths searched by the find_* commands.",
- false,
- "Variables That Change Behavior");
-
- cm->DefineProperty
("CMAKE_FIND_LIBRARY_PREFIXES", cmProperty::VARIABLE,
"Prefixes to prepend when looking for libraries.",
"This specifies what prefixes to add to library names when "
@@ -688,6 +685,23 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables That Change Behavior");
cm->DefineProperty
+ ("CMAKE_WARN_DEPRECATED", cmProperty::VARIABLE,
+ "Whether to issue deprecation warnings for macros and functions.",
+ "If TRUE, this can be used by macros and functions to issue "
+ "deprecation warnings. This variable is FALSE by default.",
+ false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
+ ("CMAKE_ERROR_DEPRECATED", cmProperty::VARIABLE,
+ "Whether to issue deprecation errors for macros and functions.",
+ "If TRUE, this can be used by macros and functions to issue "
+ "fatal errors when deprecated macros or functions are used. This "
+ "variable is FALSE by default.",
+ false,
+ "Variables That Change Behavior");
+
+ cm->DefineProperty
("CMAKE_PREFIX_PATH", cmProperty::VARIABLE,
"Path used for searching by FIND_XXX(), with appropriate suffixes added.",
"Specifies a path which will be used by the FIND_XXX() commands. It "
@@ -1608,6 +1622,12 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
"Variables for Languages");
cm->DefineProperty
+ ("CMAKE_<LANG>_FLAGS", cmProperty::VARIABLE,
+ "Flags for all build types.",
+ "<LANG> flags used regardless of the value of CMAKE_BUILD_TYPE.",false,
+ "Variables for Languages");
+
+ cm->DefineProperty
("CMAKE_<LANG>_FLAGS_DEBUG", cmProperty::VARIABLE,
"Flags for Debug build type or configuration.",
"<LANG> flags used when CMAKE_BUILD_TYPE is Debug.",false,
@@ -1848,8 +1868,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_CREATE_PREPROCESSED_SOURCE",
cmProperty::VARIABLE,0,0);
- cm->DefineProperty("CMAKE_<LANG>_FLAGS",
- cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_FLAGS_DEBUG_INIT",
cmProperty::VARIABLE,0,0);
cm->DefineProperty("CMAKE_<LANG>_FLAGS_INIT",
diff --git a/Source/cmExportBuildFileGenerator.cxx b/Source/cmExportBuildFileGenerator.cxx
index 326663c..cdc3316 100644
--- a/Source/cmExportBuildFileGenerator.cxx
+++ b/Source/cmExportBuildFileGenerator.cxx
@@ -77,6 +77,15 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
+ const bool newCMP0022Behavior =
+ te->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && te->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+ if (newCMP0022Behavior)
+ {
+ this->PopulateInterfaceLinkLibrariesProperty(te,
+ cmGeneratorExpression::BuildInterface,
+ properties, missingTargets);
+ }
this->PopulateCompatibleInterfaceProperties(te, properties);
this->GenerateInterfaceProperties(te, os, properties);
diff --git a/Source/cmExportCommand.cxx b/Source/cmExportCommand.cxx
index ffa8b51..9c3f314 100644
--- a/Source/cmExportCommand.cxx
+++ b/Source/cmExportCommand.cxx
@@ -30,6 +30,7 @@ cmExportCommand::cmExportCommand()
,Append(&Helper, "APPEND", &ArgumentGroup)
,Namespace(&Helper, "NAMESPACE", &ArgumentGroup)
,Filename(&Helper, "FILE", &ArgumentGroup)
+,ExportOld(&Helper, "EXPORT_LINK_INTERFACE_LIBRARIES", &ArgumentGroup)
{
// at first TARGETS
this->Targets.Follows(0);
@@ -158,6 +159,7 @@ bool cmExportCommand
ebfg.SetAppendMode(this->Append.IsEnabled());
ebfg.SetExports(&targets);
ebfg.SetCommand(this);
+ ebfg.SetExportOld(this->ExportOld.IsEnabled());
// Compute the set of configurations exported.
std::vector<std::string> configurationTypes;
diff --git a/Source/cmExportCommand.h b/Source/cmExportCommand.h
index ae67b47..87c3452 100644
--- a/Source/cmExportCommand.h
+++ b/Source/cmExportCommand.h
@@ -63,7 +63,7 @@ public:
{
return
" export(TARGETS [target1 [target2 [...]]] [NAMESPACE <namespace>]\n"
- " [APPEND] FILE <filename>)\n"
+ " [APPEND] FILE <filename> [EXPORT_LINK_INTERFACE_LIBRARIES])\n"
"Create a file <filename> that may be included by outside projects to "
"import targets from the current project's build tree. "
"This is useful during cross-compiling to build utility executables "
@@ -73,6 +73,10 @@ public:
"prepended to all target names written to the file. "
"If the APPEND option is given the generated code will be appended "
"to the file instead of overwriting it. "
+ "The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the "
+ "contents of the properties matching "
+ "(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? to be exported, when "
+ "policy CMP0022 is NEW. "
"If a library target is included in the export but "
"a target to which it links is not included the behavior is "
"unspecified."
@@ -104,6 +108,7 @@ private:
cmCAEnabler Append;
cmCAString Namespace;
cmCAString Filename;
+ cmCAEnabler ExportOld;
friend class cmExportBuildFileGenerator;
std::string ErrorMessage;
diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx
index 6bef017..36802b5 100644
--- a/Source/cmExportFileGenerator.cxx
+++ b/Source/cmExportFileGenerator.cxx
@@ -30,6 +30,7 @@
cmExportFileGenerator::cmExportFileGenerator()
{
this->AppendMode = false;
+ this->ExportOld = false;
}
//----------------------------------------------------------------------------
@@ -168,6 +169,39 @@ void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
}
}
+void cmExportFileGenerator::GenerateRequiredCMakeVersion(std::ostream& os,
+ const char *versionString)
+{
+ os << "if(CMAKE_VERSION VERSION_LESS " << versionString << ")\n"
+ " message(FATAL_ERROR \"This file relies on consumers using "
+ "CMake " << versionString << " or greater.\")\n"
+ "endif()\n\n";
+}
+
+//----------------------------------------------------------------------------
+bool cmExportFileGenerator::PopulateInterfaceLinkLibrariesProperty(
+ cmTarget *target,
+ cmGeneratorExpression::PreprocessContext preprocessRule,
+ ImportPropertyMap &properties,
+ std::vector<std::string> &missingTargets)
+{
+ const char *input = target->GetProperty("INTERFACE_LINK_LIBRARIES");
+ if (input)
+ {
+ std::string prepro = cmGeneratorExpression::Preprocess(input,
+ preprocessRule);
+ if (!prepro.empty())
+ {
+ this->ResolveTargetsInGeneratorExpressions(prepro, target,
+ missingTargets,
+ ReplaceFreeTargets);
+ properties["INTERFACE_LINK_LIBRARIES"] = prepro;
+ return true;
+ }
+ }
+ return false;
+}
+
//----------------------------------------------------------------------------
static bool isSubDirectory(const char* a, const char* b)
{
@@ -243,28 +277,33 @@ static bool checkInterfaceDirs(const std::string &prepro,
//----------------------------------------------------------------------------
void cmExportFileGenerator::PopulateIncludeDirectoriesInterface(
- cmTarget *target,
+ cmTargetExport *tei,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets)
{
+ cmTarget *target = tei->Target;
assert(preprocessRule == cmGeneratorExpression::InstallInterface);
const char *propName = "INTERFACE_INCLUDE_DIRECTORIES";
const char *input = target->GetProperty(propName);
- if (!input)
+ if (!input && tei->InterfaceIncludeDirectories.empty())
{
return;
}
- if (!*input)
+ if (!*input && tei->InterfaceIncludeDirectories.empty())
{
// Set to empty
properties[propName] = "";
return;
}
- std::string prepro = cmGeneratorExpression::Preprocess(input,
- preprocessRule);
+ std::string includes = (input?input:"");
+ const char* sep = input ? ";" : "";
+ includes += sep + tei->InterfaceIncludeDirectories;
+ std::string prepro = cmGeneratorExpression::Preprocess(includes,
+ preprocessRule,
+ true);
if (!prepro.empty())
{
this->ResolveTargetsInGeneratorExpressions(prepro, target,
@@ -315,6 +354,16 @@ void getCompatibleInterfaceProperties(cmTarget *target,
{
cmComputeLinkInformation *info = target->GetLinkInformation(config);
+ if (!info)
+ {
+ cmMakefile* mf = target->GetMakefile();
+ cmOStringStream e;
+ e << "Exporting the target \"" << target->GetName() << "\" is not "
+ "allowed since its linker language cannot be determined";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+
const cmComputeLinkInformation::ItemVector &deps = info->GetItems();
for(cmComputeLinkInformation::ItemVector::const_iterator li =
@@ -583,6 +632,22 @@ cmExportFileGenerator
return;
}
+ const bool newCMP0022Behavior =
+ target->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+
+ if(newCMP0022Behavior && !this->ExportOld)
+ {
+ cmMakefile *mf = target->GetMakefile();
+ cmOStringStream e;
+ e << "Target \"" << target->GetName() << "\" has policy CMP0022 enabled, "
+ "but also has old-style INTERFACE_LINK_LIBRARIES properties "
+ "populated, but it was exported without the "
+ "EXPORT_LINK_INTERFACE_LIBRARIES to export the old-style properties";
+ mf->IssueMessage(cmake::FATAL_ERROR, e.str());
+ return;
+ }
+
if (!*propContent)
{
properties["IMPORTED_LINK_INTERFACE_LIBRARIES" + suffix] = "";
@@ -742,7 +807,9 @@ void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os)
void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
const std::string &expectedTargets)
{
- os << "set(_targetsDefined)\n"
+ os << "# Protect against multiple inclusion, which would fail when already "
+ "imported targets are added once more.\n"
+ "set(_targetsDefined)\n"
"set(_targetsNotDefined)\n"
"set(_expectedTargets)\n"
"foreach(_expectedTarget " << expectedTargets << ")\n"
diff --git a/Source/cmExportFileGenerator.h b/Source/cmExportFileGenerator.h
index ed2d93b..9628b96 100644
--- a/Source/cmExportFileGenerator.h
+++ b/Source/cmExportFileGenerator.h
@@ -15,6 +15,8 @@
#include "cmCommand.h"
#include "cmGeneratorExpression.h"
+class cmTargetExport;
+
/** \class cmExportFileGenerator
* \brief Generate a file exporting targets from a build or install tree.
*
@@ -35,6 +37,8 @@ public:
/** Set the namespace in which to place exported target names. */
void SetNamespace(const char* ns) { this->Namespace = ns; }
+ void SetExportOld(bool exportOld) { this->ExportOld = exportOld; }
+
/** Add a configuration to be exported. */
void AddConfiguration(const char* config);
@@ -101,6 +105,10 @@ protected:
cmGeneratorExpression::PreprocessContext,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
+ bool PopulateInterfaceLinkLibrariesProperty(cmTarget *target,
+ cmGeneratorExpression::PreprocessContext,
+ ImportPropertyMap &properties,
+ std::vector<std::string> &missingTargets);
void PopulateInterfaceProperty(const char *propName, cmTarget *target,
ImportPropertyMap &properties);
void PopulateCompatibleInterfaceProperties(cmTarget *target,
@@ -108,7 +116,7 @@ protected:
void GenerateInterfaceProperties(cmTarget *target, std::ostream& os,
const ImportPropertyMap &properties);
void PopulateIncludeDirectoriesInterface(
- cmTarget *target,
+ cmTargetExport *target,
cmGeneratorExpression::PreprocessContext preprocessRule,
ImportPropertyMap &properties,
std::vector<std::string> &missingTargets);
@@ -128,9 +136,14 @@ protected:
std::vector<std::string> &missingTargets,
FreeTargetsReplace replace = NoReplaceFreeTargets);
+ void GenerateRequiredCMakeVersion(std::ostream& os,
+ const char *versionString);
+
// The namespace in which the exports are placed in the generated file.
std::string Namespace;
+ bool ExportOld;
+
// The set of configurations to export.
std::vector<std::string> Configurations;
diff --git a/Source/cmExportInstallFileGenerator.cxx b/Source/cmExportInstallFileGenerator.cxx
index 43b17c6..c97d4ff 100644
--- a/Source/cmExportInstallFileGenerator.cxx
+++ b/Source/cmExportInstallFileGenerator.cxx
@@ -39,7 +39,7 @@ std::string cmExportInstallFileGenerator::GetConfigImportFileGlob()
//----------------------------------------------------------------------------
bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{
- std::vector<cmTarget*> allTargets;
+ std::vector<cmTargetExport*> allTargets;
{
std::string expectedTargets;
std::string sep;
@@ -49,10 +49,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
{
expectedTargets += sep + this->Namespace + (*tei)->Target->GetExportName();
sep = " ";
- cmTargetExport const* te = *tei;
+ cmTargetExport * te = *tei;
if(this->ExportedTargets.insert(te->Target).second)
{
- allTargets.push_back(te->Target);
+ allTargets.push_back(te);
}
else
{
@@ -113,17 +113,18 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
std::vector<std::string> missingTargets;
+ bool require2_8_12 = false;
// Create all the imported targets.
- for(std::vector<cmTarget*>::const_iterator
+ for(std::vector<cmTargetExport*>::const_iterator
tei = allTargets.begin();
tei != allTargets.end(); ++tei)
{
- cmTarget* te = *tei;
+ cmTarget* te = (*tei)->Target;
this->GenerateImportTargetCode(os, te);
ImportPropertyMap properties;
- this->PopulateIncludeDirectoriesInterface(te,
+ this->PopulateIncludeDirectoriesInterface(*tei,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
this->PopulateInterfaceProperty("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES",
@@ -138,6 +139,20 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
te,
cmGeneratorExpression::InstallInterface,
properties, missingTargets);
+
+ const bool newCMP0022Behavior =
+ te->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && te->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+ if (newCMP0022Behavior)
+ {
+ if (this->PopulateInterfaceLinkLibrariesProperty(te,
+ cmGeneratorExpression::InstallInterface,
+ properties, missingTargets)
+ && !this->ExportOld)
+ {
+ require2_8_12 = true;
+ }
+ }
this->PopulateInterfaceProperty("INTERFACE_POSITION_INDEPENDENT_CODE",
te, properties);
this->PopulateCompatibleInterfaceProperties(te, properties);
@@ -145,6 +160,10 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
this->GenerateInterfaceProperties(te, os, properties);
}
+ if (require2_8_12)
+ {
+ this->GenerateRequiredCMakeVersion(os, "2.8.11.20130626");
+ }
// Now load per-configuration properties for them.
os << "# Load information for each installed configuration.\n"
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index f6f4cef..dfbb1c0 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -621,19 +621,15 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout,
->GetGeneratorTarget(target);
// the compilerdefines for this target
- std::string cdefs = target->GetCompileDefinitions(buildType);
+ std::vector<std::string> cdefs;
+ target->GetCompileDefinitions(cdefs, buildType);
- if(!cdefs.empty())
+ // Expand the list.
+ for(std::vector<std::string>::const_iterator di = cdefs.begin();
+ di != cdefs.end(); ++di)
{
- // Expand the list.
- std::vector<std::string> defs;
- cmSystemTools::ExpandListArgument(cdefs.c_str(), defs);
- for(std::vector<std::string>::const_iterator di = defs.begin();
- di != defs.end(); ++di)
- {
- cmXMLSafe safedef(di->c_str());
- fout <<" <Add option=\"-D" << safedef.str() << "\" />\n";
- }
+ cmXMLSafe safedef(di->c_str());
+ fout <<" <Add option=\"-D" << safedef.str() << "\" />\n";
}
// the include directories for this target
diff --git a/Source/cmExtraSublimeTextGenerator.cxx b/Source/cmExtraSublimeTextGenerator.cxx
index 39b6add..523fca9 100644
--- a/Source/cmExtraSublimeTextGenerator.cxx
+++ b/Source/cmExtraSublimeTextGenerator.cxx
@@ -463,7 +463,7 @@ ComputeDefines(cmSourceFile *source, cmLocalGenerator* lg, cmTarget *target,
}
// Add preprocessor definitions for this target and configuration.
- lg->AppendDefines(defines, target->GetCompileDefinitions(config));
+ lg->AddCompileDefinitions(defines, target, config);
lg->AppendDefines(defines, source->GetProperty("COMPILE_DEFINITIONS"));
{
std::string defPropName = "COMPILE_DEFINITIONS_";
diff --git a/Source/cmFindCommon.cxx b/Source/cmFindCommon.cxx
index 5daa47d..b44864e 100644
--- a/Source/cmFindCommon.cxx
+++ b/Source/cmFindCommon.cxx
@@ -62,15 +62,10 @@ void cmFindCommon::GenerateDocumentation()
"The CMake variable CMAKE_FIND_ROOT_PATH specifies one or more "
"directories to be prepended to all other search directories. "
"This effectively \"re-roots\" the entire search under given locations. "
- "By default it is empty. "
- "The variable CMAKE_SYSROOT can also be used to specify exactly one "
- "directory to use as a prefix. Setting CMAKE_SYSROOT also has other "
- "effects. See the documentation for that variable for more. "
- "These are especially useful when "
+ "By default it is empty. It is especially useful when "
"cross-compiling to point to the root directory of the "
"target environment and CMake will search there too. By default at first "
- "the CMAKE_SYSROOT directory is searched, then the directories listed in "
- "CMAKE_FIND_ROOT_PATH and then the non-rooted "
+ "the directories listed in CMAKE_FIND_ROOT_PATH and then the non-rooted "
"directories will be searched. "
"The default behavior can be adjusted by setting "
"CMAKE_FIND_ROOT_PATH_MODE_XXX. This behavior can be manually "
@@ -192,27 +187,16 @@ void cmFindCommon::RerootPaths(std::vector<std::string>& paths)
{
return;
}
- const char* sysroot =
- this->Makefile->GetDefinition("CMAKE_SYSROOT");
const char* rootPath =
this->Makefile->GetDefinition("CMAKE_FIND_ROOT_PATH");
- const bool noSysroot = !sysroot || !*sysroot;
- const bool noRootPath = !rootPath || !*rootPath;
- if(noSysroot && noRootPath)
+ if((rootPath == 0) || (strlen(rootPath) == 0))
{
return;
}
// Construct the list of path roots with no trailing slashes.
std::vector<std::string> roots;
- if (sysroot)
- {
- roots.push_back(sysroot);
- }
- if (rootPath)
- {
- cmSystemTools::ExpandListArgument(rootPath, roots);
- }
+ cmSystemTools::ExpandListArgument(rootPath, roots);
for(std::vector<std::string>::iterator ri = roots.begin();
ri != roots.end(); ++ri)
{
diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx
index ab8bd13..e962313 100644
--- a/Source/cmGeneratorExpression.cxx
+++ b/Source/cmGeneratorExpression.cxx
@@ -229,8 +229,27 @@ static std::string stripAllGeneratorExpressions(const std::string &input)
}
//----------------------------------------------------------------------------
+static void prefixItems(const std::string &content, std::string &result,
+ const std::string &prefix)
+{
+ std::vector<std::string> entries;
+ cmGeneratorExpression::Split(content, entries);
+ for(std::vector<std::string>::const_iterator ei = entries.begin();
+ ei != entries.end(); ++ei)
+ {
+ if (!cmSystemTools::FileIsFullPath(ei->c_str())
+ && cmGeneratorExpression::Find(*ei) == std::string::npos)
+ {
+ result += prefix;
+ }
+ result += *ei;
+ }
+}
+
+//----------------------------------------------------------------------------
static std::string stripExportInterface(const std::string &input,
- cmGeneratorExpression::PreprocessContext context)
+ cmGeneratorExpression::PreprocessContext context,
+ bool resolveRelative)
{
std::string result;
@@ -289,7 +308,15 @@ static std::string stripExportInterface(const std::string &input,
else if(context == cmGeneratorExpression::InstallInterface
&& gotInstallInterface)
{
- result += input.substr(pos, c - cStart);
+ const std::string content = input.substr(pos, c - cStart);
+ if (resolveRelative)
+ {
+ prefixItems(content, result, "${_IMPORT_PREFIX}/");
+ }
+ else
+ {
+ result += content;
+ }
}
break;
}
@@ -380,7 +407,8 @@ void cmGeneratorExpression::Split(const std::string &input,
//----------------------------------------------------------------------------
std::string cmGeneratorExpression::Preprocess(const std::string &input,
- PreprocessContext context)
+ PreprocessContext context,
+ bool resolveRelative)
{
if (context == StripAllGeneratorExpressions)
{
@@ -388,7 +416,7 @@ std::string cmGeneratorExpression::Preprocess(const std::string &input,
}
else if (context == BuildInterface || context == InstallInterface)
{
- return stripExportInterface(input, context);
+ return stripExportInterface(input, context, resolveRelative);
}
assert(!"cmGeneratorExpression::Preprocess called with invalid args");
diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h
index 86b6f25..c20f130 100644
--- a/Source/cmGeneratorExpression.h
+++ b/Source/cmGeneratorExpression.h
@@ -57,7 +57,8 @@ public:
};
static std::string Preprocess(const std::string &input,
- PreprocessContext context);
+ PreprocessContext context,
+ bool resolveRelative = false);
static void Split(const std::string &input,
std::vector<std::string> &output);
diff --git a/Source/cmGeneratorExpressionDAGChecker.cxx b/Source/cmGeneratorExpressionDAGChecker.cxx
index d04e195..92dc054 100644
--- a/Source/cmGeneratorExpressionDAGChecker.cxx
+++ b/Source/cmGeneratorExpressionDAGChecker.cxx
@@ -22,7 +22,7 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
const GeneratorExpressionContent *content,
cmGeneratorExpressionDAGChecker *parent)
: Parent(parent), Target(target), Property(property),
- Content(content), Backtrace(backtrace)
+ Content(content), Backtrace(backtrace), TransitivePropertiesOnly(false)
{
const cmGeneratorExpressionDAGChecker *top = this;
const cmGeneratorExpressionDAGChecker *p = this->Parent;
@@ -139,6 +139,20 @@ cmGeneratorExpressionDAGChecker::checkGraph() const
}
//----------------------------------------------------------------------------
+bool cmGeneratorExpressionDAGChecker::GetTransitivePropertiesOnly()
+{
+ const cmGeneratorExpressionDAGChecker *top = this;
+ const cmGeneratorExpressionDAGChecker *parent = this->Parent;
+ while (parent)
+ {
+ top = parent;
+ parent = parent->Parent;
+ }
+
+ return top->TransitivePropertiesOnly;
+}
+
+//----------------------------------------------------------------------------
bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(const char *tgt)
{
const cmGeneratorExpressionDAGChecker *top = this;
@@ -160,7 +174,8 @@ bool cmGeneratorExpressionDAGChecker::EvaluatingLinkLibraries(const char *tgt)
|| strcmp(prop, "LINK_INTERFACE_LIBRARIES") == 0
|| strcmp(prop, "IMPORTED_LINK_INTERFACE_LIBRARIES") == 0
|| strncmp(prop, "LINK_INTERFACE_LIBRARIES_", 25) == 0
- || strncmp(prop, "IMPORTED_LINK_INTERFACE_LIBRARIES_", 34) == 0);
+ || strncmp(prop, "IMPORTED_LINK_INTERFACE_LIBRARIES_", 34) == 0)
+ || strcmp(prop, "INTERFACE_LINK_LIBRARIES") == 0;
}
//----------------------------------------------------------------------------
diff --git a/Source/cmGeneratorExpressionDAGChecker.h b/Source/cmGeneratorExpressionDAGChecker.h
index f0524f2..0b7ef02 100644
--- a/Source/cmGeneratorExpressionDAGChecker.h
+++ b/Source/cmGeneratorExpressionDAGChecker.h
@@ -56,6 +56,10 @@ struct cmGeneratorExpressionDAGChecker
CM_FOR_EACH_TRANSITIVE_PROPERTY_METHOD(DECLARE_TRANSITIVE_PROPERTY_METHOD)
+ bool GetTransitivePropertiesOnly();
+ void SetTransitivePropertiesOnly()
+ { this->TransitivePropertiesOnly = true; }
+
private:
Result checkGraph() const;
@@ -67,6 +71,7 @@ private:
const GeneratorExpressionContent * const Content;
const cmListFileBacktrace Backtrace;
Result CheckResult;
+ bool TransitivePropertiesOnly;
};
#endif
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx
index 53fb35d..b59298f 100644
--- a/Source/cmGeneratorExpressionEvaluator.cxx
+++ b/Source/cmGeneratorExpressionEvaluator.cxx
@@ -492,6 +492,24 @@ static const struct VersionEqualNode : public cmGeneratorExpressionNode
} versionEqualNode;
//----------------------------------------------------------------------------
+static const struct LinkOnlyNode : public cmGeneratorExpressionNode
+{
+ LinkOnlyNode() {}
+
+ std::string Evaluate(const std::vector<std::string> &parameters,
+ cmGeneratorExpressionContext *,
+ const GeneratorExpressionContent *,
+ cmGeneratorExpressionDAGChecker *dagChecker) const
+ {
+ if(!dagChecker->GetTransitivePropertiesOnly())
+ {
+ return parameters.front();
+ }
+ return "";
+ }
+} linkOnlyNode;
+
+//----------------------------------------------------------------------------
static const struct ConfigurationNode : public cmGeneratorExpressionNode
{
ConfigurationNode() {}
@@ -546,77 +564,30 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
const char* loc = 0;
const char* imp = 0;
std::string suffix;
- return context->CurrentTarget->GetMappedConfig(context->Config,
+ if (context->CurrentTarget->GetMappedConfig(context->Config,
&loc,
&imp,
- suffix) ? "1" : "0";
- }
- return "0";
- }
-} configurationTestNode;
-
-//----------------------------------------------------------------------------
-static const struct LinkLanguageNode : public cmGeneratorExpressionNode
-{
- LinkLanguageNode() {}
-
- virtual int NumExpectedParameters() const { return ZeroOrMoreParameters; }
-
- std::string Evaluate(const std::vector<std::string> &parameters,
- cmGeneratorExpressionContext *context,
- const GeneratorExpressionContent *content,
- cmGeneratorExpressionDAGChecker *dagChecker) const
- {
- if (dagChecker && dagChecker->EvaluatingLinkLibraries())
- {
- reportError(context, content->GetOriginalExpression(),
- "$<LINK_LANGUAGE> expression can not be used while evaluating "
- "link libraries");
- return std::string();
- }
- if (parameters.size() != 0 && parameters.size() != 1)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<LINK_LANGUAGE> expression requires one or two parameters");
- return std::string();
- }
- cmTarget* target = context->HeadTarget;
- if (!target)
- {
- reportError(context, content->GetOriginalExpression(),
- "$<LINK_LANGUAGE> may only be used with targets. It may not "
- "be used with add_custom_command.");
- return std::string();
- }
-
- const char *lang = target->GetLinkerLanguage(context->Config);
- if (parameters.size() == 0)
- {
- return lang ? lang : "";
- }
- else
- {
- cmsys::RegularExpression langValidator;
- langValidator.compile("^[A-Za-z0-9_]*$");
- if (!langValidator.find(parameters.begin()->c_str()))
- {
- reportError(context, content->GetOriginalExpression(),
- "Expression syntax not recognized.");
- return std::string();
- }
- if (!lang)
- {
- return parameters.front().empty() ? "1" : "0";
- }
-
- if (strcmp(parameters.begin()->c_str(), lang) == 0)
+ suffix))
{
- return "1";
+ // This imported target has an appropriate location
+ // for this (possibly mapped) config.
+ // Check if there is a proper config mapping for the tested config.
+ std::vector<std::string> mappedConfigs;
+ std::string mapProp = "MAP_IMPORTED_CONFIG_";
+ mapProp += context->Config;
+ if(const char* mapValue =
+ context->CurrentTarget->GetProperty(mapProp.c_str()))
+ {
+ cmSystemTools::ExpandListArgument(cmSystemTools::UpperCase(mapValue),
+ mappedConfigs);
+ return std::find(mappedConfigs.begin(), mappedConfigs.end(),
+ context->Config) != mappedConfigs.end() ? "1" : "0";
+ }
}
- return "0";
}
+ return "0";
}
-} linkLanguageNode;
+} configurationTestNode;
static const struct JoinNode : public cmGeneratorExpressionNode
{
@@ -817,6 +788,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
assert(target);
+ if (propertyName == "LINKER_LANGUAGE")
+ {
+ if (dagCheckerParent && dagCheckerParent->EvaluatingLinkLibraries())
+ {
+ reportError(context, content->GetOriginalExpression(),
+ "LINKER_LANGUAGE target property can not be used while evaluating "
+ "link libraries");
+ return std::string();
+ }
+ const char *lang = target->GetLinkerLanguage(context->Config);
+ return lang ? lang : "";
+ }
+
cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
target->GetName(),
propertyName,
@@ -904,13 +888,14 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
if (std::find_if(transBegin, transEnd,
TransitiveWhitelistCompare(propertyName)) != transEnd)
{
- const cmTarget::LinkInterface *iface = target->GetLinkInterface(
- context->Config,
- headTarget);
- if(iface)
+
+ std::vector<std::string> libs;
+ target->GetTransitivePropertyLinkLibraries(context->Config,
+ headTarget, libs);
+ if (!libs.empty())
{
linkedTargetsContent =
- getLinkedTargetsContent(iface->Libraries, target,
+ getLinkedTargetsContent(libs, target,
headTarget,
context, &dagChecker,
interfacePropertyName);
@@ -1018,10 +1003,13 @@ static const struct TargetNameNode : public cmGeneratorExpressionNode
//----------------------------------------------------------------------------
static const char* targetPolicyWhitelist[] = {
- "CMP0003"
- , "CMP0004"
- , "CMP0008"
- , "CMP0020"
+ 0
+#define TARGET_POLICY_STRING(POLICY) \
+ , #POLICY
+
+ CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_STRING)
+
+#undef TARGET_POLICY_STRING
};
cmPolicies::PolicyStatus statusForTarget(cmTarget *tgt, const char *policy)
@@ -1032,10 +1020,7 @@ cmPolicies::PolicyStatus statusForTarget(cmTarget *tgt, const char *policy)
return tgt->GetPolicyStatus ## POLICY (); \
} \
- RETURN_POLICY(CMP0003)
- RETURN_POLICY(CMP0004)
- RETURN_POLICY(CMP0008)
- RETURN_POLICY(CMP0020)
+ CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY)
#undef RETURN_POLICY
@@ -1051,10 +1036,7 @@ cmPolicies::PolicyID policyForString(const char *policy_id)
return cmPolicies:: POLICY_ID; \
} \
- RETURN_POLICY_ID(CMP0003)
- RETURN_POLICY_ID(CMP0004)
- RETURN_POLICY_ID(CMP0008)
- RETURN_POLICY_ID(CMP0020)
+ CM_FOR_EACH_TARGET_POLICY(RETURN_POLICY_ID)
#undef RETURN_POLICY_ID
@@ -1084,7 +1066,7 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
context->HadContextSensitiveCondition = true;
- for (size_t i = 0;
+ for (size_t i = 1;
i < (sizeof(targetPolicyWhitelist) /
sizeof(*targetPolicyWhitelist));
++i)
@@ -1110,8 +1092,17 @@ static const struct TargetPolicyNode : public cmGeneratorExpressionNode
}
reportError(context, content->GetOriginalExpression(),
"$<TARGET_POLICY:prop> may only be used with a limited number of "
- "policies. Currently it may be used with policies CMP0003, CMP0004, "
- "CMP0008 and CMP0020."
+ "policies. Currently it may be used with the following policies:\n"
+
+#define STRINGIFY_HELPER(X) #X
+#define STRINGIFY(X) STRINGIFY_HELPER(X)
+
+#define TARGET_POLICY_LIST_ITEM(POLICY) \
+ " * " STRINGIFY(POLICY) "\n"
+
+ CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_LIST_ITEM)
+
+#undef TARGET_POLICY_LIST_ITEM
);
return std::string();
}
@@ -1355,8 +1346,6 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &configurationNode;
else if (identifier == "CONFIG")
return &configurationTestNode;
- else if (identifier == "LINK_LANGUAGE")
- return &linkLanguageNode;
else if (identifier == "TARGET_FILE")
return &targetFileNode;
else if (identifier == "TARGET_LINKER_FILE")
@@ -1399,6 +1388,8 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
return &installPrefixNode;
else if (identifier == "JOIN")
return &joinNode;
+ else if (identifier == "LINK_ONLY")
+ return &linkOnlyNode;
return 0;
}
diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx
index 2897114..9b6ac93 100644
--- a/Source/cmGlobalGenerator.cxx
+++ b/Source/cmGlobalGenerator.cxx
@@ -892,12 +892,28 @@ void cmGlobalGenerator::Configure()
if ( this->CMakeInstance->GetWorkingMode() == cmake::NORMAL_MODE)
{
- const char* msg = "Configuring done";
+ cmOStringStream msg;
if(cmSystemTools::GetErrorOccuredFlag())
{
- msg = "Configuring incomplete, errors occurred!";
+ msg << "Configuring incomplete, errors occurred!";
+ const char* logs[] = {"CMakeOutput.log", "CMakeError.log", 0};
+ for(const char** log = logs; *log; ++log)
+ {
+ std::string f = this->CMakeInstance->GetHomeOutputDirectory();
+ f += this->CMakeInstance->GetCMakeFilesDirectory();
+ f += "/";
+ f += *log;
+ if(cmSystemTools::FileExists(f.c_str()))
+ {
+ msg << "\nSee also \"" << f << "\".";
+ }
+ }
}
- this->CMakeInstance->UpdateProgress(msg, -1);
+ else
+ {
+ msg << "Configuring done";
+ }
+ this->CMakeInstance->UpdateProgress(msg.str().c_str(), -1);
}
}
@@ -1132,8 +1148,9 @@ void cmGlobalGenerator::CreateGeneratorTargets()
cmGeneratorTargetsType generatorTargets;
cmMakefile *mf = this->LocalGenerators[i]->GetMakefile();
- const char *noconfig_compile_definitions =
- mf->GetProperty("COMPILE_DEFINITIONS");
+
+ const std::vector<cmValueWithOrigin> noconfig_compile_definitions =
+ mf->GetCompileDefinitionsEntries();
std::vector<std::string> configs;
mf->GetConfigurations(configs);
@@ -1145,7 +1162,13 @@ void cmGlobalGenerator::CreateGeneratorTargets()
cmTarget* t = &ti->second;
{
- t->AppendProperty("COMPILE_DEFINITIONS", noconfig_compile_definitions);
+ for (std::vector<cmValueWithOrigin>::const_iterator it
+ = noconfig_compile_definitions.begin();
+ it != noconfig_compile_definitions.end(); ++it)
+ {
+ t->InsertCompileDefinition(*it);
+ }
+
for(std::vector<std::string>::const_iterator ci = configs.begin();
ci != configs.end(); ++ci)
{
diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx
index 9596ebc..61d0272 100644
--- a/Source/cmGlobalNinjaGenerator.cxx
+++ b/Source/cmGlobalNinjaGenerator.cxx
@@ -147,7 +147,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
//we need to track every dependency that comes in, since we are trying
//to find dependencies that are side effects of build commands
//
- this->CombinedBuildExplicitDependencies.insert(*i);
+ this->CombinedBuildExplicitDependencies.insert( EncodePath(*i) );
}
// Write implicit dependencies.
@@ -180,7 +180,7 @@ void cmGlobalNinjaGenerator::WriteBuild(std::ostream& os,
i != outputs.end(); ++i)
{
build << " " << EncodeIdent(EncodePath(*i), os);
- this->CombinedBuildOutputs.insert(*i);
+ this->CombinedBuildOutputs.insert( EncodePath(*i) );
}
build << ":";
@@ -824,13 +824,19 @@ cmGlobalNinjaGenerator
cmLocalNinjaGenerator *ng =
static_cast<cmLocalNinjaGenerator *>(this->LocalGenerators[0]);
+ // for frameworks, we want the real name, not smple name
+ // frameworks always appear versioned, and the build.ninja
+ // will always attempt to manage symbolic links instead
+ // of letting cmOSXBundleGenerator do it.
+ bool realname = target->IsFrameworkOnApple();
+
switch (target->GetType()) {
case cmTarget::EXECUTABLE:
case cmTarget::SHARED_LIBRARY:
case cmTarget::STATIC_LIBRARY:
case cmTarget::MODULE_LIBRARY:
outputs.push_back(ng->ConvertToNinjaPath(
- target->GetFullPath(configName).c_str()));
+ target->GetFullPath(configName, false, realname).c_str()));
break;
case cmTarget::OBJECT_LIBRARY:
@@ -944,7 +950,7 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
typedef std::vector<std::string>::const_iterator vect_it;
for(vect_it j = files.begin(); j != files.end(); ++j)
{
- knownDependencies.insert(ng->ConvertToNinjaPath( j->c_str() ));
+ knownDependencies.insert( ng->ConvertToNinjaPath( j->c_str() ) );
}
}
@@ -959,26 +965,15 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
typedef std::vector<std::string>::const_iterator vect_it;
for(vect_it j = files.begin(); j != files.end(); ++j)
{
- knownDependencies.insert(ng->ConvertToNinjaPath( j->c_str() ));
+ knownDependencies.insert( ng->ConvertToNinjaPath( j->c_str() ) );
}
}
- //insert outputs from all WirteBuild commands
- for(std::set<std::string>::iterator i = this->CombinedBuildOutputs.begin();
- i != this->CombinedBuildOutputs.end(); ++i)
- {
- knownDependencies.insert(*i);
- }
-
- //after we have combined the data into knownDependencies we have no need
- //to keep this data around
- this->CombinedBuildOutputs.clear();
-
for(TargetAliasMap::const_iterator i= this->TargetAliases.begin();
i != this->TargetAliases.end();
++i)
{
- knownDependencies.insert(i->first);
+ knownDependencies.insert( ng->ConvertToNinjaPath(i->first.c_str()) );
}
//remove all source files we know will exist.
@@ -987,11 +982,26 @@ void cmGlobalNinjaGenerator::WriteUnknownExplicitDependencies(std::ostream& os)
i != this->AssumedSourceDependencies.end();
++i)
{
- knownDependencies.insert(i->first);
+ knownDependencies.insert( ng->ConvertToNinjaPath(i->first.c_str()) );
}
+ //insert outputs from all WirteBuild commands
+ for(std::set<std::string>::iterator i = this->CombinedBuildOutputs.begin();
+ i != this->CombinedBuildOutputs.end(); ++i)
+ {
+ //these paths have already be encoded when added to CombinedBuildOutputs
+ knownDependencies.insert(*i);
+ }
+
+ //after we have combined the data into knownDependencies we have no need
+ //to keep this data around
+ this->CombinedBuildOutputs.clear();
+
//now we difference with CombinedBuildExplicitDependencies to find
- //the list of items we know nothing about
+ //the list of items we know nothing about.
+ //We have encoded all the paths in CombinedBuildExplicitDependencies
+ //and knownDependencies so no matter if unix or windows paths they
+ //should all match now.
std::vector<std::string> unkownExplicitDepends;
this->CombinedBuildExplicitDependencies.erase("all");
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index 9cfbe42..63de1a5 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -1741,8 +1741,9 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
this->AppendDefines(ppDefs, exportMacro);
}
cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target);
- this->AppendDefines(ppDefs,
- target.GetCompileDefinitions(configName).c_str());
+ std::vector<std::string> targetDefines;
+ target.GetCompileDefinitions(targetDefines, configName);
+ this->AppendDefines(ppDefs, targetDefines);
buildSettings->AddAttribute
("GCC_PREPROCESSOR_DEFINITIONS", ppDefs.CreateList());
diff --git a/Source/cmIDEOptions.cxx b/Source/cmIDEOptions.cxx
index 76a60cf..34a9c7c 100644
--- a/Source/cmIDEOptions.cxx
+++ b/Source/cmIDEOptions.cxx
@@ -165,6 +165,11 @@ void cmIDEOptions::AddDefines(const char* defines)
cmSystemTools::ExpandListArgument(defines, this->Defines);
}
}
+//----------------------------------------------------------------------------
+void cmIDEOptions::AddDefines(const std::vector<std::string> &defines)
+{
+ this->Defines.insert(this->Defines.end(), defines.begin(), defines.end());
+}
//----------------------------------------------------------------------------
void cmIDEOptions::AddFlag(const char* flag, const char* value)
diff --git a/Source/cmIDEOptions.h b/Source/cmIDEOptions.h
index e556bde..e78af3e 100644
--- a/Source/cmIDEOptions.h
+++ b/Source/cmIDEOptions.h
@@ -27,6 +27,7 @@ public:
// Store definitions and flags.
void AddDefine(const std::string& define);
void AddDefines(const char* defines);
+ void AddDefines(const std::vector<std::string> &defines);
void AddFlag(const char* flag, const char* value);
void RemoveFlag(const char* flag);
const char* GetFlag(const char* flag);
diff --git a/Source/cmIncludeCommand.h b/Source/cmIncludeCommand.h
index c46c02d..d97b7c3 100644
--- a/Source/cmIncludeCommand.h
+++ b/Source/cmIncludeCommand.h
@@ -55,7 +55,7 @@ public:
*/
virtual const char* GetTerseDocumentation() const
{
- return "Read CMake listfile code from the given file.";
+ return "Load and run CMake code from a file or module.";
}
/**
@@ -66,9 +66,10 @@ public:
return
" include(<file|module> [OPTIONAL] [RESULT_VARIABLE <VAR>]\n"
" [NO_POLICY_SCOPE])\n"
- "Reads CMake listfile code from the given file. Commands in the file "
- "are processed immediately as if they were written in place of the "
- "include command. If OPTIONAL is present, then no error "
+ "Load and run CMake code from the file given. "
+ "Variable reads and writes access the scope of the caller "
+ "(dynamic scoping). "
+ "If OPTIONAL is present, then no error "
"is raised if the file does not exist. If RESULT_VARIABLE is given "
"the variable will be set to the full filename which "
"has been included or NOTFOUND if it failed.\n"
diff --git a/Source/cmInstallCommand.cxx b/Source/cmInstallCommand.cxx
index dcd418b..4649eda 100644
--- a/Source/cmInstallCommand.cxx
+++ b/Source/cmInstallCommand.cxx
@@ -219,6 +219,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
cmCAStringVector runtimeArgVector (&argHelper,"RUNTIME",&group);
cmCAStringVector frameworkArgVector (&argHelper,"FRAMEWORK",&group);
cmCAStringVector bundleArgVector (&argHelper,"BUNDLE",&group);
+ cmCAStringVector includesArgVector (&argHelper,"INCLUDES",&group);
cmCAStringVector privateHeaderArgVector(&argHelper,"PRIVATE_HEADER",&group);
cmCAStringVector publicHeaderArgVector (&argHelper,"PUBLIC_HEADER",&group);
cmCAStringVector resourceArgVector (&argHelper,"RESOURCE",&group);
@@ -247,6 +248,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
cmInstallCommandArguments privateHeaderArgs(this->DefaultComponentName);
cmInstallCommandArguments publicHeaderArgs(this->DefaultComponentName);
cmInstallCommandArguments resourceArgs(this->DefaultComponentName);
+ cmInstallCommandIncludesArgument includesArgs;
// now parse the args for specific parts of the target (e.g. LIBRARY,
// RUNTIME, ARCHIVE etc.
@@ -258,6 +260,7 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
privateHeaderArgs.Parse(&privateHeaderArgVector.GetVector(), &unknownArgs);
publicHeaderArgs.Parse (&publicHeaderArgVector.GetVector(), &unknownArgs);
resourceArgs.Parse (&resourceArgVector.GetVector(), &unknownArgs);
+ includesArgs.Parse (&includesArgVector.GetVector(), &unknownArgs);
if(!unknownArgs.empty())
{
@@ -292,6 +295,13 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
return false;
}
+ if(!includesArgs.GetIncludeDirs().empty() && exports.GetString().empty())
+ {
+ this->SetError("TARGETS given INCLUDES DESTINATION, but EXPORT set "
+ "not specified.");
+ return false;
+ }
+
// Enforce argument rules too complex to specify for the
// general-purpose parser.
if(archiveArgs.GetNamelinkOnly() ||
@@ -747,6 +757,20 @@ bool cmInstallCommand::HandleTargetsMode(std::vector<std::string> const& args)
te->RuntimeGenerator = runtimeGenerator;
this->Makefile->GetLocalGenerator()->GetGlobalGenerator()
->GetExportSets()[exports.GetString()]->AddTargetExport(te);
+
+ std::vector<std::string> dirs = includesArgs.GetIncludeDirs();
+ if(!dirs.empty())
+ {
+ std::string dirString;
+ const char *sep = "";
+ for (std::vector<std::string>::const_iterator it = dirs.begin();
+ it != dirs.end(); ++it)
+ {
+ te->InterfaceIncludeDirectories += sep;
+ te->InterfaceIncludeDirectories += *it;
+ sep = ";";
+ }
+ }
}
}
@@ -1196,6 +1220,8 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
cmInstallCommandArguments ica(this->DefaultComponentName);
cmCAString exp(&ica.Parser, "EXPORT");
cmCAString name_space(&ica.Parser, "NAMESPACE", &ica.ArgumentGroup);
+ cmCAEnabler exportOld(&ica.Parser, "EXPORT_LINK_INTERFACE_LIBRARIES",
+ &ica.ArgumentGroup);
cmCAString filename(&ica.Parser, "FILE", &ica.ArgumentGroup);
exp.Follows(0);
@@ -1268,15 +1294,40 @@ bool cmInstallCommand::HandleExportMode(std::vector<std::string> const& args)
}
}
+ cmExportSet *exportSet = this->Makefile->GetLocalGenerator()
+ ->GetGlobalGenerator()->GetExportSets()[exp.GetString()];
+ if (exportOld.IsEnabled())
+ {
+ for(std::vector<cmTargetExport*>::const_iterator
+ tei = exportSet->GetTargetExports()->begin();
+ tei != exportSet->GetTargetExports()->end(); ++tei)
+ {
+ cmTargetExport const* te = *tei;
+ const bool newCMP0022Behavior =
+ te->Target->GetPolicyStatusCMP0022() != cmPolicies::WARN
+ && te->Target->GetPolicyStatusCMP0022() != cmPolicies::OLD;
+
+ if(!newCMP0022Behavior)
+ {
+ cmOStringStream e;
+ e << "INSTALL(EXPORT) given keyword \""
+ << "EXPORT_LINK_INTERFACE_LIBRARIES" << "\", but target \""
+ << te->Target->GetName()
+ << "\" does not have policy CMP0022 set to NEW.";
+ this->SetError(e.str().c_str());
+ return false;
+ }
+ }
+ }
+
// Create the export install generator.
cmInstallExportGenerator* exportGenerator =
new cmInstallExportGenerator(
- this->Makefile->GetLocalGenerator()
- ->GetGlobalGenerator()->GetExportSets()[exp.GetString()],
+ exportSet,
ica.GetDestination().c_str(),
ica.GetPermissions().c_str(), ica.GetConfigurations(),
ica.GetComponent().c_str(), fname.c_str(),
- name_space.GetCString(), this->Makefile);
+ name_space.GetCString(), exportOld.IsEnabled(), this->Makefile);
this->Makefile->AddInstallGenerator(exportGenerator);
return true;
diff --git a/Source/cmInstallCommand.h b/Source/cmInstallCommand.h
index 7c06009..6509501 100644
--- a/Source/cmInstallCommand.h
+++ b/Source/cmInstallCommand.h
@@ -102,6 +102,7 @@ public:
" [[ARCHIVE|LIBRARY|RUNTIME|FRAMEWORK|BUNDLE|\n"
" PRIVATE_HEADER|PUBLIC_HEADER|RESOURCE]\n"
" [DESTINATION <dir>]\n"
+ " [INCLUDES DESTINATION [<dir> ...]]\n"
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
" [COMPONENT <component>]\n"
@@ -130,6 +131,10 @@ public:
"all target types. If only one is given then only targets of that "
"type will be installed (which can be used to install just a DLL or "
"just an import library)."
+ "The INCLUDES DESTINATION specifies a list of directories which will "
+ "be added to the INTERFACE_INCLUDE_DIRECTORIES of the <targets> when "
+ "exported by install(EXPORT). If a relative path is specified, it is "
+ "treated as relative to the $<INSTALL_PREFIX>."
"\n"
"The PRIVATE_HEADER, PUBLIC_HEADER, and RESOURCE arguments cause "
"subsequent properties to be applied to installing a FRAMEWORK "
@@ -291,6 +296,7 @@ public:
" [NAMESPACE <namespace>] [FILE <name>.cmake]\n"
" [PERMISSIONS permissions...]\n"
" [CONFIGURATIONS [Debug|Release|...]]\n"
+ " [EXPORT_LINK_INTERFACE_LIBRARIES]\n"
" [COMPONENT <component>])\n"
"The EXPORT form generates and installs a CMake file containing code "
"to import targets from the installation tree into another project. "
@@ -306,6 +312,10 @@ public:
"installed when one of the named configurations is installed. "
"Additionally, the generated import file will reference only the "
"matching target configurations. "
+ "The EXPORT_LINK_INTERFACE_LIBRARIES keyword, if present, causes the "
+ "contents of the properties matching "
+ "(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)? to be exported, when "
+ "policy CMP0022 is NEW. "
"If a COMPONENT option is specified that does not match that given "
"to the targets associated with <export-name> the behavior is "
"undefined. "
diff --git a/Source/cmInstallCommandArguments.cxx b/Source/cmInstallCommandArguments.cxx
index 8e48f08..91ea861 100644
--- a/Source/cmInstallCommandArguments.cxx
+++ b/Source/cmInstallCommandArguments.cxx
@@ -203,3 +203,37 @@ bool cmInstallCommandArguments::CheckPermissions(
// This is not a valid permission.
return false;
}
+
+cmInstallCommandIncludesArgument::cmInstallCommandIncludesArgument()
+{
+
+}
+
+const std::vector<std::string>&
+cmInstallCommandIncludesArgument::GetIncludeDirs() const
+{
+ return this->IncludeDirs;
+}
+
+void cmInstallCommandIncludesArgument::Parse(
+ const std::vector<std::string>* args,
+ std::vector<std::string>*)
+{
+ if(args->empty())
+ {
+ return;
+ }
+ std::vector<std::string>::const_iterator it = args->begin();
+ ++it;
+ for ( ; it != args->end(); ++it)
+ {
+ std::string dir = *it;
+ if (!cmSystemTools::FileIsFullPath(it->c_str())
+ && cmGeneratorExpression::Find(*it) == std::string::npos)
+ {
+ dir = "$<INSTALL_PREFIX>/" + dir;
+ }
+ cmSystemTools::ConvertToUnixSlashes(dir);
+ this->IncludeDirs.push_back(dir);
+ }
+}
diff --git a/Source/cmInstallCommandArguments.h b/Source/cmInstallCommandArguments.h
index 01f7d56..90347e6 100644
--- a/Source/cmInstallCommandArguments.h
+++ b/Source/cmInstallCommandArguments.h
@@ -65,4 +65,17 @@ class cmInstallCommandArguments
bool CheckPermissions();
};
+class cmInstallCommandIncludesArgument
+{
+ public:
+ cmInstallCommandIncludesArgument();
+ void Parse(const std::vector<std::string>* args,
+ std::vector<std::string>* unconsumedArgs);
+
+ const std::vector<std::string>& GetIncludeDirs() const;
+
+ private:
+ std::vector<std::string> IncludeDirs;
+};
+
#endif
diff --git a/Source/cmInstallExportGenerator.cxx b/Source/cmInstallExportGenerator.cxx
index 0a645a8..3e9e6ac 100644
--- a/Source/cmInstallExportGenerator.cxx
+++ b/Source/cmInstallExportGenerator.cxx
@@ -33,12 +33,14 @@ cmInstallExportGenerator::cmInstallExportGenerator(
std::vector<std::string> const& configurations,
const char* component,
const char* filename, const char* name_space,
+ bool exportOld,
cmMakefile* mf)
:cmInstallGenerator(destination, configurations, component)
,ExportSet(exportSet)
,FilePermissions(file_permissions)
,FileName(filename)
,Namespace(name_space)
+ ,ExportOld(exportOld)
,Makefile(mf)
{
this->EFGen = new cmExportInstallFileGenerator(this);
@@ -137,6 +139,7 @@ void cmInstallExportGenerator::GenerateScript(std::ostream& os)
// Generate the import file for this export set.
this->EFGen->SetExportFile(this->MainImportFile.c_str());
this->EFGen->SetNamespace(this->Namespace.c_str());
+ this->EFGen->SetExportOld(this->ExportOld);
if(this->ConfigurationTypes->empty())
{
if(this->ConfigurationName && *this->ConfigurationName)
diff --git a/Source/cmInstallExportGenerator.h b/Source/cmInstallExportGenerator.h
index 7aff731..37b5593 100644
--- a/Source/cmInstallExportGenerator.h
+++ b/Source/cmInstallExportGenerator.h
@@ -31,7 +31,7 @@ public:
const std::vector<std::string>& configurations,
const char* component,
const char* filename, const char* name_space,
- cmMakefile* mf);
+ bool exportOld, cmMakefile* mf);
~cmInstallExportGenerator();
cmExportSet* GetExportSet() {return this->ExportSet;}
@@ -52,6 +52,7 @@ protected:
std::string FilePermissions;
std::string FileName;
std::string Namespace;
+ bool ExportOld;
cmMakefile* Makefile;
std::string TempDir;
diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx
index 2971c3b..b187d6b 100644
--- a/Source/cmLocalGenerator.cxx
+++ b/Source/cmLocalGenerator.cxx
@@ -55,7 +55,6 @@ cmLocalGenerator::cmLocalGenerator()
this->UseRelativePaths = false;
this->Configured = false;
this->EmitUniversalBinaryFlags = true;
- this->IsMakefileGenerator = false;
this->RelativePathsConfigured = false;
this->PathConversionsSetup = false;
this->BackwardsCompatibility = 0;
@@ -260,12 +259,7 @@ void cmLocalGenerator::TraceDependencies()
cmTargets& targets = this->Makefile->GetTargets();
for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t)
{
- const char* projectFilename = 0;
- if (this->IsMakefileGenerator == false) // only use of this variable
- {
- projectFilename = t->second.GetName();
- }
- t->second.TraceDependencies(projectFilename);
+ t->second.TraceDependencies();
}
}
@@ -1339,6 +1333,17 @@ std::string cmLocalGenerator::GetIncludeFlags(
}
//----------------------------------------------------------------------------
+void cmLocalGenerator::AddCompileDefinitions(std::set<std::string>& defines,
+ cmTarget* target,
+ const char* config)
+{
+ std::vector<std::string> targetDefines;
+ target->GetCompileDefinitions(targetDefines,
+ config);
+ this->AppendDefines(defines, targetDefines);
+}
+
+//----------------------------------------------------------------------------
void cmLocalGenerator::AddCompileOptions(
std::string& flags, cmTarget* target,
const char* lang, const char* config
@@ -1375,7 +1380,7 @@ void cmLocalGenerator::AddCompileOptions(
// COMPILE_FLAGS are not escaped for historical reasons.
this->AppendFlags(flags, targetFlags);
}
- std::vector<std::string> opts; // TODO: Emitted.
+ std::vector<std::string> opts;
target->GetCompileOptions(opts, config);
for(std::vector<std::string>::const_iterator i = opts.begin();
i != opts.end(); ++i)
@@ -1467,8 +1472,6 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
return;
}
- std::string rootPath = this->Makefile->GetSafeDefinition("CMAKE_SYSROOT");
-
std::vector<std::string> implicitDirs;
// Load implicit include directories for this language.
std::string impDirVar = "CMAKE_";
@@ -1481,9 +1484,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs,
for(std::vector<std::string>::const_iterator i = impDirVec.begin();
i != impDirVec.end(); ++i)
{
- std::string d = rootPath + *i;
- cmSystemTools::ConvertToUnixSlashes(d);
- emitted.insert(d);
+ emitted.insert(*i);
if (!stripImplicitInclDirs)
{
implicitDirs.push_back(*i);
@@ -2301,7 +2302,13 @@ void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
// Expand the list of definitions.
std::vector<std::string> defines_vec;
cmSystemTools::ExpandListArgument(defines_list, defines_vec);
+ this->AppendDefines(defines, defines_vec);
+}
+//----------------------------------------------------------------------------
+void cmLocalGenerator::AppendDefines(std::set<std::string>& defines,
+ const std::vector<std::string> &defines_vec)
+{
for(std::vector<std::string>::const_iterator di = defines_vec.begin();
di != defines_vec.end(); ++di)
{
diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h
index ef4b1c6..ed0f6e3 100644
--- a/Source/cmLocalGenerator.h
+++ b/Source/cmLocalGenerator.h
@@ -167,6 +167,9 @@ public:
{
this->AppendDefines(defines, defines_list.c_str());
}
+ void AppendDefines(std::set<std::string>& defines,
+ const std::vector<std::string> &defines_vec);
+
/**
* Join a set of defines into a definesString with a space separator.
*/
@@ -221,6 +224,8 @@ public:
bool stripImplicitInclDirs = true);
void AddCompileOptions(std::string& flags, cmTarget* target,
const char* lang, const char* config);
+ void AddCompileDefinitions(std::set<std::string>& defines, cmTarget* target,
+ const char* config);
/** Compute the language used to compile the given source file. */
const char* GetSourceFileLanguage(const cmSourceFile& source);
@@ -436,8 +441,6 @@ protected:
bool IgnoreLibPrefix;
bool Configured;
bool EmitUniversalBinaryFlags;
- // A type flag is not nice. It's used only in TraceDependencies().
- bool IsMakefileGenerator;
// Hack for ExpandRuleVariable until object-oriented version is
// committed.
std::string TargetImplib;
diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx
index bdc3d80..a522e37 100644
--- a/Source/cmLocalNinjaGenerator.cxx
+++ b/Source/cmLocalNinjaGenerator.cxx
@@ -27,7 +27,6 @@ cmLocalNinjaGenerator::cmLocalNinjaGenerator()
, ConfigName("")
, HomeRelativeOutputPath("")
{
- this->IsMakefileGenerator = true;
#ifdef _WIN32
this->WindowsShell = true;
#endif
diff --git a/Source/cmLocalUnixMakefileGenerator3.cxx b/Source/cmLocalUnixMakefileGenerator3.cxx
index 78a70f8..56da1f9 100644
--- a/Source/cmLocalUnixMakefileGenerator3.cxx
+++ b/Source/cmLocalUnixMakefileGenerator3.cxx
@@ -92,7 +92,6 @@ cmLocalUnixMakefileGenerator3::cmLocalUnixMakefileGenerator3()
this->SkipPreprocessedSourceRules = false;
this->SkipAssemblySourceRules = false;
this->MakeCommandEscapeTargetTwice = false;
- this->IsMakefileGenerator = true;
this->BorlandMakeCurlyHack = false;
}
@@ -1962,8 +1961,8 @@ void cmLocalUnixMakefileGenerator3
// Build a list of preprocessor definitions for the target.
std::set<std::string> defines;
- this->AppendDefines(defines, target.GetCompileDefinitions(
- this->ConfigurationName.c_str()));
+ this->AddCompileDefinitions(defines, &target,
+ this->ConfigurationName.c_str());
if(!defines.empty())
{
cmakefileStream
diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx
index 0b61e1d..df6e1f1 100644
--- a/Source/cmLocalVisualStudio6Generator.cxx
+++ b/Source/cmLocalVisualStudio6Generator.cxx
@@ -1701,21 +1701,11 @@ void cmLocalVisualStudio6Generator
std::set<std::string> minsizeDefinesSet;
std::set<std::string> debugrelDefinesSet;
- this->AppendDefines(
- definesSet,
- target.GetCompileDefinitions(0));
- this->AppendDefines(
- debugDefinesSet,
- target.GetCompileDefinitions("DEBUG"));
- this->AppendDefines(
- releaseDefinesSet,
- target.GetCompileDefinitions("RELEASE"));
- this->AppendDefines(
- minsizeDefinesSet,
- target.GetCompileDefinitions("MINSIZEREL"));
- this->AppendDefines(
- debugrelDefinesSet,
- target.GetCompileDefinitions("RELWITHDEBINFO"));
+ this->AddCompileDefinitions(definesSet, &target, 0);
+ this->AddCompileDefinitions(debugDefinesSet, &target, "DEBUG");
+ this->AddCompileDefinitions(releaseDefinesSet, &target, "RELEASE");
+ this->AddCompileDefinitions(minsizeDefinesSet, &target, "MINSIZEREL");
+ this->AddCompileDefinitions(debugrelDefinesSet, &target, "RELWITHDEBINFO");
std::string defines = " ";
std::string debugDefines = " ";
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 1d2f709..9ecd53d 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -746,7 +746,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
targetOptions.ParseFinish();
cmGeneratorTarget* gt =
this->GlobalGenerator->GetGeneratorTarget(&target);
- targetOptions.AddDefines(target.GetCompileDefinitions(configName).c_str());
+ std::vector<std::string> targetDefines;
+ target.GetCompileDefinitions(targetDefines, configName);
+ targetOptions.AddDefines(targetDefines);
targetOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx
index ecc0942..2cd19cf 100644
--- a/Source/cmMakefile.cxx
+++ b/Source/cmMakefile.cxx
@@ -1505,6 +1505,12 @@ void cmMakefile::InitializeFromParent()
parentOptions.begin(),
parentOptions.end());
+ const std::vector<cmValueWithOrigin> parentDefines =
+ parent->GetCompileDefinitionsEntries();
+ this->CompileDefinitionsEntries.insert(this->CompileDefinitionsEntries.end(),
+ parentDefines.begin(),
+ parentDefines.end());
+
this->SystemIncludeDirectories = parent->SystemIncludeDirectories;
// define flags
@@ -3479,6 +3485,19 @@ void cmMakefile::SetProperty(const char* prop, const char* value)
this->CompileOptionsEntries.push_back(cmValueWithOrigin(value, lfbt));
return;
}
+ if (propname == "COMPILE_DEFINITIONS")
+ {
+ this->CompileDefinitionsEntries.clear();
+ if (!value)
+ {
+ return;
+ }
+ cmListFileBacktrace lfbt;
+ this->GetBacktrace(lfbt);
+ cmValueWithOrigin entry(value, lfbt);
+ this->CompileDefinitionsEntries.push_back(entry);
+ return;
+ }
if ( propname == "INCLUDE_REGULAR_EXPRESSION" )
{
@@ -3526,6 +3545,14 @@ void cmMakefile::AppendProperty(const char* prop, const char* value,
cmValueWithOrigin(value, lfbt));
return;
}
+ if (propname == "COMPILE_DEFINITIONS")
+ {
+ cmListFileBacktrace lfbt;
+ this->GetBacktrace(lfbt);
+ this->CompileDefinitionsEntries.push_back(
+ cmValueWithOrigin(value, lfbt));
+ return;
+ }
if ( propname == "LINK_DIRECTORIES" )
{
std::vector<std::string> varArgsExpanded;
@@ -3665,6 +3692,20 @@ const char *cmMakefile::GetProperty(const char* prop,
}
return output.c_str();
}
+ else if (!strcmp("COMPILE_DEFINITIONS",prop))
+ {
+ std::string sep;
+ for (std::vector<cmValueWithOrigin>::const_iterator
+ it = this->CompileDefinitionsEntries.begin(),
+ end = this->CompileDefinitionsEntries.end();
+ it != end; ++it)
+ {
+ output += sep;
+ output += it->Value;
+ sep = ";";
+ }
+ return output.c_str();
+ }
bool chain = false;
const char *retVal =
@@ -4046,8 +4087,7 @@ void cmMakefile::DefineProperties(cmake *cm)
"the options for the compiler.\n"
"Contents of COMPILE_OPTIONS may use \"generator expressions\" with "
"the syntax \"$<...>\". "
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("LINK_DIRECTORIES", cmProperty::DIRECTORY,
diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h
index 0822240..871fa1b 100644
--- a/Source/cmMakefile.h
+++ b/Source/cmMakefile.h
@@ -871,6 +871,10 @@ public:
{
return this->CompileOptionsEntries;
}
+ std::vector<cmValueWithOrigin> GetCompileDefinitionsEntries() const
+ {
+ return this->CompileDefinitionsEntries;
+ }
bool IsGeneratingBuildSystem(){ return this->GeneratingBuildSystem; }
void SetGeneratingBuildSystem(){ this->GeneratingBuildSystem = true; }
@@ -928,6 +932,7 @@ protected:
std::vector<cmValueWithOrigin> IncludeDirectoriesEntries;
std::vector<cmValueWithOrigin> CompileOptionsEntries;
+ std::vector<cmValueWithOrigin> CompileDefinitionsEntries;
// Track the value of the computed DEFINITIONS property.
void AddDefineFlag(const char*, std::string&);
diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx
index 271183e..e4219a9 100644
--- a/Source/cmMakefileExecutableTargetGenerator.cxx
+++ b/Source/cmMakefileExecutableTargetGenerator.cxx
@@ -365,22 +365,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink)
vars.TargetVersionMajor = targetVersionMajor.c_str();
vars.TargetVersionMinor = targetVersionMinor.c_str();
- if (const char *rootPath =
- this->Makefile->GetDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- flags += " ";
- flags += sysrootFlag;
- flags += this->LocalGenerator->EscapeForShell(rootPath);
- flags += " ";
- }
- }
- }
-
vars.LinkLibraries = linkLibs.c_str();
vars.Flags = flags.c_str();
vars.LinkFlags = linkFlags.c_str();
diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx
index 36d1a5a..347f26d 100644
--- a/Source/cmMakefileLibraryTargetGenerator.cxx
+++ b/Source/cmMakefileLibraryTargetGenerator.cxx
@@ -589,26 +589,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules
cmLocalGenerator::SHELL);
vars.ObjectDir = objdir.c_str();
vars.Target = targetOutPathReal.c_str();
-
- if(this->Target->GetType() == cmTarget::SHARED_LIBRARY)
- {
- if (const char *rootPath =
- this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- linkFlags += " ";
- linkFlags += sysrootFlag;
- linkFlags += this->LocalGenerator->EscapeForShell(rootPath);
- linkFlags += " ";
- }
- }
- }
- }
-
vars.LinkLibraries = linkLibs.c_str();
vars.ObjectsQuoted = buildObjs.c_str();
if (this->Target->HasSOName(this->ConfigName))
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx
index c9e4161..0829cab 100644
--- a/Source/cmMakefileTargetGenerator.cxx
+++ b/Source/cmMakefileTargetGenerator.cxx
@@ -309,9 +309,8 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l)
}
// Add preprocessor definitions for this target and configuration.
- this->LocalGenerator->AppendDefines
- (defines, this->Target->GetCompileDefinitions(
- this->LocalGenerator->ConfigurationName.c_str()));
+ this->LocalGenerator->AddCompileDefinitions(defines, this->Target,
+ this->LocalGenerator->ConfigurationName.c_str());
std::string definesString;
this->LocalGenerator->JoinDefines(defines, definesString, lang);
@@ -644,23 +643,6 @@ cmMakefileTargetGenerator
cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::SHELL);
vars.ObjectDir = objectDir.c_str();
-
- if (const char *rootPath =
- this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- flags += " ";
- flags += sysrootFlag;
- flags += this->LocalGenerator->EscapeForShell(rootPath);
- flags += " ";
- }
- }
- }
-
vars.Flags = flags.c_str();
std::string definesString = "$(";
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index 921ca92..57adeba 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -224,27 +224,7 @@ cmNinjaNormalTargetGenerator
vars.TargetVersionMajor = targetVersionMajor.c_str();
vars.TargetVersionMinor = targetVersionMinor.c_str();
-
- std::string flags = "$FLAGS";
-
- if (const char *rootPath =
- this->GetMakefile()->GetSafeDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->GetMakefile()->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- flags += " ";
- flags += sysrootFlag;
- flags += this->GetLocalGenerator()->EscapeForShell(rootPath);
- flags += " ";
- }
- }
- }
-
- vars.Flags = flags.c_str();
-
+ vars.Flags = "$FLAGS";
vars.LinkFlags = "$LINK_FLAGS";
std::string langFlags;
@@ -285,7 +265,8 @@ cmNinjaNormalTargetGenerator
rspcontent);
}
- if (this->TargetNameOut != this->TargetNameReal) {
+ if (this->TargetNameOut != this->TargetNameReal &&
+ !this->GetTarget()->IsFrameworkOnApple()) {
std::string cmakeCommand =
this->GetLocalGenerator()->ConvertToOutputFormat(
this->GetMakefile()->GetRequiredDefinition("CMAKE_COMMAND"),
@@ -619,7 +600,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
rspfile,
commandLineLengthLimit);
- if (targetOutput != targetOutputReal) {
+ if (targetOutput != targetOutputReal &&
+ !this->GetTarget()->IsFrameworkOnApple()) {
if (targetType == cmTarget::EXECUTABLE) {
globalGenerator->WriteBuild(this->GetBuildFileStream(),
"Create executable symlink " + targetOutput,
diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx
index b5ca78a..898aa0e 100644
--- a/Source/cmNinjaTargetGenerator.cxx
+++ b/Source/cmNinjaTargetGenerator.cxx
@@ -202,9 +202,8 @@ ComputeDefines(cmSourceFile *source, const std::string& language)
}
// Add preprocessor definitions for this target and configuration.
- this->LocalGenerator->AppendDefines
- (defines,
- this->Target->GetCompileDefinitions(this->GetConfigName()));
+ this->LocalGenerator->AddCompileDefinitions(defines, this->Target,
+ this->GetConfigName());
this->LocalGenerator->AppendDefines
(defines,
source->GetProperty("COMPILE_DEFINITIONS"));
@@ -385,23 +384,7 @@ cmNinjaTargetGenerator
cmSystemTools::ReplaceString(depFlagsStr, "<CMAKE_C_COMPILER>",
mf->GetDefinition("CMAKE_C_COMPILER"));
flags += " " + depFlagsStr;
-
- if (const char *rootPath =
- this->Makefile->GetSafeDefinition("CMAKE_SYSROOT"))
- {
- if (*rootPath)
- {
- if (const char *sysrootFlag =
- this->Makefile->GetDefinition("CMAKE_SYSROOT_FLAG"))
- {
- flags += " ";
- flags += sysrootFlag;
- flags += this->LocalGenerator->EscapeForShell(rootPath);
- flags += " ";
- }
- }
- }
- }
+ }
vars.Flags = flags.c_str();
diff --git a/Source/cmOrderDirectories.cxx b/Source/cmOrderDirectories.cxx
index 93885b2..0220825 100644
--- a/Source/cmOrderDirectories.cxx
+++ b/Source/cmOrderDirectories.cxx
@@ -40,9 +40,10 @@ public:
if(file.rfind(".framework") != std::string::npos)
{
cmsys::RegularExpression splitFramework;
- splitFramework.compile("^(.*)/(.*).framework/.*/(.*)$");
+ splitFramework.compile("^(.*)/(.*).framework/(.*)$");
if(splitFramework.find(file) &&
- (splitFramework.match(2) == splitFramework.match(3)))
+ (std::string::npos !=
+ splitFramework.match(3).find(splitFramework.match(2))))
{
this->Directory = splitFramework.match(1);
this->FileName =
@@ -318,7 +319,6 @@ void cmOrderDirectories::AddRuntimeLibrary(std::string const& fullPath,
// Add the runtime library at most once.
if(this->EmmittedConstraintSOName.insert(fullPath).second)
{
- std::string soname2 = soname ? soname : "";
// Implicit link directories need special handling.
if(!this->ImplicitDirectories.empty())
{
@@ -327,16 +327,12 @@ void cmOrderDirectories::AddRuntimeLibrary(std::string const& fullPath,
if(fullPath.rfind(".framework") != std::string::npos)
{
cmsys::RegularExpression splitFramework;
- splitFramework.compile("^(.*)/(.*).framework/(.*)/(.*)$");
+ splitFramework.compile("^(.*)/(.*).framework/(.*)$");
if(splitFramework.find(fullPath) &&
- (splitFramework.match(2) == splitFramework.match(4)))
+ (std::string::npos !=
+ splitFramework.match(3).find(splitFramework.match(2))))
{
dir = splitFramework.match(1);
- soname2 = splitFramework.match(2);
- soname2 += ".framework/";
- soname2 += splitFramework.match(3);
- soname2 += "/";
- soname2 += splitFramework.match(4);
}
}
@@ -344,16 +340,14 @@ void cmOrderDirectories::AddRuntimeLibrary(std::string const& fullPath,
this->ImplicitDirectories.end())
{
this->ImplicitDirEntries.push_back(
- new cmOrderDirectoriesConstraintSOName(this, fullPath,
- soname2.c_str()));
+ new cmOrderDirectoriesConstraintSOName(this, fullPath, soname));
return;
}
}
// Construct the runtime information entry for this library.
this->ConstraintEntries.push_back(
- new cmOrderDirectoriesConstraintSOName(this, fullPath,
- soname2.c_str()));
+ new cmOrderDirectoriesConstraintSOName(this, fullPath, soname));
}
else
{
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 32829a6..0ba673e 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -544,6 +544,63 @@ cmPolicies::cmPolicies()
"The NEW behavior for this policy is to issue a FATAL_ERROR if "
"INCLUDE_DIRECTORIES contains a relative path.",
2,8,11,20130516, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0022, "CMP0022",
+ "INTERFACE_LINK_LIBRARIES defines the link interface.",
+ "CMake 2.8.11 constructed the 'link interface' of a target from "
+ "properties matching (IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?. "
+ "The modern way to specify config-sensitive content is to use generator "
+ "expressions and the IMPORTED_ prefix makes uniform processing of the "
+ "link interface with generator expressions impossible. The "
+ "INTERFACE_LINK_LIBRARIES target property was introduced as a "
+ "replacement in CMake 2.8.12. This new property is named consistently "
+ "with the INTERFACE_COMPILE_DEFINITIONS, INTERFACE_INCLUDE_DIRECTORIES "
+ "and INTERFACE_COMPILE_OPTIONS properties. For in-build targets, CMake "
+ "will use the INTERFACE_LINK_LIBRARIES property as the source of the "
+ "link interface only if policy CMP0022 is NEW. "
+ "When exporting a target which has this policy set to NEW, only the "
+ "INTERFACE_LINK_LIBRARIES property will be processed and generated for "
+ "the IMPORTED target by default. A new option to the install(EXPORT) "
+ "and export commands allows export of the old-style properties for "
+ "compatibility with downstream users of CMake versions older than "
+ "2.8.12. "
+ "The target_link_libraries command will no longer populate the "
+ "properties matching LINK_INTERFACE_LIBRARIES(_<CONFIG>)? if this policy "
+ "is NEW."
+ "\n"
+ "The OLD behavior for this policy is to ignore the "
+ "INTERFACE_LINK_LIBRARIES property for in-build targets. "
+ "The NEW behavior for this policy is to use the INTERFACE_LINK_LIBRARIES "
+ "property for in-build targets, and ignore the old properties matching "
+ "(IMPORTED_)?LINK_INTERFACE_LIBRARIES(_<CONFIG>)?.",
+ 2,8,11,20130516, cmPolicies::WARN);
+
+ this->DefinePolicy(
+ CMP0023, "CMP0023",
+ "Plain and keyword target_link_libraries signatures cannot be mixed.",
+ "CMake 2.8.12 introduced the target_link_libraries signature using "
+ "the PUBLIC, PRIVATE, and INTERFACE keywords to generalize the "
+ "LINK_PUBLIC and LINK_PRIVATE keywords introduced in CMake 2.8.7. "
+ "Use of signatures with any of these keywords sets the link interface "
+ "of a target explicitly, even if empty. "
+ "This produces confusing behavior when used in combination with the "
+ "historical behavior of the plain target_link_libraries signature. "
+ "For example, consider the code:\n"
+ " target_link_libraries(mylib A)\n"
+ " target_link_libraries(mylib PRIVATE B)\n"
+ "After the first line the link interface has not been set explicitly "
+ "so CMake would use the link implementation, A, as the link interface. "
+ "However, the second line sets the link interface to empty. "
+ "In order to avoid this subtle behavior CMake now prefers to disallow "
+ "mixing the plain and keyword signatures of target_link_libraries for "
+ "a single target."
+ "\n"
+ "The OLD behavior for this policy is to allow keyword and plain "
+ "target_link_libraries signatures to be mixed. "
+ "The NEW behavior for this policy is to not to allow mixing of the "
+ "keyword and plain signatures.",
+ 2,8,11,20130724, cmPolicies::WARN);
}
cmPolicies::~cmPolicies()
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index a033e87..5b843a9 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -72,6 +72,8 @@ public:
CMP0020, ///< Automatically link Qt executables to qtmain target
CMP0021, ///< Fatal error on relative paths in INCLUDE_DIRECTORIES
/// target property
+ CMP0022, ///< INTERFACE_LINK_LIBRARIES defines the link interface
+ CMP0023, ///< Disallow mixing keyword and plain tll signatures
/** \brief Always the last entry.
*
diff --git a/Source/cmProjectCommand.h b/Source/cmProjectCommand.h
index a53cb3f..9547c4c 100644
--- a/Source/cmProjectCommand.h
+++ b/Source/cmProjectCommand.h
@@ -71,7 +71,13 @@ public:
"language \"NONE\" all checks for any language can be disabled. "
"If a variable exists called CMAKE_PROJECT_<projectName>_INCLUDE, "
"the file pointed to by that variable will be included as the last step "
- "of the project command.";
+ "of the project command."
+ "\n"
+ "The top-level CMakeLists.txt file for a project must contain a "
+ "literal, direct call to the project() command; loading one through "
+ "the include() command is not sufficient. "
+ "If no such call exists CMake will implicitly add one to the top that "
+ "enables the default languages (C and CXX).";
}
cmTypeMacro(cmProjectCommand, cmCommand);
diff --git a/Source/cmQtAutomoc.cxx b/Source/cmQtAutomoc.cxx
index 34b3c7e..93e39ab 100644
--- a/Source/cmQtAutomoc.cxx
+++ b/Source/cmQtAutomoc.cxx
@@ -175,15 +175,17 @@ static void GetCompileDefinitionsAndDirectories(cmTarget *target,
incs += *incDirIt;
}
- defs = target->GetCompileDefinitions(config);
+ std::set<std::string> defines;
+ localGen->AddCompileDefinitions(defines, target, config);
- const char *tmp = makefile->GetProperty("COMPILE_DEFINITIONS");
sep = "";
- if (tmp)
+ for(std::set<std::string>::const_iterator defIt = defines.begin();
+ defIt != defines.end();
+ ++defIt)
{
defs += sep;
sep = ";";
- defs += tmp;
+ defs += *defIt;
}
}
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index cc10840..b5e5225 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -84,12 +84,14 @@ bool cmSetPropertyCommand
{
doing = DoingNone;
this->AppendMode = true;
+ this->Remove = false;
this->AppendAsString = false;
}
else if(*arg == "APPEND_STRING")
{
doing = DoingNone;
this->AppendMode = true;
+ this->Remove = false;
this->AppendAsString = true;
}
else if(doing == DoingNames)
@@ -160,7 +162,7 @@ bool cmSetPropertyCommand::HandleGlobalMode()
}
if(this->AppendMode)
{
- cm->AppendProperty(name, value, this->AppendAsString);
+ cm->AppendProperty(name, value ? value : "", this->AppendAsString);
}
else
{
@@ -226,7 +228,7 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
}
if(this->AppendMode)
{
- mf->AppendProperty(name, value, this->AppendAsString);
+ mf->AppendProperty(name, value ? value : "", this->AppendAsString);
}
else
{
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx
index aa5fc94..c52c266 100644
--- a/Source/cmSystemTools.cxx
+++ b/Source/cmSystemTools.cxx
@@ -1696,6 +1696,7 @@ cmSystemTools::SaveRestoreEnvironment::~SaveRestoreEnvironment()
void cmSystemTools::EnableVSConsoleOutput()
{
+#ifdef _WIN32
// Visual Studio 8 2005 (devenv.exe or VCExpress.exe) will not
// display output to the console unless this environment variable is
// set. We need it to capture the output of these build tools.
@@ -1703,8 +1704,15 @@ void cmSystemTools::EnableVSConsoleOutput()
// either of these executables where NAME is created with
// CreateNamedPipe. This would bypass the internal buffering of the
// output and allow it to be captured on the fly.
-#ifdef _WIN32
cmSystemTools::PutEnv("vsconsoleoutput=1");
+
+# ifdef CMAKE_BUILD_WITH_CMAKE
+ // VS sets an environment variable to tell MS tools like "cl" to report
+ // output through a backdoor pipe instead of stdout/stderr. Unset the
+ // environment variable to close this backdoor for any path of process
+ // invocations that passes through CMake so we can capture the output.
+ cmSystemTools::UnsetEnv("VS_UNICODE_OUTPUT");
+# endif
#endif
}
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 8d4d51b..b9dc423 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -141,13 +141,15 @@ public:
};
std::vector<TargetPropertyEntry*> IncludeDirectoriesEntries;
std::vector<TargetPropertyEntry*> CompileOptionsEntries;
+ std::vector<TargetPropertyEntry*> CompileDefinitionsEntries;
std::vector<cmValueWithOrigin> LinkInterfacePropertyEntries;
std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceIncludeDirectoriesEntries;
std::map<std::string, std::vector<TargetPropertyEntry*> >
CachedLinkInterfaceCompileOptionsEntries;
- std::map<std::string, std::string> CachedLinkInterfaceCompileDefinitions;
+ std::map<std::string, std::vector<TargetPropertyEntry*> >
+ CachedLinkInterfaceCompileDefinitionsEntries;
std::map<std::string, bool> CacheLinkInterfaceIncludeDirectoriesDone;
std::map<std::string, bool> CacheLinkInterfaceCompileDefinitionsDone;
@@ -186,17 +188,20 @@ cmTargetInternals::~cmTargetInternals()
{
deleteAndClear(this->CachedLinkInterfaceIncludeDirectoriesEntries);
deleteAndClear(this->CachedLinkInterfaceCompileOptionsEntries);
+ deleteAndClear(this->CachedLinkInterfaceCompileDefinitionsEntries);
}
//----------------------------------------------------------------------------
cmTarget::cmTarget()
{
+#define INITIALIZE_TARGET_POLICY_MEMBER(POLICY) \
+ this->PolicyStatus ## POLICY = cmPolicies::WARN;
+
+ CM_FOR_EACH_TARGET_POLICY(INITIALIZE_TARGET_POLICY_MEMBER)
+
+#undef INITIALIZE_TARGET_POLICY_MEMBER
+
this->Makefile = 0;
- this->PolicyStatusCMP0003 = cmPolicies::WARN;
- this->PolicyStatusCMP0004 = cmPolicies::WARN;
- this->PolicyStatusCMP0008 = cmPolicies::WARN;
- this->PolicyStatusCMP0020 = cmPolicies::WARN;
- this->PolicyStatusCMP0021 = cmPolicies::WARN;
this->LinkLibrariesAnalyzed = false;
this->HaveInstallRule = false;
this->DLLPlatform = false;
@@ -205,6 +210,7 @@ cmTarget::cmTarget()
this->BuildInterfaceIncludesAppended = false;
this->DebugIncludesDone = false;
this->DebugCompileOptionsDone = false;
+ this->DebugCompileDefinitionsDone = false;
}
//----------------------------------------------------------------------------
@@ -286,7 +292,6 @@ void cmTarget::DefineProperties(cmake *cm)
"Contents of COMPILE_DEFINITIONS may use \"generator expressions\" with "
"the syntax \"$<...>\". "
CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS
CM_DOCUMENT_COMPILE_DEFINITIONS_DISCLAIMER);
cm->DefineProperty
@@ -305,8 +310,7 @@ void cmTarget::DefineProperties(cmake *cm)
"the options for the compiler.\n"
"Contents of COMPILE_OPTIONS may use \"generator expressions\" with "
"the syntax \"$<...>\". "
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INTERFACE_COMPILE_OPTIONS", cmProperty::TARGET,
@@ -317,8 +321,7 @@ void cmTarget::DefineProperties(cmake *cm)
"as $<TARGET_PROPERTY:foo,INTERFACE_COMPILE_OPTIONS> to use the "
"compile options specified in the interface of 'foo'."
"\n"
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("DEFINE_SYMBOL", cmProperty::TARGET,
@@ -474,7 +477,7 @@ void cmTarget::DefineProperties(cmake *cm)
"imported library. "
"The list "
"should be disjoint from the list of interface libraries in the "
- "IMPORTED_LINK_INTERFACE_LIBRARIES property. On platforms requiring "
+ "INTERFACE_LINK_LIBRARIES property. On platforms requiring "
"dependent shared libraries to be found at link time CMake uses this "
"list to add appropriate files or paths to the link command line. "
"Ignored for non-imported targets.");
@@ -495,7 +498,10 @@ void cmTarget::DefineProperties(cmake *cm)
"The libraries will be included on the link line for the target. "
"Unlike the LINK_INTERFACE_LIBRARIES property, this property applies "
"to all imported target types, including STATIC libraries. "
- "This property is ignored for non-imported targets.");
+ "This property is ignored for non-imported targets.\n"
+ "This property is ignored if the target also has a non-empty "
+ "INTERFACE_LINK_LIBRARIES property.\n"
+ "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.");
cm->DefineProperty
("IMPORTED_LINK_INTERFACE_LIBRARIES_<CONFIG>", cmProperty::TARGET,
@@ -503,7 +509,10 @@ void cmTarget::DefineProperties(cmake *cm)
"Configuration names correspond to those provided by the project "
"from which the target is imported. "
"If set, this property completely overrides the generic property "
- "for the named configuration.");
+ "for the named configuration.\n"
+ "This property is ignored if the target also has a non-empty "
+ "INTERFACE_LINK_LIBRARIES property.\n"
+ "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.");
cm->DefineProperty
("IMPORTED_LINK_INTERFACE_LANGUAGES", cmProperty::TARGET,
@@ -641,8 +650,7 @@ void cmTarget::DefineProperties(cmake *cm)
"See also the include_directories command.\n"
"Contents of INCLUDE_DIRECTORIES may use \"generator expressions\" with "
"the syntax \"$<...>\". "
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INSTALL_NAME_DIR", cmProperty::TARGET,
@@ -737,7 +745,11 @@ void cmTarget::DefineProperties(cmake *cm)
"file providing the program entry point (main). "
"If not set, the language with the highest linker preference "
"value is the default. "
- "See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables.");
+ "See documentation of CMAKE_<LANG>_LINKER_PREFERENCE variables."
+ "\n"
+ "If this property is not set by the user, it will be calculated at "
+ "generate-time by CMake."
+ );
cm->DefineProperty
("LOCATION", cmProperty::TARGET,
@@ -820,7 +832,10 @@ void cmTarget::DefineProperties(cmake *cm)
"This property is initialized by the value of the variable "
"CMAKE_LINK_INTERFACE_LIBRARIES if it is set when a target is "
"created. "
- "This property is ignored for STATIC libraries.");
+ "This property is ignored for STATIC libraries.\n"
+ "This property is overriden by the INTERFACE_LINK_LIBRARIES property if "
+ "policy CMP0022 is NEW.\n"
+ "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.");
cm->DefineProperty
("LINK_INTERFACE_LIBRARIES_<CONFIG>", cmProperty::TARGET,
@@ -828,7 +843,23 @@ void cmTarget::DefineProperties(cmake *cm)
"This is the configuration-specific version of "
"LINK_INTERFACE_LIBRARIES. "
"If set, this property completely overrides the generic property "
- "for the named configuration.");
+ "for the named configuration.\n"
+ "This property is overriden by the INTERFACE_LINK_LIBRARIES property if "
+ "policy CMP0022 is NEW.\n"
+ "This property is deprecated. Use INTERFACE_LINK_LIBRARIES instead.");
+
+ cm->DefineProperty
+ ("INTERFACE_LINK_LIBRARIES", cmProperty::TARGET,
+ "List public interface libraries for a shared library or executable.",
+ "This property contains the list of transitive link dependencies. "
+ "When the target is linked into another target the libraries "
+ "listed (and recursively their link interface libraries) will be "
+ "provided to the other target also. "
+ "This property is overriden by the LINK_INTERFACE_LIBRARIES or "
+ "LINK_INTERFACE_LIBRARIES_<CONFIG> property if "
+ "policy CMP0022 is OLD or unset.\n"
+ "\n"
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INTERFACE_INCLUDE_DIRECTORIES", cmProperty::TARGET,
@@ -839,8 +870,7 @@ void cmTarget::DefineProperties(cmake *cm)
"as $<TARGET_PROPERTY:foo,INTERFACE_INCLUDE_DIRECTORIES> to use the "
"include directories specified in the interface of 'foo'."
"\n"
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INTERFACE_SYSTEM_INCLUDE_DIRECTORIES", cmProperty::TARGET,
@@ -850,8 +880,7 @@ void cmTarget::DefineProperties(cmake *cm)
"compiler warnings. Consuming targets will then mark the same include "
"directories as system headers."
"\n"
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("INTERFACE_COMPILE_DEFINITIONS", cmProperty::TARGET,
@@ -862,8 +891,7 @@ void cmTarget::DefineProperties(cmake *cm)
"as $<TARGET_PROPERTY:foo,INTERFACE_COMPILE_DEFINITIONS> to use the "
"compile definitions specified in the interface of 'foo'."
"\n"
- CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS);
+ CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS);
cm->DefineProperty
("LINK_INTERFACE_MULTIPLICITY", cmProperty::TARGET,
@@ -1690,16 +1718,13 @@ void cmTarget::SetMakefile(cmMakefile* mf)
this->SetPropertyDefault("POSITION_INDEPENDENT_CODE", 0);
// Record current policies for later use.
- this->PolicyStatusCMP0003 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0003);
- this->PolicyStatusCMP0004 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0004);
- this->PolicyStatusCMP0008 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0008);
- this->PolicyStatusCMP0020 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0020);
- this->PolicyStatusCMP0021 =
- this->Makefile->GetPolicyStatus(cmPolicies::CMP0021);
+#define CAPTURE_TARGET_POLICY(POLICY) \
+ this->PolicyStatus ## POLICY = \
+ this->Makefile->GetPolicyStatus(cmPolicies::POLICY);
+
+ CM_FOR_EACH_TARGET_POLICY(CAPTURE_TARGET_POLICY)
+
+#undef CAPTURE_TARGET_POLICY
}
//----------------------------------------------------------------------------
@@ -1811,8 +1836,7 @@ bool cmTarget::IsBundleOnApple()
class cmTargetTraceDependencies
{
public:
- cmTargetTraceDependencies(cmTarget* target, cmTargetInternals* internal,
- const char* vsProjectFile);
+ cmTargetTraceDependencies(cmTarget* target, cmTargetInternals* internal);
void Trace();
private:
cmTarget* Target;
@@ -1836,8 +1860,7 @@ private:
//----------------------------------------------------------------------------
cmTargetTraceDependencies
-::cmTargetTraceDependencies(cmTarget* target, cmTargetInternals* internal,
- const char* vsProjectFile):
+::cmTargetTraceDependencies(cmTarget* target, cmTargetInternals* internal):
Target(target), Internal(internal)
{
// Convenience.
@@ -1854,13 +1877,6 @@ cmTargetTraceDependencies
this->QueueSource(*si);
}
- // Queue the VS project file to check dependencies on the rule to
- // generate it.
- if(vsProjectFile)
- {
- this->FollowName(vsProjectFile);
- }
-
// Queue pre-build, pre-link, and post-build rule dependencies.
this->CheckCustomCommands(this->Target->GetPreBuildCommands());
this->CheckCustomCommands(this->Target->GetPreLinkCommands());
@@ -2079,7 +2095,7 @@ cmTargetTraceDependencies
}
//----------------------------------------------------------------------------
-void cmTarget::TraceDependencies(const char* vsProjectFile)
+void cmTarget::TraceDependencies()
{
// CMake-generated targets have no dependencies to trace. Normally tracing
// would find nothing anyway, but when building CMake itself the "install"
@@ -2091,7 +2107,7 @@ void cmTarget::TraceDependencies(const char* vsProjectFile)
}
// Use a helper object to trace the dependencies.
- cmTargetTraceDependencies tracer(this, this->Internal.Get(), vsProjectFile);
+ cmTargetTraceDependencies tracer(this, this->Internal.Get());
tracer.Trace();
}
@@ -2315,6 +2331,14 @@ void cmTarget::MergeLinkLibraries( cmMakefile& mf,
{
// We call this so that the dependencies get written to the cache
this->AddLinkLibrary( mf, selfname, i->first.c_str(), i->second );
+
+ if (this->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ this->AppendProperty("INTERFACE_LINK_LIBRARIES",
+ ("$<LINK_ONLY:" +
+ this->GetDebugGeneratorExpressions(i->first.c_str(), i->second) +
+ ">").c_str());
+ }
}
this->PrevLinkedLibraries = libs;
}
@@ -2470,6 +2494,57 @@ static std::string targetNameGenex(const char *lib)
}
//----------------------------------------------------------------------------
+bool cmTarget::PushTLLCommandTrace(TLLSignature signature)
+{
+ bool ret = true;
+ if (!this->TLLCommands.empty())
+ {
+ if (this->TLLCommands.back().first != signature)
+ {
+ ret = false;
+ }
+ }
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ this->TLLCommands.push_back(std::make_pair(signature, lfbt));
+ return ret;
+}
+
+//----------------------------------------------------------------------------
+void cmTarget::GetTllSignatureTraces(cmOStringStream &s,
+ TLLSignature sig) const
+{
+ std::vector<cmListFileBacktrace> sigs;
+ typedef std::vector<std::pair<TLLSignature, cmListFileBacktrace> > Container;
+ for(Container::const_iterator it = this->TLLCommands.begin();
+ it != this->TLLCommands.end(); ++it)
+ {
+ if (it->first == sig)
+ {
+ sigs.push_back(it->second);
+ }
+ }
+ if (!sigs.empty())
+ {
+ const char *sigString
+ = (sig == cmTarget::KeywordTLLSignature ? "keyword"
+ : "plain");
+ s << "The uses of the " << sigString << " signature are here:\n";
+ for(std::vector<cmListFileBacktrace>::const_iterator it = sigs.begin();
+ it != sigs.end(); ++it)
+ {
+ cmListFileBacktrace::const_iterator i = it->begin();
+ if(i != it->end())
+ {
+ cmListFileContext const& lfc = *i;
+ s << " * " << (lfc.Line? "": " in ") << lfc << std::endl;
+ ++i;
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
void cmTarget::AddLinkLibrary(cmMakefile& mf,
const char *target, const char* lib,
LinkLibraryType llt)
@@ -2922,6 +2997,17 @@ void cmTarget::SetProperty(const char* prop, const char* value)
new cmTargetInternals::TargetPropertyEntry(cge));
return;
}
+ if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
+ {
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmGeneratorExpression ge(lfbt);
+ deleteAndClear(this->Internal->CompileDefinitionsEntries);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(value);
+ this->Internal->CompileDefinitionsEntries.push_back(
+ new cmTargetInternals::TargetPropertyEntry(cge));
+ return;
+ }
if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
{
cmOStringStream e;
@@ -2973,6 +3059,15 @@ void cmTarget::AppendProperty(const char* prop, const char* value,
new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
return;
}
+ if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
+ {
+ cmListFileBacktrace lfbt;
+ this->Makefile->GetBacktrace(lfbt);
+ cmGeneratorExpression ge(lfbt);
+ this->Internal->CompileDefinitionsEntries.push_back(
+ new cmTargetInternals::TargetPropertyEntry(ge.Parse(value)));
+ return;
+ }
if(strcmp(prop,"EXPORT_NAME") == 0 && this->IsImported())
{
cmOStringStream e;
@@ -3077,6 +3172,20 @@ void cmTarget::InsertCompileOption(const cmValueWithOrigin &entry,
}
//----------------------------------------------------------------------------
+void cmTarget::InsertCompileDefinition(const cmValueWithOrigin &entry,
+ bool before)
+{
+ cmGeneratorExpression ge(entry.Backtrace);
+
+ std::vector<cmTargetInternals::TargetPropertyEntry*>::iterator position
+ = before ? this->Internal->CompileDefinitionsEntries.begin()
+ : this->Internal->CompileDefinitionsEntries.end();
+
+ this->Internal->CompileDefinitionsEntries.insert(position,
+ new cmTargetInternals::TargetPropertyEntry(ge.Parse(entry.Value)));
+}
+
+//----------------------------------------------------------------------------
static void processIncludeDirectories(cmTarget *tgt,
const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
std::vector<std::string> &includes,
@@ -3145,7 +3254,7 @@ static void processIncludeDirectories(cmTarget *tgt,
{
e << "Target \"" << (*it)->TargetName << "\" contains relative "
"path in its INTERFACE_INCLUDE_DIRECTORIES:\n"
- " \"" << *li << "\" ";
+ " \"" << *li << "\"";
}
else
{
@@ -3283,6 +3392,34 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
new cmTargetInternals::TargetPropertyEntry(cge,
it->Value));
}
+
+ if(this->Makefile->IsOn("APPLE"))
+ {
+ LinkImplementation const* impl = this->GetLinkImplementation(config,
+ this);
+ for(std::vector<std::string>::const_iterator
+ it = impl->Libraries.begin();
+ it != impl->Libraries.end(); ++it)
+ {
+ std::string libDir = cmSystemTools::CollapseFullPath(it->c_str());
+
+ static cmsys::RegularExpression
+ frameworkCheck("(.*\\.framework)(/Versions/[^/]+)?/[^/]+$");
+ if(!frameworkCheck.find(libDir))
+ {
+ continue;
+ }
+
+ libDir = frameworkCheck.match(1);
+
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(libDir.c_str());
+ this->Internal
+ ->CachedLinkInterfaceIncludeDirectoriesEntries[configString]
+ .push_back(new cmTargetInternals::TargetPropertyEntry(cge));
+ }
+ }
}
processIncludeDirectories(this,
@@ -3308,12 +3445,12 @@ std::vector<std::string> cmTarget::GetIncludeDirectories(const char *config)
}
//----------------------------------------------------------------------------
-static void processCompileOptions(cmTarget *tgt,
+static void processCompileOptionsInternal(cmTarget *tgt,
const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
std::vector<std::string> &options,
std::set<std::string> &uniqueOptions,
cmGeneratorExpressionDAGChecker *dagChecker,
- const char *config, bool debugOptions)
+ const char *config, bool debugOptions, const char *logName)
{
cmMakefile *mf = tgt->GetMakefile();
@@ -3358,7 +3495,8 @@ static void processCompileOptions(cmTarget *tgt,
if (!usedOptions.empty())
{
mf->GetCMakeInstance()->IssueMessage(cmake::LOG,
- std::string("Used compile options for target ")
+ std::string("Used compile ") + logName
+ + std::string(" for target ")
+ tgt->GetName() + ":\n"
+ usedOptions, (*it)->ge->GetBacktrace());
}
@@ -3366,6 +3504,18 @@ static void processCompileOptions(cmTarget *tgt,
}
//----------------------------------------------------------------------------
+static void processCompileOptions(cmTarget *tgt,
+ const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &options,
+ std::set<std::string> &uniqueOptions,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const char *config, bool debugOptions)
+{
+ processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
+ dagChecker, config, debugOptions, "options");
+}
+
+//----------------------------------------------------------------------------
void cmTarget::GetCompileOptions(std::vector<std::string> &result,
const char *config)
{
@@ -3461,90 +3611,128 @@ void cmTarget::GetCompileOptions(std::vector<std::string> &result,
}
//----------------------------------------------------------------------------
-std::string cmTarget::GetCompileDefinitions(const char *config)
+static void processCompileDefinitions(cmTarget *tgt,
+ const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries,
+ std::vector<std::string> &options,
+ std::set<std::string> &uniqueOptions,
+ cmGeneratorExpressionDAGChecker *dagChecker,
+ const char *config, bool debugOptions)
{
- const char *configProp = 0;
- if (config)
- {
- std::string configPropName;
- configPropName = "COMPILE_DEFINITIONS_" + cmSystemTools::UpperCase(config);
- configProp = this->GetProperty(configPropName.c_str());
- }
+ processCompileOptionsInternal(tgt, entries, options, uniqueOptions,
+ dagChecker, config, debugOptions,
+ "definitions");
+}
- const char *noconfigProp = this->GetProperty("COMPILE_DEFINITIONS");
+//----------------------------------------------------------------------------
+void cmTarget::GetCompileDefinitions(std::vector<std::string> &list,
+ const char *config)
+{
+ std::set<std::string> uniqueOptions;
cmListFileBacktrace lfbt;
+
cmGeneratorExpressionDAGChecker dagChecker(lfbt,
- this->GetName(),
- "COMPILE_DEFINITIONS", 0, 0);
+ this->GetName(),
+ "COMPILE_DEFINITIONS", 0, 0);
- std::string defsString = (noconfigProp ? noconfigProp : "");
- if (configProp && noconfigProp)
+ std::vector<std::string> debugProperties;
+ const char *debugProp =
+ this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
+ if (debugProp)
{
- defsString += ";";
+ cmSystemTools::ExpandListArgument(debugProp, debugProperties);
}
- defsString += (configProp ? configProp : "");
-
- cmGeneratorExpression ge(lfbt);
- std::string result = ge.Parse(defsString.c_str())->Evaluate(this->Makefile,
- config,
- false,
- this,
- &dagChecker);
- std::vector<std::string> libs;
- this->GetDirectLinkLibraries(config, libs, this);
+ bool debugDefines = !this->DebugCompileDefinitionsDone
+ && std::find(debugProperties.begin(),
+ debugProperties.end(),
+ "COMPILE_DEFINITIONS")
+ != debugProperties.end();
- if (libs.empty())
+ if (this->Makefile->IsGeneratingBuildSystem())
{
- return result;
+ this->DebugCompileDefinitionsDone = true;
}
- std::string sep;
- std::string depString;
- for (std::vector<std::string>::const_iterator it = libs.begin();
- it != libs.end(); ++it)
- {
- if ((cmGeneratorExpression::IsValidTargetName(it->c_str())
- || cmGeneratorExpression::Find(it->c_str()) != std::string::npos)
- && this->Makefile->FindTargetToUse(it->c_str()))
- {
- depString += sep + "$<TARGET_PROPERTY:"
- + *it + ",INTERFACE_COMPILE_DEFINITIONS>";
- sep = ";";
- }
- }
+ processCompileDefinitions(this,
+ this->Internal->CompileDefinitionsEntries,
+ list,
+ uniqueOptions,
+ &dagChecker,
+ config,
+ debugDefines);
std::string configString = config ? config : "";
if (!this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString])
{
- cmGeneratorExpression ge2(lfbt);
- cmsys::auto_ptr<cmCompiledGeneratorExpression> cge2 =
- ge2.Parse(depString);
- this->Internal->CachedLinkInterfaceCompileDefinitions[configString] =
- cge2->Evaluate(this->Makefile,
- config,
- false,
- this,
- &dagChecker);
- }
- if (!this->Internal->CachedLinkInterfaceCompileDefinitions[configString]
- .empty())
- {
- result += (result.empty() ? "" : ";")
- + this->Internal->CachedLinkInterfaceCompileDefinitions[configString];
+ for (std::vector<cmValueWithOrigin>::const_iterator
+ it = this->Internal->LinkInterfacePropertyEntries.begin(),
+ end = this->Internal->LinkInterfacePropertyEntries.end();
+ it != end; ++it)
+ {
+ {
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(it->Value);
+ std::string targetResult = cge->Evaluate(this->Makefile, config,
+ false, this, 0, 0);
+ if (!this->Makefile->FindTargetToUse(targetResult.c_str()))
+ {
+ continue;
+ }
+ }
+ std::string defsGenex = "$<TARGET_PROPERTY:" +
+ it->Value + ",INTERFACE_COMPILE_DEFINITIONS>";
+ if (cmGeneratorExpression::Find(it->Value) != std::string::npos)
+ {
+ // Because it->Value is a generator expression, ensure that it
+ // evaluates to the non-empty string before being used in the
+ // TARGET_PROPERTY expression.
+ defsGenex = "$<$<BOOL:" + it->Value + ">:" + defsGenex + ">";
+ }
+ cmGeneratorExpression ge(it->Backtrace);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(
+ defsGenex);
+
+ this->Internal
+ ->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back(
+ new cmTargetInternals::TargetPropertyEntry(cge,
+ it->Value));
+ }
+ if (config)
+ {
+ std::string configPropName = "COMPILE_DEFINITIONS_"
+ + cmSystemTools::UpperCase(config);
+ const char *configProp = this->GetProperty(configPropName.c_str());
+ std::string defsString = (configProp ? configProp : "");
+
+ cmGeneratorExpression ge(lfbt);
+ cmsys::auto_ptr<cmCompiledGeneratorExpression> cge =
+ ge.Parse(defsString);
+ this->Internal
+ ->CachedLinkInterfaceCompileDefinitionsEntries[configString].push_back(
+ new cmTargetInternals::TargetPropertyEntry(cge));
+ }
+
}
+ processCompileDefinitions(this,
+ this->Internal->CachedLinkInterfaceCompileDefinitionsEntries[configString],
+ list,
+ uniqueOptions,
+ &dagChecker,
+ config,
+ debugDefines);
+
if (!this->Makefile->IsGeneratingBuildSystem())
{
- this->Internal->CachedLinkInterfaceCompileDefinitions[configString] = "";
+ deleteAndClear(this->Internal
+ ->CachedLinkInterfaceCompileDefinitionsEntries);
}
else
{
this->Internal->CacheLinkInterfaceCompileDefinitionsDone[configString]
= true;
}
-
- return result;
}
//----------------------------------------------------------------------------
@@ -3605,6 +3793,29 @@ static void cmTargetCheckLINK_INTERFACE_LIBRARIES(
}
//----------------------------------------------------------------------------
+static void cmTargetCheckINTERFACE_LINK_LIBRARIES(const char* value,
+ cmMakefile* context)
+{
+ // Look for link-type keywords in the value.
+ static cmsys::RegularExpression
+ keys("(^|;)(debug|optimized|general)(;|$)");
+ if(!keys.find(value))
+ {
+ return;
+ }
+
+ // Report an error.
+ cmOStringStream e;
+
+ e << "Property INTERFACE_LINK_LIBRARIES may not contain link-type "
+ "keyword \"" << keys.match(2) << "\". The INTERFACE_LINK_LIBRARIES "
+ "property may contain configuration-sensitive generator-expressions "
+ "which may be used to specify per-configuration rules.";
+
+ context->IssueMessage(cmake::FATAL_ERROR, e.str());
+}
+
+//----------------------------------------------------------------------------
void cmTarget::CheckProperty(const char* prop, cmMakefile* context)
{
// Certain properties need checking.
@@ -3622,6 +3833,13 @@ void cmTarget::CheckProperty(const char* prop, cmMakefile* context)
cmTargetCheckLINK_INTERFACE_LIBRARIES(prop, value, context, true);
}
}
+ if(strncmp(prop, "INTERFACE_LINK_LIBRARIES", 24) == 0)
+ {
+ if(const char* value = this->GetProperty(prop))
+ {
+ cmTargetCheckINTERFACE_LINK_LIBRARIES(value, context);
+ }
+ }
}
//----------------------------------------------------------------------------
@@ -3916,6 +4134,24 @@ const char *cmTarget::GetProperty(const char* prop,
}
return output.c_str();
}
+ if(strcmp(prop,"COMPILE_DEFINITIONS") == 0)
+ {
+ static std::string output;
+ output = "";
+ std::string sep;
+ typedef cmTargetInternals::TargetPropertyEntry
+ TargetPropertyEntry;
+ for (std::vector<TargetPropertyEntry*>::const_iterator
+ it = this->Internal->CompileDefinitionsEntries.begin(),
+ end = this->Internal->CompileDefinitionsEntries.end();
+ it != end; ++it)
+ {
+ output += sep;
+ output += (*it)->ge->GetInput();
+ sep = ";";
+ }
+ return output.c_str();
+ }
if (strcmp(prop,"IMPORTED") == 0)
{
@@ -5957,11 +6193,16 @@ void cmTarget::ComputeImportInfo(std::string const& desired_config,
// Get the link interface.
{
- std::string linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
- linkProp += suffix;
-
+ std::string linkProp = "INTERFACE_LINK_LIBRARIES";
const char *propertyLibs = this->GetProperty(linkProp.c_str());
+ if (!propertyLibs)
+ {
+ linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
+ linkProp += suffix;
+ propertyLibs = this->GetProperty(linkProp.c_str());
+ }
+
if(!propertyLibs)
{
linkProp = "IMPORTED_LINK_INTERFACE_LIBRARIES";
@@ -6079,6 +6320,48 @@ cmTarget::LinkInterface const* cmTarget::GetLinkInterface(const char* config,
}
//----------------------------------------------------------------------------
+void cmTarget::GetTransitivePropertyLinkLibraries(
+ const char* config,
+ cmTarget *headTarget,
+ std::vector<std::string> &libs)
+{
+ cmTarget::LinkInterface const* iface = this->GetLinkInterface(config,
+ headTarget);
+ if (!iface)
+ {
+ return;
+ }
+ if(this->GetType() != STATIC_LIBRARY
+ || this->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ {
+ libs = iface->Libraries;
+ return;
+ }
+
+ const char* linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ const char* interfaceLibs = this->GetProperty(linkIfaceProp);
+
+ if (!interfaceLibs)
+ {
+ return;
+ }
+
+ // The interface libraries have been explicitly set.
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
+ linkIfaceProp, 0, 0);
+ dagChecker.SetTransitivePropertiesOnly();
+ cmSystemTools::ExpandListArgument(ge.Parse(interfaceLibs)->Evaluate(
+ this->Makefile,
+ config,
+ false,
+ headTarget,
+ this, &dagChecker), libs);
+}
+
+//----------------------------------------------------------------------------
bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
cmTarget *headTarget)
{
@@ -6096,6 +6379,8 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
// An explicit list of interface libraries may be set for shared
// libraries and executables that export symbols.
const char* explicitLibraries = 0;
+ const char* newExplicitLibraries =
+ this->GetProperty("INTERFACE_LINK_LIBRARIES");
std::string linkIfaceProp;
if(this->GetType() == cmTarget::SHARED_LIBRARY ||
this->IsExecutableWithExports())
@@ -6111,6 +6396,81 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
linkIfaceProp = "LINK_INTERFACE_LIBRARIES";
explicitLibraries = this->GetProperty(linkIfaceProp.c_str());
}
+ if (newExplicitLibraries
+ && (!explicitLibraries ||
+ (explicitLibraries
+ && strcmp(newExplicitLibraries, explicitLibraries) != 0)))
+ {
+ switch(this->GetPolicyStatusCMP0022())
+ {
+ case cmPolicies::WARN:
+ {
+ cmOStringStream w;
+ w << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
+ << "Target \"" << this->GetName() << "\" has a "
+ "INTERFACE_LINK_LIBRARIES property which differs from its "
+ << linkIfaceProp << " properties.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ // Fall through
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ explicitLibraries = newExplicitLibraries;
+ linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ break;
+ }
+ }
+ }
+ else if(this->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ if (newExplicitLibraries)
+ {
+ cmListFileBacktrace lfbt;
+ cmGeneratorExpression ge(lfbt);
+ cmGeneratorExpressionDAGChecker dagChecker(lfbt, this->GetName(),
+ "INTERFACE_LINK_LIBRARIES", 0, 0);
+ std::vector<std::string> ifaceLibs;
+ cmSystemTools::ExpandListArgument(
+ ge.Parse(newExplicitLibraries)->Evaluate(
+ this->Makefile,
+ config,
+ false,
+ headTarget,
+ this, &dagChecker), ifaceLibs);
+ LinkImplementation const* impl = this->GetLinkImplementation(config,
+ headTarget);
+ if (ifaceLibs != impl->Libraries)
+ {
+ switch(this->GetPolicyStatusCMP0022())
+ {
+ case cmPolicies::WARN:
+ {
+ cmOStringStream w;
+ w << (this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0022)) << "\n"
+ << "Static library target \"" << this->GetName() << "\" has a "
+ "INTERFACE_LINK_LIBRARIES property. This should be preferred "
+ "as the source of the link interface for this library. "
+ "Ignoring the property and using the link implementation "
+ "as the link interface instead.";
+ this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str());
+ }
+ // Fall through
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::NEW:
+ explicitLibraries = newExplicitLibraries;
+ linkIfaceProp = "INTERFACE_LINK_LIBRARIES";
+ break;
+ }
+ }
+ }
}
// There is no implicit link interface for executables or modules
@@ -6174,7 +6534,11 @@ bool cmTarget::ComputeLinkInterface(const char* config, LinkInterface& iface,
}
}
}
- else
+ else if (this->GetPolicyStatusCMP0022() == cmPolicies::WARN
+ || this->GetPolicyStatusCMP0022() == cmPolicies::OLD)
+ // The implementation shouldn't be the interface if CMP0022 is NEW. That
+ // way, the LINK_LIBRARIES property can be set directly without having to
+ // empty the INTERFACE_LINK_LIBRARIES
{
// The link implementation is the default link interface.
LinkImplementation const* impl = this->GetLinkImplementation(config,
@@ -6641,6 +7005,7 @@ cmTargetInternalPointer::~cmTargetInternalPointer()
{
deleteAndClear(this->Pointer->IncludeDirectoriesEntries);
deleteAndClear(this->Pointer->CompileOptionsEntries);
+ deleteAndClear(this->Pointer->CompileDefinitionsEntries);
delete this->Pointer;
}
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 09cddaf..24a71ed 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -19,6 +19,14 @@
#include <cmsys/auto_ptr.hxx>
+#define CM_FOR_EACH_TARGET_POLICY(F) \
+ F(CMP0003) \
+ F(CMP0004) \
+ F(CMP0008) \
+ F(CMP0020) \
+ F(CMP0021) \
+ F(CMP0022)
+
class cmake;
class cmMakefile;
class cmSourceFile;
@@ -91,25 +99,13 @@ public:
void SetMakefile(cmMakefile *mf);
cmMakefile *GetMakefile() const { return this->Makefile;};
- /** Get the status of policy CMP0003 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0003() const
- { return this->PolicyStatusCMP0003; }
-
- /** Get the status of policy CMP0004 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0004() const
- { return this->PolicyStatusCMP0004; }
+#define DECLARE_TARGET_POLICY(POLICY) \
+ cmPolicies::PolicyStatus GetPolicyStatus ## POLICY () const \
+ { return this->PolicyStatus ## POLICY; }
- /** Get the status of policy CMP0008 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0008() const
- { return this->PolicyStatusCMP0008; }
+ CM_FOR_EACH_TARGET_POLICY(DECLARE_TARGET_POLICY)
- /** Get the status of policy CMP0020 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0020() const
- { return this->PolicyStatusCMP0020; }
-
- /** Get the status of policy CMP0021 when the target was created. */
- cmPolicies::PolicyStatus GetPolicyStatusCMP0021() const
- { return this->PolicyStatusCMP0021; }
+#undef DECLARE_TARGET_POLICY
/**
* Get the list of the custom commands for this target
@@ -194,6 +190,12 @@ public:
void AddLinkLibrary(cmMakefile& mf,
const char *target, const char* lib,
LinkLibraryType llt);
+ enum TLLSignature {
+ KeywordTLLSignature,
+ PlainTLLSignature
+ };
+ bool PushTLLCommandTrace(TLLSignature signature);
+ void GetTllSignatureTraces(cmOStringStream &s, TLLSignature sig) const;
void MergeLinkLibraries( cmMakefile& mf, const char* selfname,
const LinkLibraryVectorType& libs );
@@ -276,6 +278,9 @@ public:
if the target cannot be linked. */
LinkInterface const* GetLinkInterface(const char* config,
cmTarget *headTarget);
+ void GetTransitivePropertyLinkLibraries(const char* config,
+ cmTarget *headTarget,
+ std::vector<std::string> &libs);
/** The link implementation specifies the direct library
dependencies needed by the object files of the target. */
@@ -341,7 +346,7 @@ public:
* Trace through the source files in this target and add al source files
* that they depend on, used by all generators
*/
- void TraceDependencies(const char* vsProjectFile);
+ void TraceDependencies();
/**
* Make sure the full path to all source files is known.
@@ -442,7 +447,8 @@ public:
If no macro should be defined null is returned. */
const char* GetExportMacro();
- std::string GetCompileDefinitions(const char *config);
+ void GetCompileDefinitions(std::vector<std::string> &result,
+ const char *config);
// Compute the set of languages compiled by the target. This is
// computed every time it is called because the languages can change
@@ -513,6 +519,8 @@ public:
bool before = false);
void InsertCompileOption(const cmValueWithOrigin &entry,
bool before = false);
+ void InsertCompileDefinition(const cmValueWithOrigin &entry,
+ bool before = false);
void AppendBuildInterfaceIncludes();
@@ -546,6 +554,8 @@ private:
// directories.
std::set<cmStdString> SystemIncludeDirectories;
+ std::vector<std::pair<TLLSignature, cmListFileBacktrace> > TLLCommands;
+
/**
* A list of direct dependencies. Use in conjunction with DependencyMap.
*/
@@ -661,6 +671,7 @@ private:
bool IsImportedTarget;
bool DebugIncludesDone;
bool DebugCompileOptionsDone;
+ bool DebugCompileDefinitionsDone;
mutable std::set<std::string> LinkImplicitNullProperties;
bool BuildInterfaceIncludesAppended;
@@ -699,11 +710,12 @@ private:
cmMakefile* Makefile;
// Policy status recorded when target was created.
- cmPolicies::PolicyStatus PolicyStatusCMP0003;
- cmPolicies::PolicyStatus PolicyStatusCMP0004;
- cmPolicies::PolicyStatus PolicyStatusCMP0008;
- cmPolicies::PolicyStatus PolicyStatusCMP0020;
- cmPolicies::PolicyStatus PolicyStatusCMP0021;
+#define TARGET_POLICY_MEMBER(POLICY) \
+ cmPolicies::PolicyStatus PolicyStatus ## POLICY;
+
+ CM_FOR_EACH_TARGET_POLICY(TARGET_POLICY_MEMBER)
+
+#undef TARGET_POLICY_MEMBER
// Internal representation details.
friend class cmTargetInternals;
diff --git a/Source/cmTargetCompileDefinitionsCommand.h b/Source/cmTargetCompileDefinitionsCommand.h
index bc58b31..585485d 100644
--- a/Source/cmTargetCompileDefinitionsCommand.h
+++ b/Source/cmTargetCompileDefinitionsCommand.h
@@ -70,7 +70,6 @@ public:
"Arguments to target_compile_definitions may use \"generator "
"expressions\" with the syntax \"$<...>\". "
CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS
;
}
diff --git a/Source/cmTargetExport.h b/Source/cmTargetExport.h
index c9d87fb..7665888 100644
--- a/Source/cmTargetExport.h
+++ b/Source/cmTargetExport.h
@@ -12,6 +12,8 @@
#ifndef cmTargetExport_h
#define cmTargetExport_h
+#include "cmStandardIncludes.h"
+
class cmTarget;
class cmInstallTargetGenerator;
class cmInstallFilesGenerator;
@@ -33,6 +35,7 @@ public:
cmInstallTargetGenerator* FrameworkGenerator;
cmInstallTargetGenerator* BundleGenerator;
cmInstallFilesGenerator* HeaderGenerator;
+ std::string InterfaceIncludeDirectories;
///@}
};
diff --git a/Source/cmTargetIncludeDirectoriesCommand.h b/Source/cmTargetIncludeDirectoriesCommand.h
index 2968618..fcc37f0 100644
--- a/Source/cmTargetIncludeDirectoriesCommand.h
+++ b/Source/cmTargetIncludeDirectoriesCommand.h
@@ -83,7 +83,6 @@ public:
"Arguments to target_include_directories may use \"generator "
"expressions\" with the syntax \"$<...>\". "
CM_DOCUMENT_COMMAND_GENERATOR_EXPRESSIONS
- CM_DOCUMENT_LANGUAGE_GENERATOR_EXPRESSIONS
;
}
diff --git a/Source/cmTargetLinkLibrariesCommand.cxx b/Source/cmTargetLinkLibrariesCommand.cxx
index b7b7691..0ee9420 100644
--- a/Source/cmTargetLinkLibrariesCommand.cxx
+++ b/Source/cmTargetLinkLibrariesCommand.cxx
@@ -116,7 +116,7 @@ bool cmTargetLinkLibrariesCommand
{
if(args[i] == "LINK_INTERFACE_LIBRARIES")
{
- this->CurrentProcessingState = ProcessingLinkInterface;
+ this->CurrentProcessingState = ProcessingPlainLinkInterface;
if(i != 1)
{
this->Makefile->IssueMessage(
@@ -127,9 +127,26 @@ bool cmTargetLinkLibrariesCommand
return true;
}
}
+ else if(args[i] == "INTERFACE")
+ {
+ if(i != 1
+ && this->CurrentProcessingState != ProcessingKeywordPrivateInterface
+ && this->CurrentProcessingState != ProcessingKeywordPublicInterface
+ && this->CurrentProcessingState != ProcessingKeywordLinkInterface)
+ {
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ "The INTERFACE option must appear as the second "
+ "argument, just after the target name."
+ );
+ return true;
+ }
+ this->CurrentProcessingState = ProcessingKeywordLinkInterface;
+ }
else if(args[i] == "LINK_PUBLIC")
{
- if(i != 1 && this->CurrentProcessingState != ProcessingPrivateInterface)
+ if(i != 1
+ && this->CurrentProcessingState != ProcessingPlainPrivateInterface)
{
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
@@ -138,11 +155,28 @@ bool cmTargetLinkLibrariesCommand
);
return true;
}
- this->CurrentProcessingState = ProcessingPublicInterface;
+ this->CurrentProcessingState = ProcessingPlainPublicInterface;
+ }
+ else if(args[i] == "PUBLIC")
+ {
+ if(i != 1
+ && this->CurrentProcessingState != ProcessingKeywordPrivateInterface
+ && this->CurrentProcessingState != ProcessingKeywordPublicInterface
+ && this->CurrentProcessingState != ProcessingKeywordLinkInterface)
+ {
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ "The PUBLIC or PRIVATE option must appear as the second "
+ "argument, just after the target name."
+ );
+ return true;
+ }
+ this->CurrentProcessingState = ProcessingKeywordPublicInterface;
}
else if(args[i] == "LINK_PRIVATE")
{
- if(i != 1 && this->CurrentProcessingState != ProcessingPublicInterface)
+ if(i != 1
+ && this->CurrentProcessingState != ProcessingPlainPublicInterface)
{
this->Makefile->IssueMessage(
cmake::FATAL_ERROR,
@@ -151,7 +185,23 @@ bool cmTargetLinkLibrariesCommand
);
return true;
}
- this->CurrentProcessingState = ProcessingPrivateInterface;
+ this->CurrentProcessingState = ProcessingPlainPrivateInterface;
+ }
+ else if(args[i] == "PRIVATE")
+ {
+ if(i != 1
+ && this->CurrentProcessingState != ProcessingKeywordPrivateInterface
+ && this->CurrentProcessingState != ProcessingKeywordPublicInterface
+ && this->CurrentProcessingState != ProcessingKeywordLinkInterface)
+ {
+ this->Makefile->IssueMessage(
+ cmake::FATAL_ERROR,
+ "The PUBLIC or PRIVATE option must appear as the second "
+ "argument, just after the target name."
+ );
+ return true;
+ }
+ this->CurrentProcessingState = ProcessingKeywordPrivateInterface;
}
else if(args[i] == "debug")
{
@@ -184,7 +234,10 @@ bool cmTargetLinkLibrariesCommand
{
// The link type was specified by the previous argument.
haveLLT = false;
- this->HandleLibrary(args[i].c_str(), llt);
+ if (!this->HandleLibrary(args[i].c_str(), llt))
+ {
+ return false;
+ }
}
else
{
@@ -210,7 +263,10 @@ bool cmTargetLinkLibrariesCommand
llt = cmTarget::OPTIMIZED;
}
}
- this->HandleLibrary(args[i].c_str(), llt);
+ if (!this->HandleLibrary(args[i].c_str(), llt))
+ {
+ return false;
+ }
}
}
@@ -224,12 +280,17 @@ bool cmTargetLinkLibrariesCommand
cmSystemTools::SetFatalErrorOccured();
}
+ const cmPolicies::PolicyStatus policy22Status
+ = this->Target->GetPolicyStatusCMP0022();
+
// If any of the LINK_ options were given, make sure the
// LINK_INTERFACE_LIBRARIES target property exists.
// Use of any of the new keywords implies awareness of
// this property. And if no libraries are named, it should
// result in an empty link interface.
- if(this->CurrentProcessingState != ProcessingLinkLibraries &&
+ if((policy22Status == cmPolicies::OLD ||
+ policy22Status == cmPolicies::WARN) &&
+ this->CurrentProcessingState != ProcessingLinkLibraries &&
!this->Target->GetProperty("LINK_INTERFACE_LIBRARIES"))
{
this->Target->SetProperty("LINK_INTERFACE_LIBRARIES", "");
@@ -252,22 +313,95 @@ cmTargetLinkLibrariesCommand
}
//----------------------------------------------------------------------------
-void
+bool
cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
cmTarget::LinkLibraryType llt)
{
+ cmTarget::TLLSignature sig =
+ (this->CurrentProcessingState == ProcessingPlainPrivateInterface
+ || this->CurrentProcessingState == ProcessingPlainPublicInterface
+ || this->CurrentProcessingState == ProcessingKeywordPrivateInterface
+ || this->CurrentProcessingState == ProcessingKeywordPublicInterface
+ || this->CurrentProcessingState == ProcessingKeywordLinkInterface)
+ ? cmTarget::KeywordTLLSignature : cmTarget::PlainTLLSignature;
+ if (!this->Target->PushTLLCommandTrace(sig))
+ {
+ const char *modal = 0;
+ cmake::MessageType messageType = cmake::AUTHOR_WARNING;
+ switch(this->Makefile->GetPolicyStatus(cmPolicies::CMP0023))
+ {
+ case cmPolicies::WARN:
+ modal = "should";
+ case cmPolicies::OLD:
+ break;
+ case cmPolicies::REQUIRED_ALWAYS:
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::NEW:
+ modal = "must";
+ messageType = cmake::FATAL_ERROR;
+ }
+
+ if(modal)
+ {
+ cmOStringStream e;
+ // If the sig is a keyword form and there is a conflict, the existing
+ // form must be the plain form.
+ const char *existingSig
+ = (sig == cmTarget::KeywordTLLSignature ? "plain"
+ : "keyword");
+ e << this->Makefile->GetPolicies()
+ ->GetPolicyWarning(cmPolicies::CMP0023) << "\n"
+ "The " << existingSig << " signature for target_link_libraries "
+ "has already been used with the target \""
+ << this->Target->GetName() << "\". All uses of "
+ "target_link_libraries with a target " << modal << " be either "
+ "all-keyword or all-plain.\n";
+ this->Target->GetTllSignatureTraces(e,
+ sig == cmTarget::KeywordTLLSignature
+ ? cmTarget::PlainTLLSignature
+ : cmTarget::KeywordTLLSignature);
+ this->Makefile->IssueMessage(messageType, e.str().c_str());
+ if(messageType == cmake::FATAL_ERROR)
+ {
+ return false;
+ }
+ }
+ }
+
// Handle normal case first.
- if(this->CurrentProcessingState != ProcessingLinkInterface)
+ if(this->CurrentProcessingState != ProcessingKeywordLinkInterface
+ && this->CurrentProcessingState != ProcessingPlainLinkInterface)
{
this->Makefile
->AddLinkLibraryForTarget(this->Target->GetName(), lib, llt);
- if (this->CurrentProcessingState != ProcessingPublicInterface)
+ if (this->CurrentProcessingState != ProcessingKeywordPublicInterface
+ && this->CurrentProcessingState != ProcessingPlainPublicInterface)
{
- // Not LINK_INTERFACE_LIBRARIES or LINK_PUBLIC, do not add to interface.
- return;
+ if (this->Target->GetType() == cmTarget::STATIC_LIBRARY)
+ {
+ this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES",
+ ("$<LINK_ONLY:" +
+ this->Target->GetDebugGeneratorExpressions(lib, llt) +
+ ">").c_str());
+ }
+ // Not a 'public' or 'interface' library. Do not add to interface
+ // property.
+ return true;
}
}
+ this->Target->AppendProperty("INTERFACE_LINK_LIBRARIES",
+ this->Target->GetDebugGeneratorExpressions(lib, llt).c_str());
+
+ const cmPolicies::PolicyStatus policy22Status
+ = this->Target->GetPolicyStatusCMP0022();
+
+ if (policy22Status != cmPolicies::OLD
+ && policy22Status != cmPolicies::WARN)
+ {
+ return true;
+ }
+
// Get the list of configurations considered to be DEBUG.
std::vector<std::string> const& debugConfigs =
this->Makefile->GetCMakeInstance()->GetDebugConfigs();
@@ -303,4 +437,5 @@ cmTargetLinkLibrariesCommand::HandleLibrary(const char* lib,
}
}
}
+ return true;
}
diff --git a/Source/cmTargetLinkLibrariesCommand.h b/Source/cmTargetLinkLibrariesCommand.h
index c683016..f2b2543 100644
--- a/Source/cmTargetLinkLibrariesCommand.h
+++ b/Source/cmTargetLinkLibrariesCommand.h
@@ -92,7 +92,7 @@ public:
"When this target is linked into another target then the libraries "
"linked to this target will appear on the link line for the other "
"target too. "
- "See the LINK_INTERFACE_LIBRARIES target property to override the "
+ "See the INTERFACE_LINK_LIBRARIES target property to override the "
"set of transitive link dependencies for a target. "
"Calls to other signatures of this command may set the property "
"making any libraries linked exclusively by this signature private."
@@ -109,17 +109,38 @@ public:
" INTERFACE_POSITION_INDEPENDENT_CODE: Sets POSITION_INDEPENDENT_CODE\n"
" or checked for consistency with existing value\n"
"\n"
+ "If an <item> is a library in a Mac OX framework, the Headers "
+ "directory of the framework will also be processed as a \"usage "
+ "requirement\". This has the same effect as passing the framework "
+ "directory as an include directory."
+ " target_link_libraries(<target>\n"
+ " <PRIVATE|PUBLIC|INTERFACE> <lib> ...\n"
+ " [<PRIVATE|PUBLIC|INTERFACE> <lib> ... ] ...])\n"
+ "The PUBLIC, PRIVATE and INTERFACE keywords can be used to specify "
+ "both the link dependencies and the link interface in one command. "
+ "Libraries and targets following PUBLIC are linked to, and are "
+ "made part of the link interface. Libraries and targets "
+ "following PRIVATE are linked to, but are not made part of the "
+ "link interface. Libraries following INTERFACE are appended "
+ "to the link interface and are not used for linking <target>."
+ "\n"
" target_link_libraries(<target> LINK_INTERFACE_LIBRARIES\n"
" [[debug|optimized|general] <lib>] ...)\n"
"The LINK_INTERFACE_LIBRARIES mode appends the libraries "
- "to the LINK_INTERFACE_LIBRARIES and its per-configuration equivalent "
- "target properties instead of using them for linking. "
- "Libraries specified as \"debug\" are appended to the "
+ "to the INTERFACE_LINK_LIBRARIES target property instead of using them "
+ "for linking. If policy CMP0022 is not NEW, then this mode also "
+ "appends libraries to the LINK_INTERFACE_LIBRARIES and its "
+ "per-configuration equivalent. This signature "
+ "is for compatibility only. Prefer the INTERFACE mode instead. "
+ "Libraries specified as \"debug\" are wrapped in a generator "
+ "expression to correspond to debug builds. If policy CMP0022 is not "
+ "NEW, the libraries are also appended to the "
"LINK_INTERFACE_LIBRARIES_DEBUG property (or to the properties "
"corresponding to configurations listed in the DEBUG_CONFIGURATIONS "
"global property if it is set). "
"Libraries specified as \"optimized\" are appended to the "
- "LINK_INTERFACE_LIBRARIES property. "
+ "INTERFACE_LINK_LIBRARIES property. If policy CMP0022 is not NEW, "
+ "they are also appended to the LINK_INTERFACE_LIBRARIES property. "
"Libraries specified as \"general\" (or without any keyword) are "
"treated as if specified for both \"debug\" and \"optimized\"."
"\n"
@@ -129,11 +150,15 @@ public:
" [<LINK_PRIVATE|LINK_PUBLIC>\n"
" [[debug|optimized|general] <lib>] ...])\n"
"The LINK_PUBLIC and LINK_PRIVATE modes can be used to specify both "
- "the link dependencies and the link interface in one command. "
+ "the link dependencies and the link interface in one command. This "
+ "signature is for compatibility only. Prefer the PUBLIC or PRIVATE "
+ "keywords instead. "
"Libraries and targets following LINK_PUBLIC are linked to, and are "
- "made part of the LINK_INTERFACE_LIBRARIES. Libraries and targets "
- "following LINK_PRIVATE are linked to, but are not made part of the "
- "LINK_INTERFACE_LIBRARIES. "
+ "made part of the INTERFACE_LINK_LIBRARIES. If policy CMP0022 is not "
+ "NEW, they are also made part of the LINK_INTERFACE_LIBRARIES. "
+ "Libraries and targets following LINK_PRIVATE are linked to, but are "
+ "not made part of the INTERFACE_LINK_LIBRARIES (or "
+ "LINK_INTERFACE_LIBRARIES)."
"\n"
"The library dependency graph is normally acyclic (a DAG), but in the "
"case of mutually-dependent STATIC libraries CMake allows the graph "
@@ -173,14 +198,17 @@ private:
cmTarget* Target;
enum ProcessingState {
ProcessingLinkLibraries,
- ProcessingLinkInterface,
- ProcessingPublicInterface,
- ProcessingPrivateInterface
+ ProcessingPlainLinkInterface,
+ ProcessingKeywordLinkInterface,
+ ProcessingPlainPublicInterface,
+ ProcessingKeywordPublicInterface,
+ ProcessingPlainPrivateInterface,
+ ProcessingKeywordPrivateInterface
};
ProcessingState CurrentProcessingState;
- void HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);
+ bool HandleLibrary(const char* lib, cmTarget::LinkLibraryType llt);
};
diff --git a/Source/cmTryCompileCommand.h b/Source/cmTryCompileCommand.h
index 163756d..a20594c 100644
--- a/Source/cmTryCompileCommand.h
+++ b/Source/cmTryCompileCommand.h
@@ -69,14 +69,14 @@ public:
" [COMPILE_DEFINITIONS flags...]\n"
" [LINK_LIBRARIES libs...]\n"
" [OUTPUT_VARIABLE <var>]\n"
- " [COPY_FILE <fileName>])\n"
+ " [COPY_FILE <fileName> [COPY_FILE_ERROR <var>]])\n"
"Try building an executable from one or more source files. "
"In this form the user need only supply one or more source files "
"that include a definition for 'main'. "
"CMake will create a CMakeLists.txt file to build the source(s) "
"as an executable. "
"Specify COPY_FILE to get a copy of the linked executable at the "
- "given fileName."
+ "given fileName and optionally COPY_FILE_ERROR to capture any error."
"\n"
"In this version all files in bindir/CMakeFiles/CMakeTmp "
"will be cleaned automatically. For debugging, --debug-trycompile can "
diff --git a/Source/cmVS10LinkFlagTable.h b/Source/cmVS10LinkFlagTable.h
index 64febbb..5d15620 100644
--- a/Source/cmVS10LinkFlagTable.h
+++ b/Source/cmVS10LinkFlagTable.h
@@ -201,7 +201,7 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] =
cmVS7FlagTable::UserValueRequired},
{"GenerateMapFile", "MAP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
- {"MapFileName", "MAP", "Generate Map File", "",
+ {"MapFileName", "MAP:", "Generate Map File", "",
cmVS7FlagTable::UserValueRequired},
//String List Properties
diff --git a/Source/cmVS11LinkFlagTable.h b/Source/cmVS11LinkFlagTable.h
index ea0d0f0..b4587a8 100644
--- a/Source/cmVS11LinkFlagTable.h
+++ b/Source/cmVS11LinkFlagTable.h
@@ -227,7 +227,7 @@ static cmVS7FlagTable cmVS11LinkFlagTable[] =
cmVS7FlagTable::UserValueRequired},
{"GenerateMapFile", "MAP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
- {"MapFileName", "MAP", "Generate Map File", "",
+ {"MapFileName", "MAP:", "Generate Map File", "",
cmVS7FlagTable::UserValueRequired},
//String List Properties
diff --git a/Source/cmVS12LinkFlagTable.h b/Source/cmVS12LinkFlagTable.h
index ce32e38..73d450a 100644
--- a/Source/cmVS12LinkFlagTable.h
+++ b/Source/cmVS12LinkFlagTable.h
@@ -227,7 +227,7 @@ static cmVS7FlagTable cmVS12LinkFlagTable[] =
cmVS7FlagTable::UserValueRequired},
{"GenerateMapFile", "MAP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
- {"MapFileName", "MAP", "Generate Map File", "",
+ {"MapFileName", "MAP:", "Generate Map File", "",
cmVS7FlagTable::UserValueRequired},
//String List Properties
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index 50f195e..d59de11 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -1337,8 +1337,9 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions(
clOptions.AddFlag("AssemblerListingLocation", asmLocation.c_str());
clOptions.Parse(flags.c_str());
clOptions.Parse(defineFlags.c_str());
- clOptions.AddDefines(this->Target->GetCompileDefinitions(
- configName.c_str()).c_str());
+ std::vector<std::string> targetDefines;
+ this->Target->GetCompileDefinitions(targetDefines, configName.c_str());
+ clOptions.AddDefines(targetDefines);
clOptions.SetVerboseMakefile(
this->Makefile->IsOn("CMAKE_VERBOSE_MAKEFILE"));
diff --git a/Source/cm_sha2.c b/Source/cm_sha2.c
index 12c39ed..24de2b2 100644
--- a/Source/cm_sha2.c
+++ b/Source/cm_sha2.c
@@ -740,7 +740,8 @@ void SHA1_Final(sha_byte digest[], SHA_CTX* context) {
/* Convert FROM host byte order */
REVERSE64(context->s1.bitcount,context->s1.bitcount);
#endif
- *(sha_word64*)&context->s1.buffer[56] = context->s1.bitcount;
+ MEMCPY_BCOPY(&context->s1.buffer[56], &context->s1.bitcount,
+ sizeof(sha_word64));
/* Final transform: */
SHA1_Internal_Transform(context, (sha_word32*)context->s1.buffer);
@@ -1067,7 +1068,8 @@ void SHA256_Internal_Last(SHA_CTX* context) {
*context->s256.buffer = 0x80;
}
/* Set the bit count: */
- *(sha_word64*)&context->s256.buffer[56] = context->s256.bitcount;
+ MEMCPY_BCOPY(&context->s256.buffer[56], &context->s256.bitcount,
+ sizeof(sha_word64));
/* Final transform: */
SHA256_Internal_Transform(context, (sha_word32*)context->s256.buffer);
@@ -1475,8 +1477,10 @@ void SHA512_Internal_Last(SHA_CTX* context) {
*context->s512.buffer = 0x80;
}
/* Store the length of input data (in bits): */
- *(sha_word64*)&context->s512.buffer[112] = context->s512.bitcount[1];
- *(sha_word64*)&context->s512.buffer[120] = context->s512.bitcount[0];
+ MEMCPY_BCOPY(&context->s512.buffer[112], &context->s512.bitcount[1],
+ sizeof(sha_word64));
+ MEMCPY_BCOPY(&context->s512.buffer[120], &context->s512.bitcount[0],
+ sizeof(sha_word64));
/* Final transform: */
SHA512_Internal_Transform(context, (sha_word64*)context->s512.buffer);
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 592b5ec..290aff0 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -3667,11 +3667,11 @@ void cmake::RecordPropertyAccess(const char *name,
void cmake::ReportUndefinedPropertyAccesses(const char *filename)
{
+ if(!this->GlobalGenerator)
+ { return; }
FILE *progFile = fopen(filename,"w");
- if (!progFile || !this->GlobalGenerator)
- {
- return;
- }
+ if(!progFile)
+ { return; }
// what are the enabled languages?
std::vector<std::string> enLangs;
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 4d5af5e..935b836 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -4261,17 +4261,13 @@ bool SystemTools::IsSubDirectory(const char* cSubdir, const char* cDir)
}
kwsys_stl::string subdir = cSubdir;
kwsys_stl::string dir = cDir;
+ SystemTools::ConvertToUnixSlashes(subdir);
SystemTools::ConvertToUnixSlashes(dir);
- kwsys_stl::string path = subdir;
- do
+ if(subdir.size() > dir.size() && subdir[dir.size()] == '/')
{
- path = SystemTools::GetParentDirectory(path.c_str());
- if(SystemTools::ComparePath(dir.c_str(), path.c_str()))
- {
- return true;
- }
+ std::string s = subdir.substr(0, dir.size());
+ return SystemTools::ComparePath(s.c_str(), dir.c_str());
}
- while ( path.size() > dir.size() );
return false;
}