diff options
Diffstat (limited to 'Source')
23 files changed, 411 insertions, 40 deletions
diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c8b60f9..5cb27c8 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 12) -set(CMake_VERSION_TWEAK 20131223) +set(CMake_VERSION_TWEAK 20140102) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/WiX/cmCPackWIXGenerator.cxx b/Source/CPack/WiX/cmCPackWIXGenerator.cxx index c1749ac..78e7339 100644 --- a/Source/CPack/WiX/cmCPackWIXGenerator.cxx +++ b/Source/CPack/WiX/cmCPackWIXGenerator.cxx @@ -27,6 +27,9 @@ #include <rpc.h> // for GUID generation +#include <sys/types.h> +#include <sys/stat.h> + int cmCPackWIXGenerator::InitializeInternal() { componentPackageMethod = ONE_PACKAGE; @@ -920,6 +923,14 @@ void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons( fileDefinitions.AddAttribute("Source", fullPath); fileDefinitions.AddAttribute("KeyPath", "yes"); + mode_t fileMode = 0; + cmSystemTools::GetPermissions(fullPath.c_str(), fileMode); + + if(!(fileMode & S_IWRITE)) + { + fileDefinitions.AddAttribute("ReadOnly", "yes"); + } + ApplyPatchFragment(fileId, fileDefinitions); fileDefinitions.EndElement("File"); diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx index 886b534..ddc1d71 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx @@ -65,7 +65,41 @@ void cmWIXRichTextFormatWriter::AddText(const std::string& text) } else { - File << "[NON-ASCII-" << int(c) << "]"; + if(c <= 0xC0) + { + EmitInvalidCodepoint(c); + } + else if(c < 0xE0 && i+1 < text.size()) + { + EmitUnicodeCodepoint( + (text[i+1] & 0x3F) | + ((c & 0x1F) << 6) + ); + i+= 1; + } + else if(c < 0xF0 && i+2 < text.size()) + { + EmitUnicodeCodepoint( + (text[i+2] & 0x3F) | + ((text[i+1] & 0x3F) << 6) | + ((c & 0xF) << 12) + ); + i += 2; + } + else if(c < 0xF8 && i+3 < text.size()) + { + EmitUnicodeCodepoint( + (text[i+3] & 0x3F) | + ((text[i+2] & 0x3F) << 6) | + ((text[i+1] & 0x3F) << 12) | + ((c & 0x7) << 18) + ); + i += 3; + } + else + { + EmitInvalidCodepoint(c); + } } } break; @@ -82,6 +116,7 @@ void cmWIXRichTextFormatWriter::WriteHeader() ControlWord("deflang1031"); WriteFontTable(); + WriteColorTable(); WriteGenerator(); } @@ -99,6 +134,22 @@ void cmWIXRichTextFormatWriter::WriteFontTable() EndGroup(); } +void cmWIXRichTextFormatWriter::WriteColorTable() +{ + StartGroup(); + ControlWord("colortbl ;"); + ControlWord("red255"); + ControlWord("green0"); + ControlWord("blue0;"); + ControlWord("red0"); + ControlWord("green255"); + ControlWord("blue0;"); + ControlWord("red0"); + ControlWord("green0"); + ControlWord("blue255;"); + EndGroup(); +} + void cmWIXRichTextFormatWriter::WriteGenerator() { StartGroup(); @@ -135,3 +186,43 @@ void cmWIXRichTextFormatWriter::EndGroup() { File.put('}'); } + +void cmWIXRichTextFormatWriter::EmitUnicodeCodepoint(int c) +{ + // Do not emit byte order mark (BOM) + if(c == 0xFEFF) + { + return; + } + else if(c <= 0xFFFF) + { + EmitUnicodeSurrogate(c); + } + else + { + c -= 0x10000; + EmitUnicodeSurrogate(((c >> 10) & 0x3FF) + 0xD800); + EmitUnicodeSurrogate((c & 0x3FF) + 0xDC00); + } +} + +void cmWIXRichTextFormatWriter::EmitUnicodeSurrogate(int c) +{ + ControlWord("u"); + if(c <= 32767) + { + File << c; + } + else + { + File << (c - 65536); + } + File << "?"; +} + +void cmWIXRichTextFormatWriter::EmitInvalidCodepoint(int c) +{ + ControlWord("cf1 "); + File << "[INVALID-BYTE-" << int(c) << "]"; + ControlWord("cf0 "); +} diff --git a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h index bb8580a..38e40b0 100644 --- a/Source/CPack/WiX/cmWIXRichTextFormatWriter.h +++ b/Source/CPack/WiX/cmWIXRichTextFormatWriter.h @@ -30,6 +30,7 @@ public: private: void WriteHeader(); void WriteFontTable(); + void WriteColorTable(); void WriteGenerator(); void WriteDocumentPrefix(); @@ -40,6 +41,11 @@ private: void StartGroup(); void EndGroup(); + void EmitUnicodeCodepoint(int c); + void EmitUnicodeSurrogate(int c); + + void EmitInvalidCodepoint(int c); + std::ofstream File; }; diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 4c39d10..729f14a 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -139,6 +139,13 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test) } else { + + for(TestMap::iterator j = this->Tests.begin(); + j != this->Tests.end(); ++j) + { + j->second.erase(test); + } + this->UnlockResources(test); this->Completed++; this->TestFinishMap[test] = true; @@ -441,6 +448,19 @@ int cmCTestMultiProcessHandler::SearchByName(std::string name) //--------------------------------------------------------- void cmCTestMultiProcessHandler::CreateTestCostList() { + if(this->ParallelLevel > 1) + { + CreateParallelTestCostList(); + } + else + { + CreateSerialTestCostList(); + } +} + +//--------------------------------------------------------- +void cmCTestMultiProcessHandler::CreateParallelTestCostList() +{ TestSet alreadySortedTests; std::list<TestSet> priorityStack; @@ -452,8 +472,7 @@ void cmCTestMultiProcessHandler::CreateTestCostList() for(TestMap::const_iterator i = this->Tests.begin(); i != this->Tests.end(); ++i) { - if(this->ParallelLevel > 1 && - std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), + if(std::find(this->LastTestsFailed.begin(), this->LastTestsFailed.end(), this->Properties[i->first]->Name) != this->LastTestsFailed.end()) { //If the test failed last time, it should be run first. @@ -466,8 +485,9 @@ void cmCTestMultiProcessHandler::CreateTestCostList() } } - // Repeatedly move dependencies of the tests on the current dependency level - // to the next level until no further dependencies exist. + // In parallel test runs repeatedly move dependencies of the tests on + // the current dependency level to the next level until no + // further dependencies exist. while(priorityStack.back().size()) { TestSet &previousSet = priorityStack.back(); @@ -526,6 +546,65 @@ void cmCTestMultiProcessHandler::CreateTestCostList() } //--------------------------------------------------------- +void cmCTestMultiProcessHandler::GetAllTestDependencies( + int test, TestList& dependencies) +{ + TestSet const& dependencySet = this->Tests[test]; + for(TestSet::const_iterator i = dependencySet.begin(); + i != dependencySet.end(); ++i) + { + GetAllTestDependencies(*i, dependencies); + dependencies.push_back(*i); + } +} + +//--------------------------------------------------------- +void cmCTestMultiProcessHandler::CreateSerialTestCostList() +{ + TestList presortedList; + + for(TestMap::iterator i = this->Tests.begin(); + i != this->Tests.end(); ++i) + { + presortedList.push_back(i->first); + } + + TestComparator comp(this); + std::stable_sort(presortedList.begin(), presortedList.end(), comp); + + TestSet alreadySortedTests; + + for(TestList::const_iterator i = presortedList.begin(); + i != presortedList.end(); ++i) + { + int test = *i; + + if(alreadySortedTests.find(test) != alreadySortedTests.end()) + { + continue; + } + + TestList dependencies; + GetAllTestDependencies(test, dependencies); + + for(TestList::const_iterator j = dependencies.begin(); + j != dependencies.end(); ++j) + { + int testDependency = *j; + + if(alreadySortedTests.find(testDependency) == alreadySortedTests.end()) + { + alreadySortedTests.insert(testDependency); + this->SortedTests.push_back(testDependency); + } + } + + alreadySortedTests.insert(test); + this->SortedTests.push_back(test); + } +} + +//--------------------------------------------------------- void cmCTestMultiProcessHandler::WriteCheckpoint(int index) { std::string fname = this->CTest->GetBinaryDir() diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index 439a8f3..1b53ec7 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -72,6 +72,12 @@ protected: int SearchByName(std::string name); void CreateTestCostList(); + + void GetAllTestDependencies(int test, TestList& dependencies); + void CreateSerialTestCostList(); + + void CreateParallelTestCostList(); + // Removes the checkpoint file void MarkFinished(); void EraseTest(int index); diff --git a/Source/cmComputeLinkInformation.cxx b/Source/cmComputeLinkInformation.cxx index f3bdddd..6986965 100644 --- a/Source/cmComputeLinkInformation.cxx +++ b/Source/cmComputeLinkInformation.cxx @@ -1752,7 +1752,7 @@ cmComputeLinkInformation::AddLibraryRuntimeInfo(std::string const& fullPath, // @loader_path or full paths. if(this->Makefile->IsOn("CMAKE_PLATFORM_HAS_INSTALLNAME")) { - if(!target->HasMacOSXRpath(this->Config)) + if(!target->HasMacOSXRpathInstallNameDir(this->Config)) { return; } diff --git a/Source/cmExtraKateGenerator.cxx b/Source/cmExtraKateGenerator.cxx index 177ef8d..0312488 100644 --- a/Source/cmExtraKateGenerator.cxx +++ b/Source/cmExtraKateGenerator.cxx @@ -86,18 +86,28 @@ void cmExtraKateGenerator::WriteTargets(const cmMakefile* mf, cmGeneratedFileStream& fout) const { + const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); + const std::string makeArgs = mf->GetSafeDefinition( + "CMAKE_KATE_MAKE_ARGUMENTS"); + const char* homeOutputDir = mf->GetHomeOutputDirectory(); + fout << "\t\"build\": {\n" "\t\t\"directory\": \"" << mf->GetHomeOutputDirectory() << "\",\n" "\t\t\"default_target\": \"all\",\n" - "\t\t\"prev_target\": \"all\",\n" - "\t\t\"clean_target\": \"clean\",\n" - "\t\t\"targets\":[\n"; + "\t\t\"clean_target\": \"clean\",\n"; - const std::string make = mf->GetRequiredDefinition("CMAKE_MAKE_PROGRAM"); - const std::string makeArgs = mf->GetSafeDefinition( - "CMAKE_KATE_MAKE_ARGUMENTS"); - const char* homeOutputDir = mf->GetHomeOutputDirectory(); + // build, clean and quick are for the build plugin kate <= 4.12: + fout << "\t\t\"build\": \"" << make << " -C " << homeOutputDir + << " " << makeArgs << " " << "all\",\n"; + fout << "\t\t\"clean\": \"" << make << " -C " << homeOutputDir + << " " << makeArgs << " " << "clean\",\n"; + fout << "\t\t\"quick\": \"" << make << " -C " << homeOutputDir + << " " << makeArgs << " " << "install\",\n"; + + // this is for kate >= 4.13: + fout << + "\t\t\"targets\":[\n"; this->AppendTarget(fout, "all", make, makeArgs, homeOutputDir, homeOutputDir); @@ -237,7 +247,8 @@ cmExtraKateGenerator::CreateDummyKateProjectFile(const cmMakefile* mf) const return; } - fout << "#Generated by cmake, do not edit.\n"; + fout << "#Generated by " << mf->GetRequiredDefinition("CMAKE_COMMAND") + << ", do not edit.\n"; } diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 227a948..3b858af 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1045,6 +1045,12 @@ cmGlobalGenerator::GetExportedTargetsFile(const std::string &filename) const return it == this->BuildExportSets.end() ? 0 : it->second; } +//---------------------------------------------------------------------------- +void cmGlobalGenerator::AddCMP0042WarnTarget(const std::string& target) +{ + this->CMP0042WarnTargets.insert(target); +} + bool cmGlobalGenerator::CheckALLOW_DUPLICATE_CUSTOM_TARGETS() { // If the property is not enabled then okay. @@ -1072,6 +1078,9 @@ void cmGlobalGenerator::Generate() // Start with an empty vector: this->FilesReplacedDuringGenerate.clear(); + // clear targets to issue warning CMP0042 for + this->CMP0042WarnTargets.clear(); + // Check whether this generator is allowed to run. if(!this->CheckALLOW_DUPLICATE_CUSTOM_TARGETS()) { @@ -1203,6 +1212,25 @@ void cmGlobalGenerator::Generate() this->ExtraGenerator->Generate(); } + if(!this->CMP0042WarnTargets.empty()) + { + cmOStringStream w; + w << + (this->GetCMakeInstance()->GetPolicies()-> + GetPolicyWarning(cmPolicies::CMP0042)) << "\n"; + w << "MACOSX_RPATH is not specified for" + " the following targets:\n"; + for(std::set<std::string>::iterator + iter = this->CMP0042WarnTargets.begin(); + iter != this->CMP0042WarnTargets.end(); + ++iter) + { + w << " " << *iter << "\n"; + } + this->GetCMakeInstance()->IssueMessage(cmake::AUTHOR_WARNING, w.str(), + cmListFileBacktrace()); + } + this->CMakeInstance->UpdateProgress("Generating done", -1); } diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index f60d24d..049b0e6 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -315,6 +315,8 @@ public: bool GenerateImportFile(const std::string &file); cmExportBuildFileGenerator* GetExportedTargetsFile(const std::string &filename) const; + void AddCMP0042WarnTarget(const std::string& target); + protected: typedef std::vector<cmLocalGenerator*> GeneratorVector; // for a project collect all its targets by following depend @@ -449,6 +451,9 @@ private: // Set of binary directories on disk. std::set<cmStdString> BinaryDirectories; + + // track targets to issue CMP0042 warning for. + std::set<std::string> CMP0042WarnTargets; }; #endif diff --git a/Source/cmLocalXCodeGenerator.cxx b/Source/cmLocalXCodeGenerator.cxx index 7c5f69d..a9a27b9 100644 --- a/Source/cmLocalXCodeGenerator.cxx +++ b/Source/cmLocalXCodeGenerator.cxx @@ -12,6 +12,7 @@ #include "cmLocalXCodeGenerator.h" #include "cmGlobalXCodeGenerator.h" #include "cmSourceFile.h" +#include "cmMakefile.h" //---------------------------------------------------------------------------- cmLocalXCodeGenerator::cmLocalXCodeGenerator() @@ -42,3 +43,31 @@ void cmLocalXCodeGenerator::AppendFlagEscape(std::string& flags, static_cast<cmGlobalXCodeGenerator*>(this->GlobalGenerator); gg->AppendFlag(flags, rawFlag); } + +//---------------------------------------------------------------------------- +void cmLocalXCodeGenerator::Generate() +{ + cmLocalGenerator::Generate(); + + cmTargets& targets = this->Makefile->GetTargets(); + for(cmTargets::iterator iter = targets.begin(); + iter != targets.end(); ++iter) + { + cmTarget* t = &iter->second; + t->HasMacOSXRpathInstallNameDir(NULL); + } +} + +//---------------------------------------------------------------------------- +void cmLocalXCodeGenerator::GenerateInstallRules() +{ + cmLocalGenerator::GenerateInstallRules(); + + cmTargets& targets = this->Makefile->GetTargets(); + for(cmTargets::iterator iter = targets.begin(); + iter != targets.end(); ++iter) + { + cmTarget* t = &iter->second; + t->HasMacOSXRpathInstallNameDir(NULL); + } +} diff --git a/Source/cmLocalXCodeGenerator.h b/Source/cmLocalXCodeGenerator.h index d97a41c..edd2f5b 100644 --- a/Source/cmLocalXCodeGenerator.h +++ b/Source/cmLocalXCodeGenerator.h @@ -29,6 +29,8 @@ public: virtual ~cmLocalXCodeGenerator(); virtual std::string GetTargetDirectory(cmTarget const& target) const; virtual void AppendFlagEscape(std::string& flags, const char* rawFlag); + virtual void Generate(); + virtual void GenerateInstallRules(); private: }; diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index 69fe444..69b8092 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -338,13 +338,11 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) vars.CMTarget = this->Target; vars.Language = linkLanguage; vars.Objects = buildObjs.c_str(); - std::string objdir = cmake::GetCMakeFilesDirectoryPostSlash(); - objdir += this->Target->GetName(); - objdir += ".dir"; - objdir = this->Convert(objdir.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL); - vars.ObjectDir = objdir.c_str(); + std::string objectDir = this->Target->GetSupportDirectory(); + objectDir = this->Convert(objectDir.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + vars.ObjectDir = objectDir.c_str(); vars.Target = targetOutPathReal.c_str(); vars.TargetPDB = targetOutPathPDB.c_str(); diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 399b582..d6a0cd4 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -580,13 +580,11 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules vars.CMTarget = this->Target; vars.Language = linkLanguage; vars.Objects = buildObjs.c_str(); - std::string objdir = cmake::GetCMakeFilesDirectoryPostSlash(); - objdir += this->Target->GetName(); - objdir += ".dir"; - objdir = this->Convert(objdir.c_str(), - cmLocalGenerator::START_OUTPUT, - cmLocalGenerator::SHELL); - vars.ObjectDir = objdir.c_str(); + std::string objectDir = this->Target->GetSupportDirectory(); + objectDir = this->Convert(objectDir.c_str(), + cmLocalGenerator::START_OUTPUT, + cmLocalGenerator::SHELL); + vars.ObjectDir = objectDir.c_str(); vars.Target = targetOutPathReal.c_str(); vars.LinkLibraries = linkLibs.c_str(); vars.ObjectsQuoted = buildObjs.c_str(); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 6e70285..f82b808 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -647,7 +647,7 @@ cmMakefileTargetGenerator cmLocalGenerator::NONE, cmLocalGenerator::SHELL).c_str(); vars.Object = shellObj.c_str(); - std::string objectDir = cmSystemTools::GetFilenamePath(obj); + std::string objectDir = this->Target->GetSupportDirectory(); objectDir = this->Convert(objectDir.c_str(), cmLocalGenerator::START_OUTPUT, cmLocalGenerator::SHELL); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index e3c058f..c8b03e1 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -568,7 +568,7 @@ cmNinjaTargetGenerator } EnsureParentDirectoryExists(objectFileName); - std::string objectDir = cmSystemTools::GetFilenamePath(objectFileName); + std::string objectDir = this->Target->GetSupportDirectory(); vars["OBJECT_DIR"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(objectDir.c_str()).c_str(), cmLocalGenerator::SHELL); diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0b3018e..987c663 100644 --- a/Source/cmPolicies.cxx +++ b/Source/cmPolicies.cxx @@ -311,6 +311,11 @@ cmPolicies::cmPolicies() CMP0041, "CMP0041", "Error on relative include with generator expression.", 3,0,0,0, cmPolicies::WARN); + + this->DefinePolicy( + CMP0042, "CMP0042", + "MACOSX_RPATH is enabled by default.", + 3,0,0,0, cmPolicies::WARN); } cmPolicies::~cmPolicies() diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index 245ec4b..66eaf87 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -95,6 +95,7 @@ public: CMP0040, ///< The target in the TARGET signature of /// add_custom_command() must exist. CMP0041, ///< Error on relative include with generator expression + CMP0042, ///< Enable MACOSX_RPATH by default /** \brief Always the last entry. * diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a0177fb..9faf0d9 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3186,13 +3186,17 @@ std::string cmTarget::GetSOName(const char* config) const } //---------------------------------------------------------------------------- -bool cmTarget::HasMacOSXRpath(const char* config) const +bool cmTarget::HasMacOSXRpathInstallNameDir(const char* config) const { bool install_name_is_rpath = false; - bool macosx_rpath = this->GetPropertyAsBool("MACOSX_RPATH"); + bool macosx_rpath = false; if(!this->IsImportedTarget) { + if(this->GetType() != cmTarget::SHARED_LIBRARY) + { + return false; + } const char* install_name = this->GetProperty("INSTALL_NAME_DIR"); bool use_install_name = this->GetPropertyAsBool("BUILD_WITH_INSTALL_RPATH"); @@ -3205,6 +3209,10 @@ bool cmTarget::HasMacOSXRpath(const char* config) const { return false; } + if(!install_name_is_rpath) + { + macosx_rpath = this->MacOSXRpathInstallNameDirDefault(); + } } else { @@ -3259,6 +3267,37 @@ bool cmTarget::HasMacOSXRpath(const char* config) const } //---------------------------------------------------------------------------- +bool cmTarget::MacOSXRpathInstallNameDirDefault() const +{ + // we can't do rpaths when unsupported + if(!this->Makefile->IsSet("CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG")) + { + return false; + } + + const char* macosx_rpath_str = this->GetProperty("MACOSX_RPATH"); + if(macosx_rpath_str) + { + return this->GetPropertyAsBool("MACOSX_RPATH"); + } + + cmPolicies::PolicyStatus cmp0042 = this->GetPolicyStatusCMP0042(); + + if(cmp0042 == cmPolicies::WARN) + { + this->Makefile->GetLocalGenerator()->GetGlobalGenerator()-> + AddCMP0042WarnTarget(this->GetName()); + } + + if(cmp0042 == cmPolicies::NEW) + { + return true; + } + + return false; +} + +//---------------------------------------------------------------------------- bool cmTarget::IsImportedSharedLibWithoutSOName(const char* config) const { if(this->IsImported() && this->GetType() == cmTarget::SHARED_LIBRARY) @@ -3847,7 +3886,8 @@ std::string cmTarget::GetInstallNameDirForBuildTree(const char* config) const !this->GetPropertyAsBool("SKIP_BUILD_RPATH")) { std::string dir; - if(this->GetPropertyAsBool("MACOSX_RPATH")) + bool macosx_rpath = this->MacOSXRpathInstallNameDirDefault(); + if(macosx_rpath) { dir = "@rpath"; } @@ -3881,9 +3921,12 @@ std::string cmTarget::GetInstallNameDirForInstallTree() const dir += "/"; } } - if(!install_name_dir && this->GetPropertyAsBool("MACOSX_RPATH")) + if(!install_name_dir) { - dir = "@rpath/"; + if(this->MacOSXRpathInstallNameDirDefault()) + { + dir = "@rpath/"; + } } return dir; } diff --git a/Source/cmTarget.h b/Source/cmTarget.h index bf4a8ef..e026c59 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -26,7 +26,8 @@ F(CMP0020) \ F(CMP0021) \ F(CMP0022) \ - F(CMP0041) + F(CMP0041) \ + F(CMP0042) class cmake; class cmMakefile; @@ -382,7 +383,10 @@ public: std::string GetSOName(const char* config) const; /** Whether this library has \@rpath and platform supports it. */ - bool HasMacOSXRpath(const char* config) const; + bool HasMacOSXRpathInstallNameDir(const char* config) const; + + /** Whether this library defaults to \@rpath. */ + bool MacOSXRpathInstallNameDirDefault() const; /** Test for special case of a third-party shared library that has no soname at all. */ diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 3745f78..24ea518 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -1136,6 +1136,11 @@ IF(KWSYS_STANDALONE OR CMake_SOURCE_DIR) testEncoding ) ENDIF(KWSYS_STL_HAS_WSTRING) + IF(KWSYS_USE_FStream) + SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} + testFStream + ) + ENDIF(KWSYS_USE_FStream) IF(KWSYS_USE_SystemInformation) SET(KWSYS_CXX_TESTS ${KWSYS_CXX_TESTS} testSystemInformation) ENDIF(KWSYS_USE_SystemInformation) diff --git a/Source/kwsys/FStream.hxx.in b/Source/kwsys/FStream.hxx.in index c340c55..916a93e 100644 --- a/Source/kwsys/FStream.hxx.in +++ b/Source/kwsys/FStream.hxx.in @@ -25,8 +25,9 @@ namespace @KWSYS_NAMESPACE@ typedef std::basic_filebuf<CharType,Traits> my_base_type; basic_filebuf *open(char const *s,std::ios_base::openmode mode) { - my_base_type::open(Encoding::ToWide(s).c_str(), mode); - return this; + return static_cast<basic_filebuf*>( + my_base_type::open(Encoding::ToWide(s).c_str(), mode) + ); } }; diff --git a/Source/kwsys/testFStream.cxx b/Source/kwsys/testFStream.cxx new file mode 100644 index 0000000..8942549 --- /dev/null +++ b/Source/kwsys/testFStream.cxx @@ -0,0 +1,48 @@ +/*============================================================================ + KWSys - Kitware System Library + Copyright 2000-2009 Kitware, Inc., Insight Software Consortium + + Distributed under the OSI-approved BSD License (the "License"); + see accompanying file Copyright.txt for details. + + This software is distributed WITHOUT ANY WARRANTY; without even the + implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + See the License for more information. +============================================================================*/ +#include "kwsysPrivate.h" + +#if defined(_MSC_VER) +# pragma warning (disable:4786) +#endif + +#include KWSYS_HEADER(FStream.hxx) + +// Work-around CMake dependency scanning limitation. This must +// duplicate the above list of headers. +#if 0 +# include "FStream.hxx.in" +#endif + + +//---------------------------------------------------------------------------- +static int testNoFile() +{ + kwsys::ifstream in_file("NoSuchFile.txt"); + if(in_file) + { + return 1; + } + + return 0; +} + + +//---------------------------------------------------------------------------- +int testFStream(int, char*[]) +{ + int ret = 0; + + ret |= testNoFile(); + + return ret; +} |