diff options
Diffstat (limited to 'Source')
28 files changed, 260 insertions, 306 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 16b9ea1..e2a7ff2 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -502,6 +502,10 @@ if (WIN32) cmGhsMultiGpj.cxx cmGhsMultiGpj.h ) + + # Add a manifest file to executables on Windows to allow for + # GetVersion to work properly on Windows 8 and above. + set(MANIFEST_FILE ${CMAKE_CURRENT_SOURCE_DIR}/cmake.version.manifest) endif() endif () @@ -531,7 +535,7 @@ set(SRCS ${SRCS} if(WIN32 AND NOT CYGWIN) set_source_files_properties(cmcldeps.cxx PROPERTIES COMPILE_DEFINITIONS _WIN32_WINNT=0x0501) - add_executable(cmcldeps cmcldeps.cxx) + add_executable(cmcldeps cmcldeps.cxx ${MANIFEST_FILE}) target_link_libraries(cmcldeps CMakeLib) install(TARGETS cmcldeps DESTINATION bin) endif() @@ -720,15 +724,15 @@ if(APPLE) endif() # Build CMake executable -add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h) +add_executable(cmake cmakemain.cxx cmcmd.cxx cmcmd.h ${MANIFEST_FILE}) target_link_libraries(cmake CMakeLib) # Build CTest executable -add_executable(ctest ctest.cxx) +add_executable(ctest ctest.cxx ${MANIFEST_FILE}) target_link_libraries(ctest CTestLib) # Build CPack executable -add_executable(cpack CPack/cpack.cxx) +add_executable(cpack CPack/cpack.cxx ${MANIFEST_FILE}) target_link_libraries(cpack CPackLib) # Curses GUI diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 17f8db5..0265ae0 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 3) -set(CMake_VERSION_PATCH 20150921) +set(CMake_VERSION_PATCH 20150926) #set(CMake_VERSION_RC 1) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 570b537..66fd18b 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -152,7 +152,7 @@ endif() set(CMAKE_INCLUDE_CURRENT_DIR ON) -add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) +add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS} ${MANIFEST_FILE}) target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${CMake_QT_LIBRARIES}) if(APPLE) diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx index 9411555..3d9c4bf 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -29,7 +29,7 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) const char* sourceDirectory = argv[2].c_str(); const char* projectName = 0; std::string targetName; - std::vector<std::string> cmakeFlags; + std::vector<std::string> cmakeFlags(1, "CMAKE_FLAGS"); // fake argv[0] std::vector<std::string> compileDefs; std::string outputVariable; std::string copyFile; @@ -53,10 +53,6 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) if(argv[i] == "CMAKE_FLAGS") { doing = DoingCMakeFlags; - // CMAKE_FLAGS is the first argument because we need an argv[0] that - // is not used, so it matches regular command line parsing which has - // the program name as arg 0 - cmakeFlags.push_back(argv[i]); } else if(argv[i] == "COMPILE_DEFINITIONS") { @@ -481,6 +477,16 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv) fprintf(fout, "set(CMAKE_LINK_SEARCH_END_STATIC \"%s\")\n", lssDef); } + /* Set the appropriate policy information for ENABLE_EXPORTS */ + fprintf(fout, "cmake_policy(SET CMP0065 %s)\n", + this->Makefile->GetPolicyStatus(cmPolicies::CMP0065) == + cmPolicies::NEW ? "NEW" : "OLD"); + if(const char *ee = this->Makefile->GetDefinition( + "CMAKE_ENABLE_EXPORTS")) + { + fprintf(fout, "set(CMAKE_ENABLE_EXPORTS %s)\n", ee); + } + /* Put the executable at a known location (for COPY_FILE). */ fprintf(fout, "set(CMAKE_RUNTIME_OUTPUT_DIRECTORY \"%s\")\n", this->BinaryDirectory.c_str()); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 7aa8bb6..3589e82 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1091,6 +1091,18 @@ void cmGlobalGenerator::ClearEnabledLanguages() return this->CMakeInstance->GetState()->ClearEnabledLanguages(); } +void cmGlobalGenerator::CreateLocalGenerators() +{ + cmDeleteAll(this->LocalGenerators); + this->LocalGenerators.clear(); + this->LocalGenerators.reserve(this->Makefiles.size()); + for (std::vector<cmMakefile*>::const_iterator it = this->Makefiles.begin(); + it != this->Makefiles.end(); ++it) + { + this->LocalGenerators.push_back(this->CreateLocalGenerator(*it)); + } +} + void cmGlobalGenerator::Configure() { this->FirstTimeProgress = 0.0f; @@ -1099,8 +1111,6 @@ void cmGlobalGenerator::Configure() cmMakefile* dirMf = new cmMakefile(this, this->GetCMakeInstance()->GetCurrentSnapshot()); this->Makefiles.push_back(dirMf); - cmLocalGenerator *lg = this->CreateLocalGenerator(dirMf); - this->LocalGenerators.push_back(lg); // set the Start directories dirMf->SetCurrentSourceDirectory @@ -1175,6 +1185,7 @@ void cmGlobalGenerator::Configure() void cmGlobalGenerator::CreateGenerationObjects(TargetTypes targetTypes) { + this->CreateLocalGenerators(); cmDeleteAll(this->GeneratorTargets); this->GeneratorTargets.clear(); this->CreateGeneratorTargets(targetTypes); @@ -1246,11 +1257,6 @@ bool cmGlobalGenerator::Compute() unsigned int i; - for (i = 0; i < this->LocalGenerators.size(); ++i) - { - this->LocalGenerators[i]->ComputeObjectMaxPath(); - } - // Add generator specific helper commands for (i = 0; i < this->LocalGenerators.size(); ++i) { @@ -1936,12 +1942,6 @@ void cmGlobalGenerator::AddMakefile(cmMakefile *mf) this->CMakeInstance->UpdateProgress("Configuring", prog); } -//---------------------------------------------------------------------------- -void cmGlobalGenerator::AddLocalGenerator(cmLocalGenerator *lg) -{ - this->LocalGenerators.push_back(lg); -} - void cmGlobalGenerator::AddInstallComponent(const char* component) { if(component && *component) diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 40f98dc..83cbc3f 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -186,7 +186,6 @@ public: {this->CurrentMakefile = mf;} void AddMakefile(cmMakefile *mf); - void AddLocalGenerator(cmLocalGenerator *lg); ///! Set an generator for an "external makefile based project" void SetExternalMakefileProjectGenerator( @@ -466,6 +465,8 @@ private: virtual void ForceLinkerLanguages(); + void CreateLocalGenerators(); + void CheckCompilerIdCompatibility(cmMakefile* mf, std::string const& lang) const; diff --git a/Source/cmGlobalUnixMakefileGenerator3.cxx b/Source/cmGlobalUnixMakefileGenerator3.cxx index cf4fd69..0064713 100644 --- a/Source/cmGlobalUnixMakefileGenerator3.cxx +++ b/Source/cmGlobalUnixMakefileGenerator3.cxx @@ -578,23 +578,18 @@ void cmGlobalUnixMakefileGenerator3 if (!targetName.empty()) { cmMakefile* mf; - cmLocalUnixMakefileGenerator3 *lg; - if (!this->LocalGenerators.empty()) + if (!this->Makefiles.empty()) { - lg = static_cast<cmLocalUnixMakefileGenerator3 *> - (this->LocalGenerators[0]); - mf = lg->GetMakefile(); + mf = this->Makefiles[0]; } else { cmState::Snapshot snapshot = this->CMakeInstance->GetCurrentSnapshot(); mf = new cmMakefile(this, snapshot); - lg = static_cast<cmLocalUnixMakefileGenerator3 *> - (this->CreateLocalGenerator(mf)); // set the Start directories - lg->GetMakefile()->SetCurrentSourceDirectory + mf->SetCurrentSourceDirectory (this->CMakeInstance->GetHomeDirectory()); - lg->GetMakefile()->SetCurrentBinaryDirectory + mf->SetCurrentBinaryDirectory (this->CMakeInstance->GetHomeOutputDirectory()); } @@ -603,12 +598,12 @@ void cmGlobalUnixMakefileGenerator3 { tname += "/fast"; } - tname = lg->Convert(tname,cmLocalGenerator::HOME_OUTPUT); + cmOutputConverter conv(mf->GetStateSnapshot()); + tname = conv.Convert(tname,cmOutputConverter::HOME_OUTPUT); cmSystemTools::ConvertToOutputSlashes(tname); makeCommand.push_back(tname); - if (this->LocalGenerators.empty()) + if (this->Makefiles.empty()) { - delete lg; delete mf; } } diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index df49948..14de698 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -217,7 +217,7 @@ void cmGlobalVisualStudio6Generator TargetDependSet projectTargets; TargetDependSet originalTargets; this->GetTargetSets(projectTargets, originalTargets, root, generators); - OrderedTargetDependSet orderedProjectTargets(projectTargets); + OrderedTargetDependSet orderedProjectTargets(projectTargets, "ALL_BUILD"); for(OrderedTargetDependSet::const_iterator tt = orderedProjectTargets.begin(); diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 607642c..b913afc 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -94,7 +94,7 @@ void cmGlobalVisualStudio71Generator TargetDependSet projectTargets; TargetDependSet originalTargets; this->GetTargetSets(projectTargets, originalTargets, root, generators); - OrderedTargetDependSet orderedProjectTargets(projectTargets); + OrderedTargetDependSet orderedProjectTargets(projectTargets, "ALL_BUILD"); this->WriteTargetsToSolution(fout, root, orderedProjectTargets); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0175062..05da022 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -568,7 +568,7 @@ void cmGlobalVisualStudio7Generator TargetDependSet projectTargets; TargetDependSet originalTargets; this->GetTargetSets(projectTargets, originalTargets, root, generators); - OrderedTargetDependSet orderedProjectTargets(projectTargets); + OrderedTargetDependSet orderedProjectTargets(projectTargets, "ALL_BUILD"); this->WriteTargetsToSolution(fout, root, orderedProjectTargets); diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 28f0425..70c00e9 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -449,7 +449,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectDepends( { cmGeneratorTarget* gt = this->GetGeneratorTarget(&t); TargetDependSet const& unordered = this->GetTargetDirectDepends(gt); - OrderedTargetDependSet depends(unordered); + OrderedTargetDependSet depends(unordered, std::string()); for(OrderedTargetDependSet::const_iterator i = depends.begin(); i != depends.end(); ++i) { diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index 2bf04b4..e7cc8ff 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -864,28 +864,34 @@ bool cmGlobalVisualStudioGenerator::TargetCompare ::operator()(cmGeneratorTarget const* l, cmGeneratorTarget const* r) const { - // Make sure ALL_BUILD is first so it is the default active project. - if(r->GetName() == "ALL_BUILD") + // Make sure a given named target is ordered first, + // e.g. to set ALL_BUILD as the default active project. + // When the empty string is named this is a no-op. + if (r->GetName() == this->First) { return false; } - if(l->GetName() == "ALL_BUILD") + if (l->GetName() == this->First) { return true; } - return strcmp(l->GetName().c_str(), r->GetName().c_str()) < 0; + return l->GetName() < r->GetName(); } //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::OrderedTargetDependSet -::OrderedTargetDependSet(TargetDependSet const& targets) +::OrderedTargetDependSet(TargetDependSet const& targets, + std::string const& first): + derived(TargetCompare(first)) { this->insert(targets.begin(), targets.end()); } //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::OrderedTargetDependSet -::OrderedTargetDependSet(TargetSet const& targets) +::OrderedTargetDependSet(TargetSet const& targets, + std::string const& first): + derived(TargetCompare(first)) { for (TargetSet::const_iterator it = targets.begin(); it != targets.end(); ++it) diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 64440ad..c940eb3 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -89,8 +89,11 @@ public: virtual bool TargetsWindowsCE() const { return false; } class TargetSet: public std::set<cmTarget const*> {}; - struct TargetCompare + class TargetCompare { + std::string First; + public: + TargetCompare(std::string const& first): First(first) {} bool operator()(cmGeneratorTarget const* l, cmGeneratorTarget const* r) const; }; @@ -151,11 +154,14 @@ class cmGlobalVisualStudioGenerator::OrderedTargetDependSet: public std::multiset<cmTargetDepend, cmGlobalVisualStudioGenerator::TargetCompare> { + typedef std::multiset<cmTargetDepend, + cmGlobalVisualStudioGenerator::TargetCompare> + derived; public: typedef cmGlobalGenerator::TargetDependSet TargetDependSet; typedef cmGlobalVisualStudioGenerator::TargetSet TargetSet; - OrderedTargetDependSet(TargetDependSet const&); - OrderedTargetDependSet(TargetSet const&); + OrderedTargetDependSet(TargetDependSet const&, std::string const& first); + OrderedTargetDependSet(TargetSet const&, std::string const& first); }; #endif diff --git a/Source/cmInstallDirectoryGenerator.cxx b/Source/cmInstallDirectoryGenerator.cxx index 7593380..78cb5f0 100644 --- a/Source/cmInstallDirectoryGenerator.cxx +++ b/Source/cmInstallDirectoryGenerator.cxx @@ -12,6 +12,8 @@ #include "cmInstallDirectoryGenerator.h" #include "cmTarget.h" +#include "cmGeneratorExpression.h" +#include "cmLocalGenerator.h" //---------------------------------------------------------------------------- cmInstallDirectoryGenerator @@ -25,10 +27,16 @@ cmInstallDirectoryGenerator const char* literal_args, bool optional): cmInstallGenerator(dest, configurations, component, message), + LocalGenerator(0), Directories(dirs), FilePermissions(file_permissions), DirPermissions(dir_permissions), LiteralArguments(literal_args), Optional(optional) { + // We need per-config actions if destination have generator expressions. + if(cmGeneratorExpression::Find(Destination) != std::string::npos) + { + this->ActionsPerConfig = true; + } } //---------------------------------------------------------------------------- @@ -37,15 +45,43 @@ cmInstallDirectoryGenerator { } +void cmInstallDirectoryGenerator::Compute(cmLocalGenerator* lg) +{ + LocalGenerator = lg; +} + //---------------------------------------------------------------------------- void cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, Indent const& indent) { + if(this->ActionsPerConfig) + { + this->cmInstallGenerator::GenerateScriptActions(os, indent); + } + else + { + this->AddDirectoryInstallRule(os, "", indent); + } +} + +void cmInstallDirectoryGenerator::GenerateScriptForConfig( + std::ostream& os, + const std::string& config, + Indent const& indent) +{ + this->AddDirectoryInstallRule(os, config, indent); +} + +void cmInstallDirectoryGenerator::AddDirectoryInstallRule( + std::ostream& os, + const std::string& config, + Indent const& indent) +{ // Write code to install the directories. const char* no_rename = 0; this->AddInstallRule(os, - this->Destination, + this->GetDestination(config), cmInstallType_DIRECTORY, this->Directories, this->Optional, @@ -54,3 +90,12 @@ cmInstallDirectoryGenerator::GenerateScriptActions(std::ostream& os, no_rename, this->LiteralArguments.c_str(), indent); } + +//---------------------------------------------------------------------------- +std::string +cmInstallDirectoryGenerator::GetDestination(std::string const& config) const +{ + cmGeneratorExpression ge; + return ge.Parse(this->Destination) + ->Evaluate(this->LocalGenerator->GetMakefile(), config); +} diff --git a/Source/cmInstallDirectoryGenerator.h b/Source/cmInstallDirectoryGenerator.h index 165ab91..04107e1 100644 --- a/Source/cmInstallDirectoryGenerator.h +++ b/Source/cmInstallDirectoryGenerator.h @@ -31,8 +31,19 @@ public: bool optional = false); virtual ~cmInstallDirectoryGenerator(); + void Compute(cmLocalGenerator* lg); + + std::string GetDestination(std::string const& config) const; + protected: virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); + virtual void GenerateScriptForConfig(std::ostream& os, + const std::string& config, + Indent const& indent); + void AddDirectoryInstallRule(std::ostream& os, + const std::string& config, + Indent const& indent); + cmLocalGenerator* LocalGenerator; std::vector<std::string> Directories; std::string FilePermissions; std::string DirPermissions; diff --git a/Source/cmInstallFilesGenerator.cxx b/Source/cmInstallFilesGenerator.cxx index c18b174..e2c16c8 100644 --- a/Source/cmInstallFilesGenerator.cxx +++ b/Source/cmInstallFilesGenerator.cxx @@ -34,6 +34,12 @@ cmInstallFilesGenerator Programs(programs), Optional(optional) { + // We need per-config actions if the destination has generator expressions. + if(cmGeneratorExpression::Find(Destination) != std::string::npos) + { + this->ActionsPerConfig = true; + } + // We need per-config actions if any files have generator expressions. for(std::vector<std::string>::const_iterator i = files.begin(); !this->ActionsPerConfig && i != files.end(); ++i) @@ -57,14 +63,25 @@ void cmInstallFilesGenerator::Compute(cmLocalGenerator* lg) } //---------------------------------------------------------------------------- +std::string +cmInstallFilesGenerator::GetDestination(std::string const& config) const +{ + cmGeneratorExpression ge; + return ge.Parse(this->Destination) + ->Evaluate(this->LocalGenerator->GetMakefile(), config); +} + +//---------------------------------------------------------------------------- void cmInstallFilesGenerator::AddFilesInstallRule( - std::ostream& os, Indent const& indent, + std::ostream& os, + const std::string config, + Indent const& indent, std::vector<std::string> const& files) { // Write code to install the files. const char* no_dir_permissions = 0; this->AddInstallRule(os, - this->Destination, + this->GetDestination(config), (this->Programs ? cmInstallType_PROGRAMS : cmInstallType_FILES), @@ -84,7 +101,7 @@ void cmInstallFilesGenerator::GenerateScriptActions(std::ostream& os, } else { - this->AddFilesInstallRule(os, indent, this->Files); + this->AddFilesInstallRule(os, "", indent, this->Files); } } @@ -102,5 +119,5 @@ void cmInstallFilesGenerator::GenerateScriptForConfig(std::ostream& os, cmSystemTools::ExpandListArgument(cge->Evaluate( this->LocalGenerator->GetMakefile(), config), files); } - this->AddFilesInstallRule(os, indent, files); + this->AddFilesInstallRule(os, config, indent, files); } diff --git a/Source/cmInstallFilesGenerator.h b/Source/cmInstallFilesGenerator.h index 00b3a79..bfe4039 100644 --- a/Source/cmInstallFilesGenerator.h +++ b/Source/cmInstallFilesGenerator.h @@ -32,12 +32,16 @@ public: void Compute(cmLocalGenerator* lg); + std::string GetDestination(std::string const& config) const; + protected: virtual void GenerateScriptActions(std::ostream& os, Indent const& indent); virtual void GenerateScriptForConfig(std::ostream& os, const std::string& config, Indent const& indent); - void AddFilesInstallRule(std::ostream& os, Indent const& indent, + void AddFilesInstallRule(std::ostream& os, + const std::string config, + Indent const& indent, std::vector<std::string> const& files); cmLocalGenerator* LocalGenerator; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 4418ead..f4de0f2 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -54,6 +54,8 @@ cmLocalGenerator::cmLocalGenerator(cmGlobalGenerator* gg, this->EmitUniversalBinaryFlags = true; this->BackwardsCompatibility = 0; this->BackwardsCompatibilityFinal = false; + + this->ComputeObjectMaxPath(); } cmLocalGenerator::~cmLocalGenerator() @@ -1540,13 +1542,47 @@ void cmLocalGenerator::OutputLinkLibraries(std::string& linkLibraries, this->Makefile->GetSafeDefinition("CMAKE_LIBRARY_PATH_TERMINATOR"); // Flags to link an executable to shared libraries. - std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_"; - linkFlagsVar += linkLanguage; - linkFlagsVar += "_FLAGS"; if( tgt.GetType() == cmTarget::EXECUTABLE ) { - linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar); - linkLibs += " "; + bool add_shlib_flags = false; + switch(tgt.Target->GetPolicyStatusCMP0065()) + { + case cmPolicies::WARN: + if(!tgt.GetPropertyAsBool("ENABLE_EXPORTS") && + this->Makefile->PolicyOptionalWarningEnabled( + "CMAKE_POLICY_WARNING_CMP0065")) + { + std::ostringstream w; + w << cmPolicies::GetPolicyWarning(cmPolicies::CMP0065) << "\n" + "For compatibility with older versions of CMake, " + "additional flags may be added to export symbols on all " + "executables regardless of thier ENABLE_EXPORTS property."; + this->Makefile->IssueMessage(cmake::AUTHOR_WARNING, w.str()); + } + case cmPolicies::OLD: + // OLD behavior is to always add the flags + add_shlib_flags = true; + break; + case cmPolicies::REQUIRED_IF_USED: + case cmPolicies::REQUIRED_ALWAYS: + this->Makefile->IssueMessage( + cmake::FATAL_ERROR, + cmPolicies::GetRequiredPolicyError(cmPolicies::CMP0065) + ); + case cmPolicies::NEW: + // NEW behavior is to only add the flags if ENABLE_EXPORTS is on + add_shlib_flags = tgt.GetPropertyAsBool("ENABLE_EXPORTS"); + break; + } + + if(add_shlib_flags) + { + std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_"; + linkFlagsVar += linkLanguage; + linkFlagsVar += "_FLAGS"; + linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar); + linkLibs += " "; + } } // Append the framework search path flags. diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 771131f..6ea414a 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -300,7 +300,6 @@ public: void CreateEvaluationFileOutputs(const std::string& config); void ProcessEvaluationFiles(std::vector<std::string>& generatedFiles); - void ComputeObjectMaxPath(); protected: ///! put all the libraries for a target on into the given stream void OutputLinkLibraries(std::string& linkLibraries, @@ -360,6 +359,8 @@ private: bool GetShouldUseOldFlags(bool shared, const std::string &lang) const; void AddPositionIndependentFlags(std::string& flags, std::string const& l, int targetType); + + void ComputeObjectMaxPath(); }; #endif diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 8a3d197..6480667 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -1756,11 +1756,6 @@ void cmMakefile::AddSubDirectory(const std::string& srcPath, cmMakefile* subMf = new cmMakefile(this->GlobalGenerator, newSnapshot); this->GetGlobalGenerator()->AddMakefile(subMf); - // create a new local generator and set its parent - cmLocalGenerator *lg2 = this->GetGlobalGenerator() - ->CreateLocalGenerator(subMf); - this->GetGlobalGenerator()->AddLocalGenerator(lg2); - // set the subdirs start dirs subMf->SetCurrentSourceDirectory(srcPath); subMf->SetCurrentBinaryDirectory(binPath); diff --git a/Source/cmMessageCommand.cxx b/Source/cmMessageCommand.cxx index 467555f..2854a82 100644 --- a/Source/cmMessageCommand.cxx +++ b/Source/cmMessageCommand.cxx @@ -43,19 +43,7 @@ bool cmMessageCommand } else if (*i == "AUTHOR_WARNING") { - if (this->Makefile->IsOn("CMAKE_ERROR_DEVELOPER_WARNINGS")) - { - fatal = true; - type = cmake::AUTHOR_ERROR; - } - else if (!this->Makefile->IsOn("CMAKE_SUPPRESS_DEVELOPER_WARNINGS")) - { - type = cmake::AUTHOR_WARNING; - } - else - { - return true; - } + type = cmake::AUTHOR_WARNING; ++i; } else if (*i == "STATUS") diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h index a791b89..283f277 100644 --- a/Source/cmPolicies.h +++ b/Source/cmPolicies.h @@ -220,7 +220,11 @@ class cmPolicy; 3, 3, 0, cmPolicies::WARN) \ SELECT(POLICY, CMP0064, \ "Support new TEST if() operator.", \ - 3, 3, 0, cmPolicies::WARN) + 3, 4, 0, cmPolicies::WARN) \ + SELECT(POLICY, CMP0065, \ + "Do not add flags to export symbols from executables without " \ + "the ENABLE_EXPORTS target property.", \ + 3, 4, 0, cmPolicies::WARN) #define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1) #define CM_FOR_EACH_POLICY_ID(POLICY) \ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 13e0d7e..bb44956 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -347,6 +347,7 @@ void cmTarget::SetMakefile(cmMakefile* mf) { this->SetPropertyDefault("ANDROID_GUI", 0); this->SetPropertyDefault("CROSSCOMPILING_EMULATOR", 0); + this->SetPropertyDefault("ENABLE_EXPORTS", 0); } if(this->TargetTypeValue == cmTarget::SHARED_LIBRARY || this->TargetTypeValue == cmTarget::MODULE_LIBRARY) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index c86ec24..3e71dbd 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -41,7 +41,8 @@ F(CMP0046) \ F(CMP0052) \ F(CMP0060) \ - F(CMP0063) + F(CMP0063) \ + F(CMP0065) class cmake; class cmMakefile; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index cb5048d..92403e3 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -2849,7 +2849,7 @@ void cmVisualStudio10TargetGenerator::WriteProjectReferences() = this->GlobalGenerator->GetTargetDirectDepends(this->GeneratorTarget); typedef cmGlobalVisualStudioGenerator::OrderedTargetDependSet OrderedTargetDependSet; - OrderedTargetDependSet depends(unordered); + OrderedTargetDependSet depends(unordered, CMAKE_CHECK_BUILD_SYSTEM_TARGET); this->WriteString("<ItemGroup>\n", 1); for( OrderedTargetDependSet::const_iterator i = depends.begin(); i != depends.end(); ++i) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index f069481..386f6a5 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -128,6 +128,8 @@ cmake::cmake() this->WarnUnused = false; this->WarnUnusedCli = true; this->CheckSystemVars = false; + this->SuppressDevWarnings = false; + this->DoSuppressDevWarnings = false; this->DebugOutput = false; this->DebugTryCompile = false; this->ClearBuildSystem = false; @@ -250,70 +252,15 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) return false; } } - else if(cmHasLiteralPrefix(arg, "-W")) + else if(arg.find("-Wno-dev",0) == 0) { - std::string entry = arg.substr(2); - if (entry.empty()) - { - ++i; - if (i < args.size()) - { - entry = args[i]; - } - else - { - cmSystemTools::Error( - "-W must be followed with [no-][error=]<name>."); - return false; - } + this->SuppressDevWarnings = true; + this->DoSuppressDevWarnings = true; } - - std::string name; - bool foundNo = false; - bool foundError = false; - unsigned int nameStartPosition = 0; - - if (entry.find("no-", nameStartPosition) == 0) - { - foundNo = true; - nameStartPosition += 3; - } - - if (entry.find("error=", nameStartPosition) == 0) - { - foundError = true; - nameStartPosition += 6; - } - - name = entry.substr(nameStartPosition); - if (name.empty()) - { - cmSystemTools::Error("No warning name provided."); - return false; - } - - if (!foundNo && !foundError) - { - // -W<name> - this->WarningLevels[name] = std::max(this->WarningLevels[name], - WARNING_LEVEL); - } - else if (foundNo && !foundError) - { - // -Wno<name> - this->WarningLevels[name] = IGNORE_LEVEL; - } - else if (!foundNo && foundError) - { - // -Werror=<name> - this->WarningLevels[name] = ERROR_LEVEL; - } - else - { - // -Wno-error=<name> - this->WarningLevels[name] = std::min(this->WarningLevels[name], - WARNING_LEVEL); - } + else if(arg.find("-Wdev",0) == 0) + { + this->SuppressDevWarnings = false; + this->DoSuppressDevWarnings = true; } else if(arg.find("-U",0) == 0) { @@ -645,7 +592,11 @@ void cmake::SetArgs(const std::vector<std::string>& args, // skip for now i++; } - else if(arg.find("-W",0) == 0) + else if(arg.find("-Wno-dev",0) == 0) + { + // skip for now + } + else if(arg.find("-Wdev",0) == 0) { // skip for now } @@ -1232,121 +1183,25 @@ int cmake::HandleDeleteCacheVariables(const std::string& var) int cmake::Configure() { - WarningLevel warningLevel; - - if (this->WarningLevels.count("deprecated") == 1) + if(this->DoSuppressDevWarnings) { - warningLevel = this->WarningLevels["deprecated"]; - if (warningLevel == IGNORE_LEVEL) - { - this->CacheManager-> - AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", - "Whether to issue deprecation warnings for" - " macros and functions.", - cmState::BOOL); - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEPRECATED", "FALSE", - "Whether to issue deprecation errors for macros" - " and functions.", - cmState::BOOL); - } - if (warningLevel == WARNING_LEVEL) - { - this->CacheManager-> - AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", - "Whether to issue deprecation warnings for" - " macros and functions.", - cmState::BOOL); - } - else if (warningLevel == ERROR_LEVEL) - { - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEPRECATED", "TRUE", - "Whether to issue deprecation errors for macros" - " and functions.", - cmState::BOOL); - } - } - - if (this->WarningLevels.count("dev") == 1) - { - bool setDeprecatedVariables = false; - - const char* cachedWarnDeprecated = - this->State->GetCacheEntryValue("CMAKE_WARN_DEPRECATED"); - const char* cachedErrorDeprecated = - this->State->GetCacheEntryValue("CMAKE_ERROR_DEPRECATED"); - - // don't overwrite deprecated warning setting from a previous invocation - if (!cachedWarnDeprecated && !cachedErrorDeprecated) - { - setDeprecatedVariables = true; - } - - warningLevel = this->WarningLevels["dev"]; - if (warningLevel == IGNORE_LEVEL) + if(this->SuppressDevWarnings) { this->CacheManager-> AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "TRUE", "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", cmState::INTERNAL); - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEVELOPER_WARNINGS", "FALSE", - "Suppress errors that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); - - if (setDeprecatedVariables) - { - this->CacheManager-> - AddCacheEntry("CMAKE_WARN_DEPRECATED", "FALSE", - "Whether to issue deprecation warnings for" - " macros and functions.", - cmState::BOOL); - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEPRECATED", "FALSE", - "Whether to issue deprecation errors for macros" - " and functions.", - cmState::BOOL); - } } - else if (warningLevel == WARNING_LEVEL) + else { this->CacheManager-> AddCacheEntry("CMAKE_SUPPRESS_DEVELOPER_WARNINGS", "FALSE", "Suppress Warnings that are meant for" " the author of the CMakeLists.txt files.", cmState::INTERNAL); - - if (setDeprecatedVariables) - { - this->CacheManager-> - AddCacheEntry("CMAKE_WARN_DEPRECATED", "TRUE", - "Whether to issue deprecation warnings for" - " macros and functions.", - cmState::BOOL); - } - } - else if (warningLevel == ERROR_LEVEL) - { - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEVELOPER_WARNINGS", "TRUE", - "Suppress errors that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); - - if (setDeprecatedVariables) - { - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEPRECATED", "TRUE", - "Whether to issue deprecation errors for macros" - " and functions.", - cmState::BOOL); - } } } - int ret = this->ActualConfigure(); const char* delCacheVars = this->State ->GetGlobalProperty("__CMAKE_DELETE_CACHE_CHANGE_VARS_"); @@ -1677,18 +1532,6 @@ int cmake::Run(const std::vector<std::string>& args, bool noconfigure) { this->AddCMakePaths(); } - - // don't turn dev warnings into errors by default, if no value has been - // specified for the flag, disable it - if (!this->State->GetCacheEntryValue("CMAKE_ERROR_DEVELOPER_WARNINGS")) - { - this->CacheManager-> - AddCacheEntry("CMAKE_ERROR_DEVELOPER_WARNINGS", "FALSE", - "Suppress errors that are meant for" - " the author of the CMakeLists.txt files.", - cmState::INTERNAL); - } - // Add any cache args if ( !this->SetCacheArgs(args) ) { @@ -2596,17 +2439,20 @@ bool cmake::PrintMessagePreamble(cmake::MessageType t, std::ostream& msg) { msg << "CMake Deprecation Warning"; } - else if (t == cmake::AUTHOR_WARNING) - { - msg << "CMake Warning (dev)"; - } - else if (t == cmake::AUTHOR_ERROR) - { - msg << "CMake Error (dev)"; - } else { msg << "CMake Warning"; + if(t == cmake::AUTHOR_WARNING) + { + // Allow suppression of these warnings. + const char* suppress = this->State->GetCacheEntryValue( + "CMAKE_SUPPRESS_DEVELOPER_WARNINGS"); + if(suppress && cmSystemTools::IsOn(suppress)) + { + return false; + } + msg << " (dev)"; + } } return true; } @@ -2628,12 +2474,6 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) msg << "This warning is for project developers. Use -Wno-dev to suppress it."; } - else if (t == cmake::AUTHOR_ERROR) - { - msg << - "This error is for project developers. Use -Wno-error=dev to suppress " - "it."; - } // Add a terminating blank line. msg << "\n"; @@ -2657,8 +2497,7 @@ void displayMessage(cmake::MessageType t, std::ostringstream& msg) // Output the message. if(t == cmake::FATAL_ERROR || t == cmake::INTERNAL_ERROR - || t == cmake::DEPRECATION_ERROR - || t == cmake::AUTHOR_ERROR) + || t == cmake::DEPRECATION_ERROR) { cmSystemTools::SetErrorOccured(); cmSystemTools::Message(msg.str().c_str(), "Error"); @@ -2855,18 +2694,3 @@ void cmake::RunCheckForUnusedVariables() } #endif } - -void cmake::SetSuppressDevWarnings(bool b) -{ - // equivalent to -Wno-dev - if (b) - { - this->WarningLevels["dev"] = IGNORE_LEVEL; - } - // equivalent to -Wdev - else - { - this->WarningLevels["dev"] = std::max(this->WarningLevels["dev"], - WARNING_LEVEL); - } -} diff --git a/Source/cmake.h b/Source/cmake.h index 8ac8897..9d28cba 100644 --- a/Source/cmake.h +++ b/Source/cmake.h @@ -59,7 +59,6 @@ class cmake public: enum MessageType { AUTHOR_WARNING, - AUTHOR_ERROR, FATAL_ERROR, INTERNAL_ERROR, MESSAGE, @@ -69,12 +68,6 @@ class cmake DEPRECATION_WARNING }; - enum WarningLevel - { - IGNORE_LEVEL, - WARNING_LEVEL, - ERROR_LEVEL - }; /** \brief Describes the working modes of cmake */ enum WorkingMode @@ -278,7 +271,6 @@ class cmake void SetTrace(bool b) { this->Trace = b;} bool GetTraceExpand() { return this->TraceExpand;} void SetTraceExpand(bool b) { this->TraceExpand = b;} - void SetSuppressDevWarnings(bool b); bool GetWarnUninitialized() { return this->WarnUninitialized;} void SetWarnUninitialized(bool b) { this->WarnUninitialized = b;} bool GetWarnUnused() { return this->WarnUnused;} @@ -299,6 +291,12 @@ class cmake std::string const& GetCMakeEditCommand() const { return this->CMakeEditCommand; } + void SetSuppressDevWarnings(bool v) + { + this->SuppressDevWarnings = v; + this->DoSuppressDevWarnings = true; + } + /** Display a message to the user. */ void IssueMessage(cmake::MessageType t, std::string const& text, cmListFileBacktrace const& backtrace = cmListFileBacktrace()); @@ -341,7 +339,8 @@ protected: cmGlobalGenerator *GlobalGenerator; cmCacheManager *CacheManager; - std::map<std::string, WarningLevel> WarningLevels; + bool SuppressDevWarnings; + bool DoSuppressDevWarnings; std::string GeneratorPlatform; std::string GeneratorToolset; @@ -417,15 +416,7 @@ private: {"-T <toolset-name>", "Specify toolset name if supported by generator."}, \ {"-A <platform-name>", "Specify platform name if supported by generator."}, \ {"-Wno-dev", "Suppress developer warnings."},\ - {"-Wdev", "Enable developer warnings."},\ - {"-Werror=dev", "Make developer warnings errors."},\ - {"-Wno-error=dev", "Make developer warnings not errors."},\ - {"-Wdeprecated", "Enable deprecated macro and function warnings."},\ - {"-Wno-deprecated", "Suppress deprecated macro and function warnings."},\ - {"-Werror=deprecated", "Make deprecated macro and function warnings " \ - "errors."},\ - {"-Wno-error=deprecated", "Make deprecated macro and function warnings " \ - "not errors."} + {"-Wdev", "Enable developer warnings."} #define FOR_EACH_C_FEATURE(F) \ F(c_function_prototypes) \ diff --git a/Source/cmake.version.manifest b/Source/cmake.version.manifest new file mode 100644 index 0000000..e7010c9 --- /dev/null +++ b/Source/cmake.version.manifest @@ -0,0 +1,18 @@ +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" + manifestVersion="1.0" + xmlns:asmv3="urn:schemas-microsoft-com:asm.v3" > + <compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1"> + <application> + <!-- Windows Vista --> + <supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}"/> + <!-- Windows 7 --> + <supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}"/> + <!-- Windows 8 --> + <supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}"/> + <!-- Windows 8.1 --> + <supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}"/> + <!-- Windows 10 --> + <supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}"/> + </application> + </compatibility> +</assembly> |