summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CTestCustom.cmake.in3
-rw-r--r--CompileFlags.cmake8
-rw-r--r--Help/release/dev/CMakeDetermineVSServicePack.rst6
-rw-r--r--Modules/CMakeDetermineVSServicePack.cmake7
-rw-r--r--Modules/FindMPI.cmake13
-rw-r--r--Modules/Platform/Windows-GNU.cmake4
-rw-r--r--Source/CMakeVersion.cmake2
-rw-r--r--Source/cmNinjaNormalTargetGenerator.cxx314
-rw-r--r--Source/cmTarget.cxx92
-rw-r--r--Source/cmTarget.h2
-rw-r--r--Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt1
-rw-r--r--Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt1
-rw-r--r--Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake13
-rw-r--r--Tests/RunCMake/TargetSources/CMakeLists.txt2
-rw-r--r--Tests/RunCMake/TargetSources/RunCMakeTest.cmake2
-rw-r--r--Utilities/Sphinx/CMakeLists.txt2
-rw-r--r--Utilities/cmlibarchive/CMakeLists.txt6
17 files changed, 292 insertions, 186 deletions
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index 3c589b4..f499be1 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -19,6 +19,7 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
"Utilities.cmbzip2."
"Source.CTest.Curl"
"Source.CursesDialog.form"
+ "Source.cm_sha2.*warning.*cast increases required alignment of target type"
"Utilities.cmcurl"
"Utilities.cmexpat."
"Utilities.cmlibarchive"
@@ -55,6 +56,8 @@ set(CTEST_CUSTOM_WARNING_EXCEPTION
"warning.*This version of Mac OS X is unsupported"
"clang.*: warning: argument unused during compilation: .-g"
"note: in expansion of macro" # diagnostic context note
+ "cm(StringCommand|CTestTestHandler)\\.cxx.*warning.*rand.*isn.*t random" # we do not do crypto
+ "cm(StringCommand|CTestTestHandler)\\.cxx.*warning.*srand.*seed choices are.*poor" # we do not do crypto
# Ignore clang's summary warning, assuming prior text has matched some
# other warning expression:
diff --git a/CompileFlags.cmake b/CompileFlags.cmake
index 5f6a099..a4a4a78 100644
--- a/CompileFlags.cmake
+++ b/CompileFlags.cmake
@@ -54,8 +54,12 @@ if(CMAKE_SYSTEM MATCHES "OSF1-V")
endif()
if(CMAKE_SYSTEM_NAME MATCHES "HP-UX" AND CMAKE_CXX_COMPILER_ID MATCHES "HP")
- # it is known that version 3.85 fails and 6.25 works without these flags
- if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4)
+ # HP aCC since version 3.80 supports the flag +hpxstd98 to get ANSI C++98
+ # template support. It is known that version 6.25 doesn't need that flag.
+ # Versions prior to 3.80 will not be able to build CMake. Current assumption:
+ # it is needed for every version from 3.80 to 4 to get it working.
+ if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4 AND
+ NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 3.80)
# use new C++ library and improved template support
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA +hpxstd98")
endif()
diff --git a/Help/release/dev/CMakeDetermineVSServicePack.rst b/Help/release/dev/CMakeDetermineVSServicePack.rst
new file mode 100644
index 0000000..d9d7b41
--- /dev/null
+++ b/Help/release/dev/CMakeDetermineVSServicePack.rst
@@ -0,0 +1,6 @@
+CMakeDetermineVSServicePack
+---------------------------
+
+* The :module:`CMakeDetermineVSServicePack` module now warns that
+ it is deprecated and should not longer be used. Use the
+ :variable:`CMAKE_<LANG>_COMPILER_VERSION` variable instead.
diff --git a/Modules/CMakeDetermineVSServicePack.cmake b/Modules/CMakeDetermineVSServicePack.cmake
index 2854387..6886084 100644
--- a/Modules/CMakeDetermineVSServicePack.cmake
+++ b/Modules/CMakeDetermineVSServicePack.cmake
@@ -43,6 +43,13 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
+if(NOT CMAKE_MINIMUM_REQUIRED_VERSION VERSION_LESS 2.8.8)
+ message(DEPRECATION
+ "This module is deprecated and should not be used. "
+ "Use the CMAKE_<LANG>_COMPILER_VERSION variable instead."
+ )
+endif()
+
# [INTERNAL]
# Please do not call this function directly
function(_DetermineVSServicePackFromCompiler _OUT_VAR _cl_version)
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index b00040f..6e15f3b 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -378,19 +378,14 @@ function (interrogate_mpi_compiler lang try_libs)
# Extract the set of libraries to link against from the link command
# line
string(REGEX MATCHALL "(^| )-l([^\" ]+|\"[^\"]+\")" MPI_LIBNAMES "${MPI_LINK_CMDLINE}")
+
# add the compiler implicit directories because some compilers
# such as the intel compiler have libraries that show up
# in the showme list that can only be found in the implicit
- # link directories of the compiler. Do this for C++ and C
- # compilers if the implicit link directories are defined.
- if (DEFINED CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES)
- set(MPI_LINK_PATH
- "${MPI_LINK_PATH};${CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES}")
- endif ()
-
- if (DEFINED CMAKE_C_IMPLICIT_LINK_DIRECTORIES)
+ # link directories of the compiler.
+ if (DEFINED CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES)
set(MPI_LINK_PATH
- "${MPI_LINK_PATH};${CMAKE_C_IMPLICIT_LINK_DIRECTORIES}")
+ "${MPI_LINK_PATH};${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}")
endif ()
# Determine full path names for all of the libraries that one needs
diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake
index 5c5b360..b5e174b 100644
--- a/Modules/Platform/Windows-GNU.cmake
+++ b/Modules/Platform/Windows-GNU.cmake
@@ -113,9 +113,9 @@ macro(__windows_compiler_gnu lang)
# Binary link rules.
set(CMAKE_${lang}_CREATE_SHARED_MODULE
- "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_MODULE_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
- "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
+ "<CMAKE_${lang}_COMPILER> <CMAKE_SHARED_LIBRARY_${lang}_FLAGS> <LANGUAGE_COMPILE_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
set(CMAKE_${lang}_LINK_EXECUTABLE
"<CMAKE_${lang}_COMPILER> <FLAGS> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake
index cf4b121..a6be93f 100644
--- a/Source/CMakeVersion.cmake
+++ b/Source/CMakeVersion.cmake
@@ -1,5 +1,5 @@
# CMake version number components.
set(CMake_VERSION_MAJOR 3)
set(CMake_VERSION_MINOR 0)
-set(CMake_VERSION_PATCH 20140414)
+set(CMake_VERSION_PATCH 20140415)
#set(CMake_VERSION_RC 1)
diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx
index c865617..b467d22 100644
--- a/Source/cmNinjaNormalTargetGenerator.cxx
+++ b/Source/cmNinjaNormalTargetGenerator.cxx
@@ -232,13 +232,11 @@ cmNinjaNormalTargetGenerator
vars.LinkFlags = "$LINK_FLAGS";
std::string langFlags;
- if (targetType != cmTarget::EXECUTABLE) {
- this->GetLocalGenerator()->AddLanguageFlags(langFlags,
- this->TargetLinkLanguage,
- this->GetConfigName());
- langFlags += " $ARCH_FLAGS";
+ if (targetType != cmTarget::EXECUTABLE)
+ {
+ langFlags += "$LANGUAGE_COMPILE_FLAGS $ARCH_FLAGS";
vars.LanguageCompileFlags = langFlags.c_str();
- }
+ }
// Rule for linking library/executable.
std::vector<std::string> linkCmds = this->ComputeLinkCmd();
@@ -363,25 +361,39 @@ cmNinjaNormalTargetGenerator
return std::vector<std::string>();
}
-void cmNinjaNormalTargetGenerator::WriteLinkStatement()
+
+static int calculateCommandLineLengthLimit(int linkRuleLength)
{
- cmTarget::TargetType targetType = this->GetTarget()->GetType();
+#ifdef _WIN32
+ return 8000 - linkRuleLength;
+#elif defined(__linux) || defined(__APPLE__) || defined(__HAIKU__)
+ // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
+ return ((int)sysconf(_SC_ARG_MAX)) - linkRuleLength - 1000;
+#else
+ (void)linkRuleLength;
+ return -1;
+#endif
+}
+
+void cmNinjaNormalTargetGenerator::WriteLinkStatement()
+{
+ cmTarget& target = *this->GetTarget();
+ const std::string cfgName = this->GetConfigName();
std::string targetOutput = ConvertToNinjaPath(
- this->GetTarget()->GetFullPath(this->GetConfigName()).c_str());
+ target.GetFullPath(cfgName).c_str());
std::string targetOutputReal = ConvertToNinjaPath(
- this->GetTarget()->GetFullPath(this->GetConfigName(),
- /*implib=*/false,
- /*realpath=*/true).c_str());
+ target.GetFullPath(cfgName,
+ /*implib=*/false,
+ /*realpath=*/true).c_str());
std::string targetOutputImplib = ConvertToNinjaPath(
- this->GetTarget()->GetFullPath(this->GetConfigName(),
- /*implib=*/true).c_str());
+ target.GetFullPath(cfgName,
+ /*implib=*/true).c_str());
- if (this->GetTarget()->IsAppBundleOnApple())
+ if (target.IsAppBundleOnApple())
{
// Create the app bundle
- std::string outpath =
- this->GetTarget()->GetDirectory(this->GetConfigName());
+ std::string outpath = target.GetDirectory(cfgName);
this->OSXBundleGenerator->CreateAppBundle(this->TargetNameOut, outpath);
// Calculate the output path
@@ -394,23 +406,22 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
targetOutputReal += this->TargetNameReal;
targetOutputReal = this->ConvertToNinjaPath(targetOutputReal.c_str());
}
- else if (this->GetTarget()->IsFrameworkOnApple())
+ else if (target.IsFrameworkOnApple())
{
// Create the library framework.
- std::string outpath =
- this->GetTarget()->GetDirectory(this->GetConfigName());
- this->OSXBundleGenerator->CreateFramework(this->TargetNameOut, outpath);
+ this->OSXBundleGenerator->CreateFramework(this->TargetNameOut,
+ target.GetDirectory(cfgName));
}
- else if(this->GetTarget()->IsCFBundleOnApple())
+ else if(target.IsCFBundleOnApple())
{
// Create the core foundation bundle.
- std::string outpath =
- this->GetTarget()->GetDirectory(this->GetConfigName());
- this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut, outpath);
+ this->OSXBundleGenerator->CreateCFBundle(this->TargetNameOut,
+ target.GetDirectory(cfgName));
}
// Write comments.
cmGlobalNinjaGenerator::WriteDivider(this->GetBuildFileStream());
+ const cmTarget::TargetType targetType = target.GetType();
this->GetBuildFileStream()
<< "# Link build statements for "
<< cmTarget::GetTargetTypeName(targetType)
@@ -423,8 +434,8 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// Compute the comment.
cmOStringStream comment;
- comment << "Link the " << this->GetVisibleTypeName() << " "
- << targetOutputReal;
+ comment <<
+ "Link the " << this->GetVisibleTypeName() << " " << targetOutputReal;
// Compute outputs.
cmNinjaDeps outputs;
@@ -438,21 +449,21 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::string frameworkPath;
std::string linkPath;
- cmGeneratorTarget* gtarget = this->GetGeneratorTarget();
+ cmGeneratorTarget& genTarget = *this->GetGeneratorTarget();
std::string createRule = "CMAKE_";
- createRule += this->TargetLinkLanguage;
- createRule += gtarget->GetCreateRuleVariable();
+ createRule += this->TargetLinkLanguage + genTarget.GetCreateRuleVariable();
bool useWatcomQuote = mf->IsOn(createRule+"_USE_WATCOM_QUOTE");
- this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"],
- vars["FLAGS"],
- vars["LINK_FLAGS"],
- frameworkPath,
- linkPath,
- gtarget,
- useWatcomQuote);
+ cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator();
+ localGen.GetTargetFlags(vars["LINK_LIBRARIES"],
+ vars["FLAGS"],
+ vars["LINK_FLAGS"],
+ frameworkPath,
+ linkPath,
+ &genTarget,
+ useWatcomQuote);
- this->addPoolNinjaVariable("JOB_POOL_LINK", this->GetTarget(), vars);
+ this->addPoolNinjaVariable("JOB_POOL_LINK", &target, vars);
this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]);
vars["LINK_FLAGS"] = cmGlobalNinjaGenerator
@@ -463,42 +474,47 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// Compute architecture specific link flags. Yes, these go into a different
// variable for executables, probably due to a mistake made when duplicating
// code between the Makefile executable and library generators.
- std::string flags = (targetType == cmTarget::EXECUTABLE
- ? vars["FLAGS"]
- : vars["ARCH_FLAGS"]);
- this->GetLocalGenerator()->AddArchitectureFlags(flags,
- gtarget,
- this->TargetLinkLanguage,
- this->GetConfigName());
- if (targetType == cmTarget::EXECUTABLE) {
- vars["FLAGS"] = flags;
- } else {
- vars["ARCH_FLAGS"] = flags;
- }
- if (this->GetTarget()->HasSOName(this->GetConfigName())) {
- vars["SONAME_FLAG"] =
- mf->GetSONameFlag(this->TargetLinkLanguage);
+ if (targetType == cmTarget::EXECUTABLE)
+ {
+ std::string t = vars["FLAGS"];
+ localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName);
+ vars["FLAGS"] = t;
+ }
+ else
+ {
+ std::string t = vars["ARCH_FLAGS"];
+ localGen.AddArchitectureFlags(t, &genTarget, TargetLinkLanguage, cfgName);
+ vars["ARCH_FLAGS"] = t;
+ t = "";
+ localGen.AddLanguageFlags(t, TargetLinkLanguage, cfgName);
+ vars["LANGUAGE_COMPILE_FLAGS"] = t;
+ }
+
+ if (target.HasSOName(cfgName))
+ {
+ vars["SONAME_FLAG"] = mf->GetSONameFlag(this->TargetLinkLanguage);
vars["SONAME"] = this->TargetNameSO;
- if (targetType == cmTarget::SHARED_LIBRARY) {
- std::string install_name_dir = this->GetTarget()
- ->GetInstallNameDirForBuildTree(this->GetConfigName());
-
- if (!install_name_dir.empty()) {
- vars["INSTALLNAME_DIR"] =
- this->GetLocalGenerator()->Convert(install_name_dir,
- cmLocalGenerator::NONE,
- cmLocalGenerator::SHELL, false);
+ if (targetType == cmTarget::SHARED_LIBRARY)
+ {
+ std::string install_dir = target.GetInstallNameDirForBuildTree(cfgName);
+ if (!install_dir.empty())
+ {
+ vars["INSTALLNAME_DIR"] = localGen.Convert(install_dir,
+ cmLocalGenerator::NONE,
+ cmLocalGenerator::SHELL,
+ false);
+ }
}
}
- }
- if (!this->TargetNameImport.empty()) {
- const std::string impLibPath = this->GetLocalGenerator()
- ->ConvertToOutputFormat(targetOutputImplib,
- cmLocalGenerator::SHELL);
+ if (!this->TargetNameImport.empty())
+ {
+ const std::string impLibPath = localGen.ConvertToOutputFormat(
+ targetOutputImplib,
+ cmLocalGenerator::SHELL);
vars["TARGET_IMPLIB"] = impLibPath;
EnsureParentDirectoryExists(impLibPath);
- }
+ }
if (!this->SetMsvcTargetPdbVariable(vars))
{
@@ -507,11 +523,13 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
std::string prefix;
std::string base;
std::string suffix;
- this->GetTarget()->GetFullNameComponents(prefix, base, suffix);
+ target.GetFullNameComponents(prefix, base, suffix);
std::string dbg_suffix = ".dbg";
// TODO: Where to document?
if (mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX"))
+ {
dbg_suffix = mf->GetDefinition("CMAKE_DEBUG_SYMBOL_SUFFIX");
+ }
vars["TARGET_PDB"] = base + suffix + dbg_suffix;
}
@@ -523,12 +541,14 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
// ar.exe can't handle backslashes in rsp files (implicitly used by gcc)
std::string& linkLibraries = vars["LINK_LIBRARIES"];
std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/');
+ std::string& link_path = vars["LINK_PATH"];
+ std::replace(link_path.begin(), link_path.end(), '\\', '/');
}
const std::vector<cmCustomCommand> *cmdLists[3] = {
- &this->GetTarget()->GetPreBuildCommands(),
- &this->GetTarget()->GetPreLinkCommands(),
- &this->GetTarget()->GetPostBuildCommands()
+ &target.GetPreBuildCommands(),
+ &target.GetPreLinkCommands(),
+ &target.GetPostBuildCommands()
};
std::vector<std::string> preLinkCmdLines, postBuildCmdLines;
@@ -538,100 +558,97 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
&postBuildCmdLines
};
- for (unsigned i = 0; i != 3; ++i) {
+ for (unsigned i = 0; i != 3; ++i)
+ {
for (std::vector<cmCustomCommand>::const_iterator
ci = cmdLists[i]->begin();
- ci != cmdLists[i]->end(); ++ci) {
- cmCustomCommandGenerator ccg(*ci, this->GetConfigName(), mf);
- this->GetLocalGenerator()->AppendCustomCommandLines(ccg,
- *cmdLineLists[i]);
+ ci != cmdLists[i]->end(); ++ci)
+ {
+ cmCustomCommandGenerator ccg(*ci, cfgName, mf);
+ localGen.AppendCustomCommandLines(ccg, *cmdLineLists[i]);
+ }
}
- }
// If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for
// the link commands.
- if (!preLinkCmdLines.empty()) {
- const std::string homeOutDir = this->GetLocalGenerator()
- ->ConvertToOutputFormat(mf->GetHomeOutputDirectory(),
- cmLocalGenerator::SHELL);
+ if (!preLinkCmdLines.empty())
+ {
+ const std::string homeOutDir = localGen.ConvertToOutputFormat(
+ mf->GetHomeOutputDirectory(),
+ cmLocalGenerator::SHELL);
preLinkCmdLines.push_back("cd " + homeOutDir);
- }
+ }
- vars["PRE_LINK"] =
- this->GetLocalGenerator()->BuildCommandLine(preLinkCmdLines);
- std::string postBuildCmdLine =
- this->GetLocalGenerator()->BuildCommandLine(postBuildCmdLines);
+ vars["PRE_LINK"] = localGen.BuildCommandLine(preLinkCmdLines);
+ std::string postBuildCmdLine = localGen.BuildCommandLine(postBuildCmdLines);
cmNinjaVars symlinkVars;
- if (targetOutput == targetOutputReal) {
+ if (targetOutput == targetOutputReal)
+ {
vars["POST_BUILD"] = postBuildCmdLine;
- } else {
+ }
+ else
+ {
vars["POST_BUILD"] = ":";
symlinkVars["POST_BUILD"] = postBuildCmdLine;
- }
+ }
- int linkRuleLength = this->GetGlobalGenerator()->
- GetRuleCmdLength(this->LanguageLinkerRule());
+ cmGlobalNinjaGenerator& globalGen = *this->GetGlobalGenerator();
int commandLineLengthLimit = 1;
const char* forceRspFile = "CMAKE_NINJA_FORCE_RESPONSE_FILE";
if (!mf->IsDefinitionSet(forceRspFile) &&
- cmSystemTools::GetEnv(forceRspFile) == 0) {
-#ifdef _WIN32
- commandLineLengthLimit = 8000 - linkRuleLength;
-#elif defined(__linux) || defined(__APPLE__) || defined(__HAIKU__)
- // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
- commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000;
-#else
- (void)linkRuleLength;
- commandLineLengthLimit = -1;
-#endif
- }
-
- //Get the global generator as we are going to be call WriteBuild numerous
- //times in the following section
- cmGlobalNinjaGenerator* globalGenerator = this->GetGlobalGenerator();
-
+ cmSystemTools::GetEnv(forceRspFile) == 0)
+ {
+ commandLineLengthLimit = calculateCommandLineLengthLimit(
+ globalGen.GetRuleCmdLength(this->LanguageLinkerRule()));
+ }
- const std::string rspfile = std::string
- (cmake::GetCMakeFilesDirectoryPostSlash()) +
- this->GetTarget()->GetName() + ".rsp";
+ const std::string rspfile =
+ std::string(cmake::GetCMakeFilesDirectoryPostSlash())
+ + target.GetName() + ".rsp";
// Write the build statement for this target.
- globalGenerator->WriteBuild(this->GetBuildFileStream(),
- comment.str(),
- this->LanguageLinkerRule(),
- outputs,
- explicitDeps,
- implicitDeps,
- emptyDeps,
- vars,
- rspfile,
- commandLineLengthLimit);
-
- if (targetOutput != targetOutputReal &&
- !this->GetTarget()->IsFrameworkOnApple()) {
- if (targetType == cmTarget::EXECUTABLE) {
- globalGenerator->WriteBuild(this->GetBuildFileStream(),
- "Create executable symlink " + targetOutput,
- "CMAKE_SYMLINK_EXECUTABLE",
- cmNinjaDeps(1, targetOutput),
- cmNinjaDeps(1, targetOutputReal),
- emptyDeps,
- emptyDeps,
- symlinkVars);
- } else {
+ globalGen.WriteBuild(this->GetBuildFileStream(),
+ comment.str(),
+ this->LanguageLinkerRule(),
+ outputs,
+ explicitDeps,
+ implicitDeps,
+ emptyDeps,
+ vars,
+ rspfile,
+ commandLineLengthLimit);
+
+ if (targetOutput != targetOutputReal && !target.IsFrameworkOnApple())
+ {
+ if (targetType == cmTarget::EXECUTABLE)
+ {
+ globalGen.WriteBuild(this->GetBuildFileStream(),
+ "Create executable symlink " + targetOutput,
+ "CMAKE_SYMLINK_EXECUTABLE",
+ cmNinjaDeps(1, targetOutput),
+ cmNinjaDeps(1, targetOutputReal),
+ emptyDeps,
+ emptyDeps,
+ symlinkVars);
+ }
+ else
+ {
cmNinjaDeps symlinks;
const std::string soName = this->GetTargetFilePath(this->TargetNameSO);
// If one link has to be created.
- if (targetOutputReal == soName || targetOutput == soName) {
+ if (targetOutputReal == soName || targetOutput == soName)
+ {
symlinkVars["SONAME"] = soName;
- } else {
+ }
+ else
+ {
symlinkVars["SONAME"] = "";
symlinks.push_back(soName);
- }
+ }
symlinks.push_back(targetOutput);
- globalGenerator->WriteBuild(this->GetBuildFileStream(),
+ globalGen.WriteBuild(this->GetBuildFileStream(),
"Create library symlink " + targetOutput,
"CMAKE_SYMLINK_LIBRARY",
symlinks,
@@ -639,23 +656,22 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
emptyDeps,
emptyDeps,
symlinkVars);
+ }
}
- }
- if (!this->TargetNameImport.empty()) {
+ if (!this->TargetNameImport.empty())
+ {
// Since using multiple outputs would mess up the $out variable, use an
// alias for the import library.
- globalGenerator->WritePhonyBuild(this->GetBuildFileStream(),
- "Alias for import library.",
- cmNinjaDeps(1, targetOutputImplib),
- cmNinjaDeps(1, targetOutputReal));
- }
+ globalGen.WritePhonyBuild(this->GetBuildFileStream(),
+ "Alias for import library.",
+ cmNinjaDeps(1, targetOutputImplib),
+ cmNinjaDeps(1, targetOutputReal));
+ }
// Add aliases for the file name and the target name.
- globalGenerator->AddTargetAlias(this->TargetNameOut,
- this->GetTarget());
- globalGenerator->AddTargetAlias(this->GetTargetName(),
- this->GetTarget());
+ globalGen.AddTargetAlias(this->TargetNameOut, &target);
+ globalGen.AddTargetAlias(this->GetTargetName(), &target);
}
//----------------------------------------------------------------------------
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index 1f8cddb..6a87342 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -647,6 +647,38 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files,
{
assert(this->GetType() != INTERFACE_LIBRARY);
+ if (this->Makefile->GetGeneratorTargets().empty())
+ {
+ // At configure-time, this method can be called as part of getting the
+ // LOCATION property or to export() a file to be include()d. However
+ // there is no cmGeneratorTarget at configure-time, so search the SOURCES
+ // for TARGET_OBJECTS instead for backwards compatibility with OLD
+ // behavior of CMP0024 and CMP0026 only.
+
+ typedef cmTargetInternals::TargetPropertyEntry
+ TargetPropertyEntry;
+ for(std::vector<TargetPropertyEntry*>::const_iterator
+ i = this->Internal->SourceEntries.begin();
+ i != this->Internal->SourceEntries.end(); ++i)
+ {
+ std::string entry = (*i)->ge->GetInput();
+
+ std::vector<std::string> items;
+ cmSystemTools::ExpandListArgument(entry, items);
+ for (std::vector<std::string>::const_iterator
+ li = items.begin(); li != items.end(); ++li)
+ {
+ if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") &&
+ (*li)[li->size() - 1] == '>')
+ {
+ continue;
+ }
+ files.push_back(*li);
+ }
+ }
+ return;
+ }
+
std::vector<std::string> debugProperties;
const char *debugProp =
this->Makefile->GetDefinition("CMAKE_DEBUG_TARGET_PROPERTIES");
@@ -5343,6 +5375,45 @@ bool cmTarget::IsLinkInterfaceDependentNumberMaxProperty(const std::string &p,
}
//----------------------------------------------------------------------------
+void
+cmTarget::GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const
+{
+ // At configure-time, this method can be called as part of getting the
+ // LOCATION property or to export() a file to be include()d. However
+ // there is no cmGeneratorTarget at configure-time, so search the SOURCES
+ // for TARGET_OBJECTS instead for backwards compatibility with OLD
+ // behavior of CMP0024 and CMP0026 only.
+ typedef cmTargetInternals::TargetPropertyEntry
+ TargetPropertyEntry;
+ for(std::vector<TargetPropertyEntry*>::const_iterator
+ i = this->Internal->SourceEntries.begin();
+ i != this->Internal->SourceEntries.end(); ++i)
+ {
+ std::string entry = (*i)->ge->GetInput();
+
+ std::vector<std::string> files;
+ cmSystemTools::ExpandListArgument(entry, files);
+ for (std::vector<std::string>::const_iterator
+ li = files.begin(); li != files.end(); ++li)
+ {
+ if(cmHasLiteralPrefix(*li, "$<TARGET_OBJECTS:") &&
+ (*li)[li->size() - 1] == '>')
+ {
+ std::string objLibName = li->substr(17, li->size()-18);
+
+ if (cmGeneratorExpression::Find(objLibName) != std::string::npos)
+ {
+ continue;
+ }
+ cmTarget *objLib = this->Makefile->FindTargetToUse(objLibName.c_str());
+ assert(objLib);
+ objlibs.push_back(objLib);
+ }
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
void cmTarget::GetLanguages(std::set<std::string>& languages,
const std::string& config,
cmTarget const* head) const
@@ -5363,26 +5434,7 @@ void cmTarget::GetLanguages(std::set<std::string>& languages,
std::vector<cmSourceFile const*> externalObjects;
if (this->Makefile->GetGeneratorTargets().empty())
{
- // At configure-time, this method can be called as part of getting the
- // LOCATION property or to export() a file to be include()d. However
- // there is no cmGeneratorTarget at configure-time, so search the SOURCES
- // for TARGET_OBJECTS instead for backwards compatibility with OLD
- // behavior of CMP0024 and CMP0026 only.
- std::vector<std::string> srcs;
- cmSystemTools::ExpandListArgument(this->GetProperty("SOURCES"), srcs);
- for(std::vector<std::string>::const_iterator it = srcs.begin();
- it != srcs.end(); ++it)
- {
- if (cmHasLiteralPrefix(*it, "$<TARGET_OBJECTS:")
- && cmHasLiteralSuffix(*it, ">"))
- {
- std::string objLibName = it->substr(17, it->size()-18);
- if (cmTarget* tgt = this->Makefile->FindTargetToUse(objLibName))
- {
- objectLibraries.push_back(tgt);
- }
- }
- }
+ this->GetObjectLibrariesCMP0026(objectLibraries);
}
else
{
diff --git a/Source/cmTarget.h b/Source/cmTarget.h
index 92b5201..0a086cb 100644
--- a/Source/cmTarget.h
+++ b/Source/cmTarget.h
@@ -241,6 +241,8 @@ public:
bool IsImported() const {return this->IsImportedTarget;}
+ void GetObjectLibrariesCMP0026(std::vector<cmTarget*>& objlibs) const;
+
/** The link interface specifies transitive library dependencies and
other information needed by targets that link to this target. */
struct LinkInterface
diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt
new file mode 100644
index 0000000..573541a
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-result.txt
@@ -0,0 +1 @@
+0
diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt
new file mode 100644
index 0000000..10f3293
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0026-LOCATION-stderr.txt
@@ -0,0 +1 @@
+^$
diff --git a/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake b/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake
new file mode 100644
index 0000000..464df36
--- /dev/null
+++ b/Tests/RunCMake/TargetSources/CMP0026-LOCATION.cmake
@@ -0,0 +1,13 @@
+
+cmake_policy(SET CMP0026 OLD)
+
+add_library(objlib OBJECT
+ empty_1.cpp
+)
+
+add_executable(my_exe
+ empty_2.cpp
+ $<TARGET_OBJECTS:objlib>
+)
+
+get_target_property( loc my_exe LOCATION)
diff --git a/Tests/RunCMake/TargetSources/CMakeLists.txt b/Tests/RunCMake/TargetSources/CMakeLists.txt
index 12cd3c7..f452db1 100644
--- a/Tests/RunCMake/TargetSources/CMakeLists.txt
+++ b/Tests/RunCMake/TargetSources/CMakeLists.txt
@@ -1,3 +1,3 @@
cmake_minimum_required(VERSION 2.8.4)
-project(${RunCMake_TEST} NONE)
+project(${RunCMake_TEST} CXX)
include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
index b9095f9..01e505c 100644
--- a/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
+++ b/Tests/RunCMake/TargetSources/RunCMakeTest.cmake
@@ -7,3 +7,5 @@ if(RunCMake_GENERATOR MATCHES Xcode
else()
run_cmake(OriginDebug)
endif()
+
+run_cmake(CMP0026-LOCATION)
diff --git a/Utilities/Sphinx/CMakeLists.txt b/Utilities/Sphinx/CMakeLists.txt
index 0ae67bd..132ce60 100644
--- a/Utilities/Sphinx/CMakeLists.txt
+++ b/Utilities/Sphinx/CMakeLists.txt
@@ -149,7 +149,7 @@ if(SPHINX_HTML)
)
endif()
if(SPHINX_QTHELP)
- install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake.qch
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/qthelp/CMake-${CMake_VERSION_MAJOR}${CMake_VERSION_MINOR}${CMake_VERSION_PATCH}.qch
DESTINATION ${CMAKE_DOC_DIR}
)
endif()
diff --git a/Utilities/cmlibarchive/CMakeLists.txt b/Utilities/cmlibarchive/CMakeLists.txt
index e493966..afb7cea 100644
--- a/Utilities/cmlibarchive/CMakeLists.txt
+++ b/Utilities/cmlibarchive/CMakeLists.txt
@@ -350,7 +350,11 @@ ENDMACRO (LA_CHECK_INCLUDE_FILE)
LA_CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H)
# Alphabetize the rest unless there's a compelling reason
-LA_CHECK_INCLUDE_FILE("acl/libacl.h" HAVE_ACL_LIBACL_H)
+IF(ENABLE_ACL)
+ LA_CHECK_INCLUDE_FILE("acl/libacl.h" HAVE_ACL_LIBACL_H)
+ELSE(ENABLE_ACL)
+ SET(HAVE_ACL_LIBACL_H FALSE)
+ENDIF(ENABLE_ACL)
LA_CHECK_INCLUDE_FILE("ctype.h" HAVE_CTYPE_H)
LA_CHECK_INCLUDE_FILE("copyfile.h" HAVE_COPYFILE_H)
LA_CHECK_INCLUDE_FILE("direct.h" HAVE_DIRECT_H)