diff options
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/CMakeVersionSource.cmake | 4 | ||||
-rw-r--r-- | Source/cmCommandArgumentLexer.cxx | 2 | ||||
-rw-r--r-- | Source/cmCryptoHash.cxx | 2 | ||||
-rw-r--r-- | Source/cmDependsJavaLexer.cxx | 2 | ||||
-rw-r--r-- | Source/cmELF.cxx | 15 | ||||
-rw-r--r-- | Source/cmExportFileGenerator.cxx | 38 | ||||
-rw-r--r-- | Source/cmExprLexer.cxx | 2 | ||||
-rw-r--r-- | Source/cmExtraCodeLiteGenerator.cxx | 2 | ||||
-rw-r--r-- | Source/cmGeneratorTarget.cxx | 7 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 34 | ||||
-rw-r--r-- | Source/cmLocalGenerator.h | 11 | ||||
-rw-r--r-- | Source/cmMakefileExecutableTargetGenerator.cxx | 13 | ||||
-rw-r--r-- | Source/cmMakefileLibraryTargetGenerator.cxx | 14 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 6 | ||||
-rw-r--r-- | Source/cmMakefileTargetGenerator.h | 3 | ||||
-rw-r--r-- | Source/cmNinjaNormalTargetGenerator.cxx | 316 | ||||
-rw-r--r-- | Source/cmPolicies.cxx | 6 | ||||
-rw-r--r-- | Source/cmPolicies.h | 2 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 4 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 155 | ||||
-rw-r--r-- | Source/cmTarget.h | 8 | ||||
-rw-r--r-- | Source/cmake.cxx | 2 | ||||
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 7 | ||||
-rw-r--r-- | Source/kwsys/MD5.c | 9 |
25 files changed, 443 insertions, 223 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 49e2cf3..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 20140407) +set(CMake_VERSION_PATCH 20140415) #set(CMake_VERSION_RC 1) diff --git a/Source/CMakeVersionSource.cmake b/Source/CMakeVersionSource.cmake index 05e265c..888f557 100644 --- a/Source/CMakeVersionSource.cmake +++ b/Source/CMakeVersionSource.cmake @@ -30,8 +30,8 @@ if(EXISTS ${CMake_SOURCE_DIR}/.git/HEAD) elseif(EXISTS ${CMake_SOURCE_DIR}/CVS/Repository) file(READ ${CMake_SOURCE_DIR}/CVS/Repository repo) set(branch "") - if("${repo}" MATCHES "\\.git/") - string(REGEX REPLACE ".*\\.git/([^\r\n]*).*" "-\\1" branch "${repo}") + if("${repo}" MATCHES "\\.git/([^\r\n]*)") + set(branch "${CMAKE_MATCH_1}") endif() set(CMake_VERSION_SOURCE "cvs${branch}") endif() diff --git a/Source/cmCommandArgumentLexer.cxx b/Source/cmCommandArgumentLexer.cxx index e62e53e..e23ef8a 100644 --- a/Source/cmCommandArgumentLexer.cxx +++ b/Source/cmCommandArgumentLexer.cxx @@ -1069,7 +1069,7 @@ case YY_STATE_EOF(NOESCAPES): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -return 0; /* this should not happend but it should silence a warning */ +return 0; /* this should not happen but it quiets some compilers */ } /* end of cmCommandArgument_yylex */ /* yy_get_next_buffer - try to read in a new buffer diff --git a/Source/cmCryptoHash.cxx b/Source/cmCryptoHash.cxx index 0d3c6bb..74e17b6 100644 --- a/Source/cmCryptoHash.cxx +++ b/Source/cmCryptoHash.cxx @@ -38,7 +38,7 @@ cmsys::auto_ptr<cmCryptoHash> cmCryptoHash::New(const char* algo) std::string cmCryptoHash::HashString(const std::string& input) { this->Initialize(); - this->Append(reinterpret_cast<unsigned char const*>(&input[0]), + this->Append(reinterpret_cast<unsigned char const*>(input.c_str()), static_cast<int>(input.size())); return this->Finalize(); } diff --git a/Source/cmDependsJavaLexer.cxx b/Source/cmDependsJavaLexer.cxx index 1e505a5..f7676d9 100644 --- a/Source/cmDependsJavaLexer.cxx +++ b/Source/cmDependsJavaLexer.cxx @@ -1591,7 +1591,7 @@ case YY_STATE_EOF(string): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -return 0; /* this should not happen but it silences a warning*/ +return 0; /* this should not happen but it quiets some compilers */ } /* end of cmDependsJava_yylex */ /* yy_get_next_buffer - try to read in a new buffer diff --git a/Source/cmELF.cxx b/Source/cmELF.cxx index dc6772c..cab23b7 100644 --- a/Source/cmELF.cxx +++ b/Source/cmELF.cxx @@ -124,7 +124,7 @@ public: virtual unsigned int GetNumberOfSections() const = 0; virtual unsigned int GetDynamicEntryCount() = 0; virtual unsigned long GetDynamicEntryPosition(int j) = 0; - virtual StringEntry const* GetDynamicSectionString(int tag) = 0; + virtual StringEntry const* GetDynamicSectionString(unsigned int tag) = 0; virtual void PrintInfo(std::ostream& os) const = 0; bool ReadBytes(unsigned long pos, unsigned long size, char* buf) @@ -187,7 +187,7 @@ protected: } // Store string table entry states. - std::map<int, StringEntry> DynamicSectionStrings; + std::map<unsigned int, StringEntry> DynamicSectionStrings; }; //---------------------------------------------------------------------------- @@ -198,6 +198,7 @@ struct cmELFTypes32 typedef Elf32_Shdr ELF_Shdr; typedef Elf32_Dyn ELF_Dyn; typedef Elf32_Half ELF_Half; + typedef cmIML_INT_uint32_t tagtype; static const char* GetName() { return "32-bit"; } }; @@ -208,6 +209,7 @@ struct cmELFTypes64 typedef Elf64_Shdr ELF_Shdr; typedef Elf64_Dyn ELF_Dyn; typedef Elf64_Half ELF_Half; + typedef cmIML_INT_uint64_t tagtype; static const char* GetName() { return "64-bit"; } }; @@ -222,6 +224,7 @@ public: typedef typename Types::ELF_Shdr ELF_Shdr; typedef typename Types::ELF_Dyn ELF_Dyn; typedef typename Types::ELF_Half ELF_Half; + typedef typename Types::tagtype tagtype; // Construct with a stream and byte swap indicator. cmELFInternalImpl(cmELF* external, @@ -239,7 +242,7 @@ public: virtual unsigned long GetDynamicEntryPosition(int j); // Lookup a string from the dynamic section with the given tag. - virtual StringEntry const* GetDynamicSectionString(int tag); + virtual StringEntry const* GetDynamicSectionString(unsigned int tag); // Print information about the ELF file. virtual void PrintInfo(std::ostream& os) const @@ -624,10 +627,10 @@ unsigned long cmELFInternalImpl<Types>::GetDynamicEntryPosition(int j) //---------------------------------------------------------------------------- template <class Types> cmELF::StringEntry const* -cmELFInternalImpl<Types>::GetDynamicSectionString(int tag) +cmELFInternalImpl<Types>::GetDynamicSectionString(unsigned int tag) { // Short-circuit if already checked. - std::map<int, StringEntry>::iterator dssi = + std::map<unsigned int, StringEntry>::iterator dssi = this->DynamicSectionStrings.find(tag); if(dssi != this->DynamicSectionStrings.end()) { @@ -665,7 +668,7 @@ cmELFInternalImpl<Types>::GetDynamicSectionString(int tag) di != this->DynamicSectionEntries.end(); ++di) { ELF_Dyn& dyn = *di; - if(dyn.d_tag == tag) + if(static_cast<tagtype>(dyn.d_tag) == static_cast<tagtype>(tag)) { // We found the tag requested. // Make sure the position given is within the string section. diff --git a/Source/cmExportFileGenerator.cxx b/Source/cmExportFileGenerator.cxx index b38c48b..42fce6d 100644 --- a/Source/cmExportFileGenerator.cxx +++ b/Source/cmExportFileGenerator.cxx @@ -279,7 +279,43 @@ static bool checkInterfaceDirs(const std::string &prepro, } if (isSubDirectory(li->c_str(), installDir)) { - continue; + // The include directory is inside the install tree. If the + // install tree is not inside the source tree or build tree then + // fall through to the checks below that the include directory is not + // also inside the source tree or build tree. + bool shouldContinue = + isSubDirectory(installDir, topBinaryDir) + || isSubDirectory(installDir, topSourceDir); + + if (!shouldContinue) + { + switch(target->GetPolicyStatusCMP0052()) + { + case cmPolicies::WARN: + { + cmOStringStream s; + s << target->GetMakefile()->GetPolicies() + ->GetPolicyWarning(cmPolicies::CMP0052) << "\n"; + s << "Directory:\n \"" << *li << "\"\nin " + "INTERFACE_INCLUDE_DIRECTORIES of target \"" + << target->GetName() << "\" is a subdirectory of the install " + "directory:\n \"" << installDir << "\""; + target->GetMakefile()->IssueMessage(cmake::AUTHOR_WARNING, + s.str()); + } + case cmPolicies::OLD: + shouldContinue = true; + break; + case cmPolicies::REQUIRED_ALWAYS: + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::NEW: + break; + } + } + if (shouldContinue) + { + continue; + } } if (isSubDirectory(li->c_str(), topBinaryDir)) { diff --git a/Source/cmExprLexer.cxx b/Source/cmExprLexer.cxx index aa384cd..4704f03 100644 --- a/Source/cmExprLexer.cxx +++ b/Source/cmExprLexer.cxx @@ -976,7 +976,7 @@ case YY_STATE_EOF(INITIAL): "fatal flex scanner internal error--no action found" ); } /* end of action switch */ } /* end of scanning one token */ -return 0; /* this should not happen but it silences a warning*/ +return 0; /* this should not happen but it quiets some compilers */ } /* end of cmExpr_yylex */ /* yy_get_next_buffer - try to read in a new buffer diff --git a/Source/cmExtraCodeLiteGenerator.cxx b/Source/cmExtraCodeLiteGenerator.cxx index 33ffc90..8acc5b4 100644 --- a/Source/cmExtraCodeLiteGenerator.cxx +++ b/Source/cmExtraCodeLiteGenerator.cxx @@ -23,8 +23,8 @@ #include <cmsys/SystemTools.hxx> #include <cmsys/SystemInformation.hxx> #include <cmsys/Directory.hxx> +#include "cmStandardIncludes.h" #include "cmXMLSafe.h" -#include <sstream> //---------------------------------------------------------------------------- void cmExtraCodeLiteGenerator::GetDocumentation(cmDocumentationEntry& entry, diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 0d25a00..ec5ce9e 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -610,6 +610,7 @@ private: std::set<cmSourceFile*> SourcesQueued; typedef std::map<std::string, cmSourceFile*> NameMapType; NameMapType NameMap; + std::vector<std::string> NewSources; void QueueSource(cmSourceFile* sf); void FollowName(std::string const& name); @@ -698,6 +699,8 @@ void cmTargetTraceDependencies::Trace() } } this->CurrentEntry = 0; + + this->Target->AddTracedSources(this->NewSources); } //---------------------------------------------------------------------------- @@ -707,8 +710,8 @@ void cmTargetTraceDependencies::QueueSource(cmSourceFile* sf) { this->SourceQueue.push(sf); - // Make sure this file is in the target. - this->Target->AddSource(sf->GetFullPath()); + // Make sure this file is in the target at the end. + this->NewSources.push_back(sf->GetFullPath()); } } diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 528b1dc..f375b5f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -689,6 +689,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, std::string createRule = "CMAKE_"; createRule += llang; createRule += target.GetCreateRuleVariable(); + bool useWatcomQuote = this->Makefile->IsOn(createRule+"_USE_WATCOM_QUOTE"); std::string targetName = target.Target->GetFullName(); // Executable : // Shared Library: @@ -700,7 +701,7 @@ void cmLocalGenerator::AddBuildTargetRule(const std::string& llang, std::string flags; // should be set std::string linkFlags; // should be set this->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, - &target); + &target, useWatcomQuote); linkLibs = frameworkPath + linkPath + linkLibs; cmLocalGenerator::RuleVariables vars; vars.Language = llang.c_str(); @@ -1622,7 +1623,8 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, std::string& linkFlags, std::string& frameworkPath, std::string& linkPath, - cmGeneratorTarget* target) + cmGeneratorTarget* target, + bool useWatcomQuote) { std::string buildType = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); @@ -1686,7 +1688,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *target, false, false); + *target, false, false, useWatcomQuote); } break; case cmTarget::EXECUTABLE: @@ -1711,7 +1713,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } this->AddLanguageFlags(flags, linkLanguage, buildType); this->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, - *target, false, false); + *target, false, false, useWatcomQuote); if(cmSystemTools::IsOn (this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) { @@ -1770,9 +1772,8 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib, OutputFormat format) { #if defined(_WIN32) && !defined(__CYGWIN__) - // Work-ardound command line parsing limitations in MSVC 6.0 and - // Watcom. - if(this->Makefile->IsOn("MSVC60") || this->Makefile->IsOn("WATCOM")) + // Work-ardound command line parsing limitations in MSVC 6.0 + if(this->Makefile->IsOn("MSVC60")) { // Search for the last space. std::string::size_type pos = lib.rfind(' '); @@ -1809,9 +1810,11 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, std::string& linkPath, cmGeneratorTarget &tgt, bool relink, - bool forResponseFile) + bool forResponseFile, + bool useWatcomQuote) { - OutputFormat shellFormat = forResponseFile? RESPONSE : SHELL; + OutputFormat shellFormat = (forResponseFile) ? RESPONSE : + ((useWatcomQuote) ? WATCOMQUOTE : SHELL); bool escapeAllowMakeVars = !forResponseFile; cmOStringStream fout; const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); @@ -2633,7 +2636,7 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, { result = cmSystemTools::ConvertToOutputPath(result.c_str()); } - else if( output == SHELL) + else if(output == SHELL || output == WATCOMQUOTE) { // For the MSYS shell convert drive letters to posix paths, so // that c:/some/path becomes /c/some/path. This is needed to @@ -2655,11 +2658,11 @@ std::string cmLocalGenerator::ConvertToOutputFormat(const std::string& source, pos++; } } - result = this->EscapeForShell(result, true, false); + result = this->EscapeForShell(result, true, false, output == WATCOMQUOTE); } else if(output == RESPONSE) { - result = this->EscapeForShell(result, false, false); + result = this->EscapeForShell(result, false, false, false); } return result; } @@ -3286,7 +3289,8 @@ static bool cmLocalGeneratorIsShellOperator(const std::string& str) //---------------------------------------------------------------------------- std::string cmLocalGenerator::EscapeForShell(const std::string& str, bool makeVars, - bool forEcho) + bool forEcho, + bool useWatcomQuote) { // Do not escape shell operators. if(cmLocalGeneratorIsShellOperator(str)) @@ -3312,6 +3316,10 @@ std::string cmLocalGenerator::EscapeForShell(const std::string& str, { flags |= cmsysSystem_Shell_Flag_EchoWindows; } + if(useWatcomQuote) + { + flags |= cmsysSystem_Shell_Flag_WatcomQuote; + } if(this->WatcomWMake) { flags |= cmsysSystem_Shell_Flag_WatcomWMake; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 12a94e4..cf754aa 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -106,7 +106,7 @@ public: * path setting */ enum RelativeRoot { NONE, FULL, HOME, START, HOME_OUTPUT, START_OUTPUT }; - enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, RESPONSE }; + enum OutputFormat { UNCHANGED, MAKEFILE, SHELL, WATCOMQUOTE, RESPONSE }; std::string ConvertToOutputFormat(const std::string& source, OutputFormat output); std::string Convert(const std::string& remote, RelativeRoot local, @@ -290,7 +290,8 @@ public: escapes for the special case of passing to the native echo command. */ std::string EscapeForShell(const std::string& str, bool makeVars = false, - bool forEcho = false); + bool forEcho = false, + bool useWatcomQuote = false); /** Backwards-compatibility version of EscapeForShell. */ std::string EscapeForShellOldStyle(const std::string& str); @@ -372,7 +373,8 @@ public: std::string& linkFlags, std::string& frameworkPath, std::string& linkPath, - cmGeneratorTarget* target); + cmGeneratorTarget* target, + bool useWatcomQuote); virtual void ComputeObjectFilenames( std::map<cmSourceFile const*, std::string>& mapping, @@ -385,7 +387,8 @@ protected: std::string& linkPath, cmGeneratorTarget &, bool relink, - bool forResponseFile); + bool forResponseFile, + bool useWatcomQuote); // Expand rule variables in CMake of the type found in language rules void ExpandRuleVariables(std::string& string, diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 701d5a0..fc52ccc 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -290,7 +290,6 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) linkRuleVar += linkLanguage; linkRuleVar += "_LINK_EXECUTABLE"; std::string linkRule = this->GetLinkRule(linkRuleVar); - bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); std::vector<std::string> commands1; cmSystemTools::ExpandListArgument(linkRule, real_link_commands); if(this->Target->IsExecutableWithExports()) @@ -333,12 +332,15 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Expand the rule variables. { + bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); + // Set path conversion for link script shells. this->LocalGenerator->SetLinkScriptShell(useLinkScript); // Collect up flags to link in needed libraries. std::string linkLibs; - this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends); + this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends, + useWatcomQuote); // Construct object file lists that may be needed to expand the // rule. @@ -357,7 +359,12 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); - vars.Target = targetOutPathReal.c_str(); + cmLocalGenerator::OutputFormat output = (useWatcomQuote) ? + cmLocalGenerator::WATCOMQUOTE : cmLocalGenerator::SHELL; + std::string target = this->Convert(targetFullPathReal, + cmLocalGenerator::START_OUTPUT, + output); + vars.Target = target.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); // Setup the target version. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 754f62f..7ac0256 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -458,8 +458,6 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules this->Target); } - bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); - // Determine whether a link script will be used. bool useLinkScript = this->GlobalGenerator->GetUseLinkScript(); @@ -541,6 +539,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules // Expand the rule variables. std::vector<std::string> real_link_commands; { + bool useWatcomQuote = this->Makefile->IsOn(linkRuleVar+"_USE_WATCOM_QUOTE"); + // Set path conversion for link script shells. this->LocalGenerator->SetLinkScriptShell(useLinkScript); @@ -548,7 +548,8 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string linkLibs; if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { - this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends); + this->CreateLinkLibs(linkLibs, relink, useResponseFileForLibs, depends, + useWatcomQuote); } // Construct object file lists that may be needed to expand the @@ -587,7 +588,12 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); - vars.Target = targetOutPathReal.c_str(); + cmLocalGenerator::OutputFormat output = (useWatcomQuote) ? + cmLocalGenerator::WATCOMQUOTE : cmLocalGenerator::SHELL; + std::string target = this->Convert(targetFullPathReal, + cmLocalGenerator::START_OUTPUT, + output); + vars.Target = target.c_str(); 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 f940ac4..d4723ad 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1826,14 +1826,16 @@ void cmMakefileTargetGenerator ::CreateLinkLibs(std::string& linkLibs, bool relink, bool useResponseFile, - std::vector<std::string>& makefile_depends) + std::vector<std::string>& makefile_depends, + bool useWatcomQuote) { std::string frameworkPath; std::string linkPath; this->LocalGenerator ->OutputLinkLibraries(linkLibs, frameworkPath, linkPath, *this->GeneratorTarget, relink, - useResponseFile); + useResponseFile, + useWatcomQuote); linkLibs = frameworkPath + linkPath + linkLibs; if(useResponseFile) diff --git a/Source/cmMakefileTargetGenerator.h b/Source/cmMakefileTargetGenerator.h index ff94660..9fac574 100644 --- a/Source/cmMakefileTargetGenerator.h +++ b/Source/cmMakefileTargetGenerator.h @@ -168,7 +168,8 @@ protected: /** Create list of flags for link libraries. */ void CreateLinkLibs(std::string& linkLibs, bool relink, bool useResponseFile, - std::vector<std::string>& makefile_depends); + std::vector<std::string>& makefile_depends, + bool useWatcomQuote); /** Create lists of object files for linking and cleaning. */ void CreateObjectLists(bool useLinkScript, bool useArchiveRules, diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 1d0336a..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,15 +449,21 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() std::string frameworkPath; std::string linkPath; - cmGeneratorTarget* gtarget = this->GetGeneratorTarget(); - this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"], - vars["FLAGS"], - vars["LINK_FLAGS"], - frameworkPath, - linkPath, - gtarget); - - this->addPoolNinjaVariable("JOB_POOL_LINK", this->GetTarget(), vars); + cmGeneratorTarget& genTarget = *this->GetGeneratorTarget(); + + std::string createRule = "CMAKE_"; + createRule += this->TargetLinkLanguage + genTarget.GetCreateRuleVariable(); + bool useWatcomQuote = mf->IsOn(createRule+"_USE_WATCOM_QUOTE"); + cmLocalNinjaGenerator& localGen = *this->GetLocalGenerator(); + localGen.GetTargetFlags(vars["LINK_LIBRARIES"], + vars["FLAGS"], + vars["LINK_FLAGS"], + frameworkPath, + linkPath, + &genTarget, + useWatcomQuote); + + this->addPoolNinjaVariable("JOB_POOL_LINK", &target, vars); this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]); vars["LINK_FLAGS"] = cmGlobalNinjaGenerator @@ -457,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)) { @@ -501,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; } @@ -517,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; @@ -532,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, @@ -633,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/cmPolicies.cxx b/Source/cmPolicies.cxx index 759df91..309f280 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -348,6 +348,12 @@ cmPolicies::cmPolicies() CMP0051, "CMP0051", "List TARGET_OBJECTS in SOURCES target property.", 3,1,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0052, "CMP0052", + "Reject source and build dirs in installed " + "INTERFACE_INCLUDE_DIRECTORIES.", + 3,1,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 7a08a34..60f35c2 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -105,6 +105,8 @@ public: CMP0049, ///< Do not expand variables in target source entries CMP0050, ///< Disallow add_custom_command SOURCE signatures CMP0051, ///< List TARGET_OBJECTS in SOURCES target property + CMP0052, ///< Reject source and build dirs in installed + /// INTERFACE_INCLUDE_DIRECTORIES /** \brief Always the last entry. * diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index c1c33f2..c27b561 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -1616,8 +1616,8 @@ long copy_data(struct archive *ar, struct archive *aw) return (r); } } -#if !defined(__clang__) - return r; /* this should not happen but it silences a warning */ +#if !defined(__clang__) && !defined(__HP_aCC) + return r; /* this should not happen but it quiets some compilers */ #endif } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 1d4d84c..ee6cb44 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -235,6 +235,7 @@ cmTarget::cmTarget() this->DebugCompileFeaturesDone = false; this->DebugCompileDefinitionsDone = false; this->DebugSourcesDone = false; + this->LinkImplementationLanguageIsContextDependent = true; } //---------------------------------------------------------------------------- @@ -469,6 +470,7 @@ void cmTarget::FinishConfigure() //---------------------------------------------------------------------------- void cmTarget::ClearLinkMaps() { + this->LinkImplementationLanguageIsContextDependent = true; this->Internal->LinkImplMap.clear(); this->Internal->LinkInterfaceMap.clear(); this->Internal->LinkClosureMap.clear(); @@ -560,7 +562,7 @@ bool cmTarget::IsBundleOnApple() const } //---------------------------------------------------------------------------- -static void processSources(cmTarget const* tgt, +static bool processSources(cmTarget const* tgt, const std::vector<cmTargetInternals::TargetPropertyEntry*> &entries, std::vector<std::string> &srcs, std::set<std::string> &uniqueSrcs, @@ -570,6 +572,8 @@ static void processSources(cmTarget const* tgt, { cmMakefile *mf = tgt->GetMakefile(); + bool contextDependent = false; + for (std::vector<cmTargetInternals::TargetPropertyEntry*>::const_iterator it = entries.begin(), end = entries.end(); it != end; ++it) { @@ -584,8 +588,12 @@ static void processSources(cmTarget const* tgt, tgt, dagChecker), entrySources); - if (mf->IsGeneratingBuildSystem() - && !(*it)->ge->GetHadContextSensitiveCondition()) + + if ((*it)->ge->GetHadContextSensitiveCondition()) + { + contextDependent = true; + } + else if (mf->IsGeneratingBuildSystem()) { cacheSources = true; } @@ -606,7 +614,7 @@ static void processSources(cmTarget const* tgt, cm->IssueMessage(cmake::FATAL_ERROR, e, tgt->GetBacktrace()); } - return; + return contextDependent; } } if (cacheSources) @@ -637,6 +645,7 @@ static void processSources(cmTarget const* tgt, + usedSources, (*it)->ge->GetBacktrace()); } } + return contextDependent; } //---------------------------------------------------------------------------- @@ -646,6 +655,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"); @@ -672,7 +713,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, "SOURCES", 0, 0); std::set<std::string> uniqueSrcs; - processSources(this, + bool contextDependentDirectSources = processSources(this, this->Internal->SourceEntries, files, uniqueSrcs, @@ -724,7 +765,8 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, } } - processSources(this, + std::vector<std::string>::size_type numFilesBefore = files.size(); + bool contextDependentInterfaceSources = processSources(this, this->Internal->CachedLinkInterfaceSourcesEntries[config], files, uniqueSrcs, @@ -733,6 +775,12 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, config, debugSources); + if (!contextDependentDirectSources + && !(contextDependentInterfaceSources && numFilesBefore < files.size())) + { + this->LinkImplementationLanguageIsContextDependent = false; + } + if (!this->Makefile->IsGeneratingBuildSystem()) { deleteAndClear(this->Internal->CachedLinkInterfaceSourcesEntries); @@ -809,6 +857,12 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, // Lookup any existing link implementation for this configuration. TargetConfigPair key(head, cmSystemTools::UpperCase(config)); + if(!this->LinkImplementationLanguageIsContextDependent) + { + files = this->Internal->SourceFilesMap.begin()->second; + return; + } + cmTargetInternals::SourceFilesMapType::iterator it = this->Internal->SourceFilesMap.find(key); if(it != this->Internal->SourceFilesMap.end()) @@ -836,6 +890,33 @@ void cmTarget::GetSourceFiles(std::vector<cmSourceFile*> &files, } //---------------------------------------------------------------------------- +void cmTarget::AddTracedSources(std::vector<std::string> const& srcs) +{ + std::string srcFiles; + const char* sep = ""; + for(std::vector<std::string>::const_iterator i = srcs.begin(); + i != srcs.end(); ++i) + { + std::string filename = *i; + srcFiles += sep; + srcFiles += filename; + sep = ";"; + } + if (!srcFiles.empty()) + { + this->Internal->SourceFilesMap.clear(); + this->LinkImplementationLanguageIsContextDependent = true; + cmListFileBacktrace lfbt; + this->Makefile->GetBacktrace(lfbt); + cmGeneratorExpression ge(lfbt); + cmsys::auto_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(srcFiles); + cge->SetEvaluateForBuildsystem(true); + this->Internal->SourceEntries.push_back( + new cmTargetInternals::TargetPropertyEntry(cge)); + } +} + +//---------------------------------------------------------------------------- void cmTarget::AddSources(std::vector<std::string> const& srcs) { std::string srcFiles; @@ -862,6 +943,7 @@ void cmTarget::AddSources(std::vector<std::string> const& srcs) if (!srcFiles.empty()) { this->Internal->SourceFilesMap.clear(); + this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(lfbt); @@ -997,6 +1079,7 @@ cmSourceFile* cmTarget::AddSource(const std::string& src) == this->Internal->SourceEntries.end()) { this->Internal->SourceFilesMap.clear(); + this->LinkImplementationLanguageIsContextDependent = true; cmListFileBacktrace lfbt; this->Makefile->GetBacktrace(lfbt); cmGeneratorExpression ge(lfbt); @@ -5450,6 +5533,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 @@ -5470,26 +5592,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 8984649..4d8022e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -30,7 +30,8 @@ F(CMP0038) \ F(CMP0041) \ F(CMP0042) \ - F(CMP0046) + F(CMP0046) \ + F(CMP0052) class cmake; class cmMakefile; @@ -144,6 +145,7 @@ public: * Add sources to the target. */ void AddSources(std::vector<std::string> const& srcs); + void AddTracedSources(std::vector<std::string> const& srcs); cmSourceFile* AddSourceCMP0049(const std::string& src); cmSourceFile* AddSource(const std::string& src); @@ -239,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 @@ -787,6 +791,8 @@ private: std::string const& suffix, std::string const& name, const char* version) const; + + mutable bool LinkImplementationLanguageIsContextDependent; }; typedef std::map<std::string,cmTarget> cmTargets; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 2cf636c..71ea3f5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -600,7 +600,7 @@ bool cmake::FindPackage(const std::vector<std::string>& args) gg->CreateGeneratorTargets(mf); cmGeneratorTarget *gtgt = gg->GetGeneratorTarget(tgt); lg->GetTargetFlags(linkLibs, frameworkPath, linkPath, flags, linkFlags, - gtgt); + gtgt, false); linkLibs = frameworkPath + linkPath + linkLibs; printf("%s\n", linkLibs.c_str() ); diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 977d57b..5e6a226 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -299,6 +299,13 @@ IF(NOT CMAKE_COMPILER_IS_GNUCXX) ENDIF(CMAKE_SYSTEM MATCHES "OSF1-V.*") IF(CMAKE_SYSTEM MATCHES "HP-UX") SET(KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS "+p") + IF(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) + # use new C++ library and improved template support + SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA +hpxstd98") + ENDIF() + ENDIF() ENDIF(CMAKE_SYSTEM MATCHES "HP-UX") ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX) diff --git a/Source/kwsys/MD5.c b/Source/kwsys/MD5.c index 56776a3..a147057 100644 --- a/Source/kwsys/MD5.c +++ b/Source/kwsys/MD5.c @@ -478,11 +478,16 @@ void kwsysMD5_Initialize(kwsysMD5* md5) /*--------------------------------------------------------------------------*/ void kwsysMD5_Append(kwsysMD5* md5, unsigned char const* data, int length) { + size_t dlen; if(length < 0) { - length = (int)strlen((char const*)data); + dlen = strlen((char const*)data); } - md5_append(&md5->md5_state, (md5_byte_t const*)data, (size_t)length); + else + { + dlen = (size_t)length; + } + md5_append(&md5->md5_state, (md5_byte_t const*)data, dlen); } /*--------------------------------------------------------------------------*/ |