From a20c41d0328f6a4557789bb382c9b3f69b76ea30 Mon Sep 17 00:00:00 2001 From: James Bigler Date: Tue, 19 Jun 2012 10:04:51 -0600 Subject: [PATCH 001/152] Replace -g3 with -g for CUDA 4.1 and 4.2 in addition to CUDA < 3.0. CUDA 4.1 reintroduced the bug where -g3 breaks compilation. This wasn't fixed until CUDA 5.0, so both CUDA 4.1 and 4.2 have this bug. --- Modules/FindCUDA.cmake | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 9f8d5755f..e79353efc 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1016,7 +1016,17 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) if(CUDA_PROPAGATE_HOST_FLAGS) # nvcc chokes on -g3 in versions previous to 3.0, so replace it with -g - if(CMAKE_COMPILER_IS_GNUCC AND CUDA_VERSION VERSION_LESS "3.0") + set(_cuda_fix_g3 FALSE) + + if(CMAKE_COMPILER_IS_GNUCC) + if (CUDA_VERSION VERSION_LESS "3.0" OR + CUDA_VERSION VERSION_EQUAL "4.1" OR + CUDA_VERSION VERSION_EQUAL "4.2" + ) + set(_cuda_fix_g3 TRUE) + endif() + endif() + if(_cuda_fix_g3) string(REPLACE "-g3" "-g" _cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") else() set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") From 87fe4286bdb3f4faffbc603697b4a6f3343fb4ec Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Thu, 16 Aug 2012 22:46:33 +0200 Subject: [PATCH 002/152] fix #13474: also rescan dependencies if the depender does not exist If the depender (e.g. foo.o) does not exist, also rescan dependencies if one of the dependees (e.g. foo.cxx) is older than the already existing depend.internal file, since this means it can be out of date. Alex --- Source/cmDepends.cxx | 65 ++++++++++++++++++++++++++++++++------------ Source/cmDepends.h | 1 + 2 files changed, 48 insertions(+), 18 deletions(-) diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 545fe97e8..5a48f7f95 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -98,7 +98,7 @@ bool cmDepends::Check(const char *makeFile, const char *internalFile, // Check whether dependencies must be regenerated. bool okay = true; std::ifstream fin(internalFile); - if(!(fin && this->CheckDependencies(fin, validDeps))) + if(!(fin && this->CheckDependencies(fin, internalFile, validDeps))) { // Clear all dependencies so they will be regenerated. this->Clear(makeFile); @@ -143,6 +143,7 @@ bool cmDepends::WriteDependencies(const char*, const char*, //---------------------------------------------------------------------------- bool cmDepends::CheckDependencies(std::istream& internalDepends, + const char* internalDependsFileName, std::map& validDeps) { // Parse dependencies from the stream. If any dependee is missing @@ -186,8 +187,11 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, } */ - // Dependencies must be regenerated if the dependee does not exist - // or if the depender exists and is older than the dependee. + // Dependencies must be regenerated + // * if the dependee does not exist + // * if the depender exists and is older than the dependee. + // * if the depender does not exist, but the dependee is newer than the + // depends file bool regenerate = false; const char* dependee = this->Dependee+1; const char* depender = this->Depender; @@ -211,24 +215,49 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, cmSystemTools::Stdout(msg.str().c_str()); } } - else if(dependerExists) + else { - // The dependee and depender both exist. Compare file times. - int result = 0; - if((!this->FileComparison->FileTimeCompare(depender, dependee, - &result) || result < 0)) + if(dependerExists) { - // The depender is older than the dependee. - regenerate = true; - - // Print verbose output. - if(this->Verbose) + // The dependee and depender both exist. Compare file times. + int result = 0; + if((!this->FileComparison->FileTimeCompare(depender, dependee, + &result) || result < 0)) { - cmOStringStream msg; - msg << "Dependee \"" << dependee - << "\" is newer than depender \"" - << depender << "\"." << std::endl; - cmSystemTools::Stdout(msg.str().c_str()); + // The depender is older than the dependee. + regenerate = true; + + // Print verbose output. + if(this->Verbose) + { + cmOStringStream msg; + msg << "Dependee \"" << dependee + << "\" is newer than depender \"" + << depender << "\"." << std::endl; + cmSystemTools::Stdout(msg.str().c_str()); + } + } + } + else + { + // The dependee exists, but the depender doesn't. Regenerate if the + // internalDepends file is older than the dependee. + int result = 0; + if((!this->FileComparison->FileTimeCompare(internalDependsFileName, dependee, + &result) || result < 0)) + { + // The depends-file is older than the dependee. + regenerate = true; + + // Print verbose output. + if(this->Verbose) + { + cmOStringStream msg; + msg << "Dependee \"" << dependee + << "\" is newer than depends file \"" + << internalDependsFileName << "\"." << std::endl; + cmSystemTools::Stdout(msg.str().c_str()); + } } } } diff --git a/Source/cmDepends.h b/Source/cmDepends.h index 100e187b4..f7dc8811e 100644 --- a/Source/cmDepends.h +++ b/Source/cmDepends.h @@ -83,6 +83,7 @@ protected: // Return false if dependencies must be regenerated and true // otherwise. virtual bool CheckDependencies(std::istream& internalDepends, + const char* internalDependsFileName, std::map& validDeps); // Finalize the dependency information for the target. From 389d42317743952e2e78393601c20b826ce95d30 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 17 Aug 2012 22:09:08 +0200 Subject: [PATCH 003/152] Add missing whitespace to docs. --- Source/cmTarget.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 775662cc3..639891255 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -903,7 +903,7 @@ void cmTarget::DefineProperties(cmake *cm) "Build an executable with a WinMain entry point on windows.", "When this property is set to true the executable when linked " "on Windows will be created with a WinMain() entry point instead " - "of of just main()." + "of of just main(). " "This makes it a GUI executable instead of a console application. " "See the CMAKE_MFC_FLAG variable documentation to configure use " "of MFC for WinMain executables. " From 805f5e5c1e32c878b63e10f167e667a05a460f3e Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 19 Aug 2012 22:05:16 +0200 Subject: [PATCH 004/152] Fix some typos in the docs. s/static the static/the static/ Make Visual Studio capitalized. --- Source/cmDocumentVariables.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 05ef8fc71..943d21947 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -827,9 +827,9 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "Tell cmake to use MFC for an executable or dll.", "This can be set in a CMakeLists.txt file and will " "enable MFC in the application. It should be set " - "to 1 for static the static MFC library, and 2 for " - "the shared MFC library. This is used in visual " - "studio 6 and 7 project files. The CMakeSetup " + "to 1 for the static MFC library, and 2 for " + "the shared MFC library. This is used in Visual " + "Studio 6 and 7 project files. The CMakeSetup " "dialog used MFC and the CMakeLists.txt looks like this:\n" " add_definitions(-D_AFXDLL)\n" " set(CMAKE_MFC_FLAG 2)\n" From ecc1acb94cbfa12045ec94e11013cbfe6a3bd136 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Sun, 19 Aug 2012 23:11:13 +0200 Subject: [PATCH 005/152] Remove incorrect doc string for link type enum This is actually a duplicate doc string for a method a few lines above. --- Source/cmTarget.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index a89c5d91b..98eaeec76 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -158,9 +158,6 @@ public: void AddSources(std::vector const& srcs); cmSourceFile* AddSource(const char* src); - /** - * Get the list of the source files used by this target - */ enum LinkLibraryType {GENERAL, DEBUG, OPTIMIZED}; //* how we identify a library, by name and type From 94c08b368c40da4f39a506440d0c5cf3c4c23c48 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 20 Aug 2012 14:45:48 -0400 Subject: [PATCH 006/152] Tests/ObjectLibrary: Do not enable CXX in subdirectories In commit b237dbd8 (Xcode: Fix object library references in multi-project trees, 2012-08-03) we accidentally enabled CXX in the subdiretories of this test by invoking project() with only one argument. The top-level directory of the test enables only C, so do this in the subdirectories too. --- Tests/ObjectLibrary/A/CMakeLists.txt | 2 +- Tests/ObjectLibrary/B/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Tests/ObjectLibrary/A/CMakeLists.txt b/Tests/ObjectLibrary/A/CMakeLists.txt index 04ab02f16..36c86e7e9 100644 --- a/Tests/ObjectLibrary/A/CMakeLists.txt +++ b/Tests/ObjectLibrary/A/CMakeLists.txt @@ -1,4 +1,4 @@ -project(ObjectLibraryA) +project(ObjectLibraryA C) # Add -fPIC so objects can be used in shared libraries. # TODO: Need property for this. if(CMAKE_SHARED_LIBRARY_C_FLAGS AND NOT WATCOM) diff --git a/Tests/ObjectLibrary/B/CMakeLists.txt b/Tests/ObjectLibrary/B/CMakeLists.txt index 4b0b07d1c..32d8cebf6 100644 --- a/Tests/ObjectLibrary/B/CMakeLists.txt +++ b/Tests/ObjectLibrary/B/CMakeLists.txt @@ -1,4 +1,4 @@ -project(ObjectLibraryB) +project(ObjectLibraryB C) if("${CMAKE_GENERATOR}" MATCHES "Visual Studio 6") # VS 6 generator does not use per-target object locations. set(vs6 _vs6) From 7ae4479d655b567d0e2c67e6bdab2580a5c3d4ea Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Mon, 20 Aug 2012 21:23:20 +0200 Subject: [PATCH 007/152] -fix line length Alex --- Source/cmDepends.cxx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/cmDepends.cxx b/Source/cmDepends.cxx index 5a48f7f95..166a58461 100644 --- a/Source/cmDepends.cxx +++ b/Source/cmDepends.cxx @@ -243,8 +243,8 @@ bool cmDepends::CheckDependencies(std::istream& internalDepends, // The dependee exists, but the depender doesn't. Regenerate if the // internalDepends file is older than the dependee. int result = 0; - if((!this->FileComparison->FileTimeCompare(internalDependsFileName, dependee, - &result) || result < 0)) + if((!this->FileComparison->FileTimeCompare(internalDependsFileName, + dependee, &result) || result < 0)) { // The depends-file is older than the dependee. regenerate = true; From 8aed02ae0f753dce76a167367ecf54be1d04de2b Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Mon, 20 Aug 2012 21:37:26 +0200 Subject: [PATCH 008/152] -fix Java dependency scanning, broken in previous commit Alex --- Source/cmDependsJava.cxx | 2 +- Source/cmDependsJava.h | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Source/cmDependsJava.cxx b/Source/cmDependsJava.cxx index 1d849145c..ba0e8fbe6 100644 --- a/Source/cmDependsJava.cxx +++ b/Source/cmDependsJava.cxx @@ -38,7 +38,7 @@ bool cmDependsJava::WriteDependencies(const char *src, const char *, return true; } -bool cmDependsJava::CheckDependencies(std::istream&, +bool cmDependsJava::CheckDependencies(std::istream&, const char*, std::map&) { return true; diff --git a/Source/cmDependsJava.h b/Source/cmDependsJava.h index fe6fef50d..bf7e234dc 100644 --- a/Source/cmDependsJava.h +++ b/Source/cmDependsJava.h @@ -32,7 +32,8 @@ protected: virtual bool WriteDependencies(const char *src, const char *file, std::ostream& makeDepends, std::ostream& internalDepends); virtual bool CheckDependencies(std::istream& internalDepends, - std::map& validDeps); + const char* internalDependsFileName, + std::map& validDeps); private: cmDependsJava(cmDependsJava const&); // Purposely not implemented. From ee949d8871ababb7bde5c03b9ac77c4b15b3f786 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 20 Aug 2012 22:26:05 +0200 Subject: [PATCH 009/152] Remove duplicate 'of' from docs. --- Source/cmTarget.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 639891255..48811c82c 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -903,7 +903,7 @@ void cmTarget::DefineProperties(cmake *cm) "Build an executable with a WinMain entry point on windows.", "When this property is set to true the executable when linked " "on Windows will be created with a WinMain() entry point instead " - "of of just main(). " + "of just main(). " "This makes it a GUI executable instead of a console application. " "See the CMAKE_MFC_FLAG variable documentation to configure use " "of MFC for WinMain executables. " From 3dae652b4ea8e039dd9f4d845497ec988fbbe82c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 9 Aug 2012 09:44:15 +0200 Subject: [PATCH 010/152] Don't duplicate -D defines sent to the compiler. There is no need to do so. Be consistent with include directories and ensure uniqueness. This requires changing the API of the cmLocalGenerator::AppendDefines method, and changing the generators to match. The test unfortunately can't test for uniqueness, but it at least verifies that nothing gets lost. --- Source/cmLocalGenerator.cxx | 61 ++++++----- Source/cmLocalGenerator.h | 10 +- Source/cmLocalVisualStudio6Generator.cxx | 102 +++++++++++------- Source/cmMakefileTargetGenerator.cxx | 34 +++--- Source/cmNinjaTargetGenerator.cxx | 29 +++-- Tests/CMakeLists.txt | 1 + Tests/CompileDefinitions/CMakeLists.txt | 12 +++ .../add_definitions_command/CMakeLists.txt | 7 ++ .../CMakeLists.txt | 14 +++ Tests/CompileDefinitions/main.cpp | 28 +++++ .../target_prop/CMakeLists.txt | 9 ++ 11 files changed, 211 insertions(+), 96 deletions(-) create mode 100644 Tests/CompileDefinitions/CMakeLists.txt create mode 100644 Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt create mode 100644 Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt create mode 100644 Tests/CompileDefinitions/main.cpp create mode 100644 Tests/CompileDefinitions/target_prop/CMakeLists.txt diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 0cfb36bc3..cf2af0a4f 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2101,9 +2101,8 @@ void cmLocalGenerator::AppendFlags(std::string& flags, } //---------------------------------------------------------------------------- -void cmLocalGenerator::AppendDefines(std::string& defines, - const char* defines_list, - const char* lang) +void cmLocalGenerator::AppendDefines(std::set& defines, + const char* defines_list) { // Short-circuit if there are no definitions. if(!defines_list) @@ -2115,12 +2114,23 @@ void cmLocalGenerator::AppendDefines(std::string& defines, std::vector defines_vec; cmSystemTools::ExpandListArgument(defines_list, defines_vec); - // Short-circuit if there are no definitions. - if(defines_vec.empty()) + for(std::vector::const_iterator di = defines_vec.begin(); + di != defines_vec.end(); ++di) { - return; + // Skip unsupported definitions. + if(!this->CheckDefinition(*di)) + { + continue; + } + defines.insert(*di); } +} +//---------------------------------------------------------------------------- +void cmLocalGenerator::JoinDefines(const std::set& defines, + std::string &definesString, + const char* lang) +{ // Lookup the define flag for the current language. std::string dflag = "-D"; if(lang) @@ -2135,23 +2145,13 @@ void cmLocalGenerator::AppendDefines(std::string& defines, } } - // Add each definition to the command line with appropriate escapes. - const char* dsep = defines.empty()? "" : " "; - for(std::vector::const_iterator di = defines_vec.begin(); - di != defines_vec.end(); ++di) + std::set::const_iterator defineIt = defines.begin(); + const std::set::const_iterator defineEnd = defines.end(); + const char* itemSeparator = definesString.empty() ? "" : " "; + for( ; defineIt != defineEnd; ++defineIt) { - // Skip unsupported definitions. - if(!this->CheckDefinition(*di)) - { - continue; - } - - // Separate from previous definitions. - defines += dsep; - dsep = " "; - // Append the definition with proper escaping. - defines += dflag; + std::string def = dflag; if(this->WatcomWMake) { // The Watcom compiler does its own command line parsing instead @@ -2164,27 +2164,30 @@ void cmLocalGenerator::AppendDefines(std::string& defines, // command line without any escapes. However we still have to // get the '$' and '#' characters through WMake as '$$' and // '$#'. - for(const char* c = di->c_str(); *c; ++c) + for(const char* c = defineIt->c_str(); *c; ++c) { if(*c == '$' || *c == '#') { - defines += '$'; + def += '$'; } - defines += *c; + def += *c; } } else { // Make the definition appear properly on the command line. Use // -DNAME="value" instead of -D"NAME=value" to help VS6 parser. - std::string::size_type eq = di->find("="); - defines += di->substr(0, eq); - if(eq != di->npos) + std::string::size_type eq = defineIt->find("="); + def += defineIt->substr(0, eq); + if(eq != defineIt->npos) { - defines += "="; - defines += this->EscapeForShell(di->c_str() + eq + 1, true); + def += "="; + def += this->EscapeForShell(defineIt->c_str() + eq + 1, true); } } + definesString += itemSeparator; + itemSeparator = " "; + definesString += def; } } diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 39b493fb1..b3396e3a5 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -154,8 +154,14 @@ public: * Encode a list of preprocessor definitions for the compiler * command line. */ - void AppendDefines(std::string& defines, const char* defines_list, - const char* lang); + void AppendDefines(std::set& defines, + const char* defines_list); + /** + * Join a set of defines into a definesString with a space separator. + */ + void JoinDefines(const std::set& defines, + std::string &definesString, + const char* lang); /** Lookup and append options associated with a particular feature. */ void AppendFeatureOptions(std::string& flags, const char* lang, diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 1a7e611aa..9f2a8635e 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -418,25 +418,42 @@ void cmLocalVisualStudio6Generator // Add per-source and per-configuration preprocessor definitions. std::map cdmap; - this->AppendDefines(compileFlags, - (*sf)->GetProperty("COMPILE_DEFINITIONS"), lang); + + { + std::set targetCompileDefinitions; + + this->AppendDefines(targetCompileDefinitions, + (*sf)->GetProperty("COMPILE_DEFINITIONS")); + this->JoinDefines(targetCompileDefinitions, compileFlags, lang); + } + if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_DEBUG")) { - this->AppendDefines(cdmap["DEBUG"], cdefs, lang); + std::set debugCompileDefinitions; + this->AppendDefines(debugCompileDefinitions, cdefs); + this->JoinDefines(debugCompileDefinitions, cdmap["DEBUG"], lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_RELEASE")) { - this->AppendDefines(cdmap["RELEASE"], cdefs, lang); + std::set releaseCompileDefinitions; + this->AppendDefines(releaseCompileDefinitions, cdefs); + this->JoinDefines(releaseCompileDefinitions, cdmap["RELEASE"], lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")) { - this->AppendDefines(cdmap["MINSIZEREL"], cdefs, lang); + std::set minsizerelCompileDefinitions; + this->AppendDefines(minsizerelCompileDefinitions, cdefs); + this->JoinDefines(minsizerelCompileDefinitions, cdmap["MINSIZEREL"], + lang); } if(const char* cdefs = (*sf)->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")) { - this->AppendDefines(cdmap["RELWITHDEBINFO"], cdefs, lang); + std::set relwithdebinfoCompileDefinitions; + this->AppendDefines(relwithdebinfoCompileDefinitions, cdefs); + this->JoinDefines(relwithdebinfoCompileDefinitions, + cdmap["RELWITHDEBINFO"], lang); } bool excludedFromBuild = @@ -1653,43 +1670,56 @@ void cmLocalVisualStudio6Generator } // Add per-target and per-configuration preprocessor definitions. + std::set definesSet; + std::set debugDefinesSet; + std::set releaseDefinesSet; + std::set minsizeDefinesSet; + std::set debugrelDefinesSet; + + this->AppendDefines( + definesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS")); + this->AppendDefines( + debugDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG")); + this->AppendDefines( + releaseDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE")); + this->AppendDefines( + minsizeDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")); + this->AppendDefines( + debugrelDefinesSet, + this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")); + + this->AppendDefines( + definesSet, + target.GetProperty("COMPILE_DEFINITIONS")); + this->AppendDefines( + debugDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_DEBUG")); + this->AppendDefines( + releaseDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_RELEASE")); + this->AppendDefines( + minsizeDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")); + this->AppendDefines( + debugrelDefinesSet, + target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")); + std::string defines = " "; std::string debugDefines = " "; std::string releaseDefines = " "; std::string minsizeDefines = " "; std::string debugrelDefines = " "; - this->AppendDefines( - defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS"), 0); - this->AppendDefines( - debugDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG"),0); - this->AppendDefines( - releaseDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); - this->AppendDefines( - minsizeDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); - this->AppendDefines( - debugrelDefines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); + this->JoinDefines(definesSet, defines, 0); + this->JoinDefines(debugDefinesSet, debugDefines, 0); + this->JoinDefines(releaseDefinesSet, releaseDefines, 0); + this->JoinDefines(minsizeDefinesSet, minsizeDefines, 0); + this->JoinDefines(debugrelDefinesSet, debugrelDefines, 0); - this->AppendDefines( - defines, - target.GetProperty("COMPILE_DEFINITIONS"), 0); - this->AppendDefines( - debugDefines, - target.GetProperty("COMPILE_DEFINITIONS_DEBUG"), 0); - this->AppendDefines( - releaseDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELEASE"), 0); - this->AppendDefines( - minsizeDefines, - target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL"), 0); - this->AppendDefines( - debugrelDefines, - target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO"), 0); flags += defines; flagsDebug += debugDefines; flagsRelease += releaseDefines; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 0de182ede..95738c473 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -292,28 +292,31 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) ByLanguageMap::iterator i = this->DefinesByLanguage.find(l); if (i == this->DefinesByLanguage.end()) { - std::string defines; + std::set defines; const char *lang = l.c_str(); // Add the export symbol definition for shared library objects. if(const char* exportMacro = this->Target->GetExportMacro()) { - this->LocalGenerator->AppendDefines(defines, exportMacro, lang); + this->LocalGenerator->AppendDefines(defines, exportMacro); } // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS"), lang); + (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS")); this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty("COMPILE_DEFINITIONS"), lang); + (defines, this->Target->GetProperty("COMPILE_DEFINITIONS")); std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty(defPropName.c_str()), lang); + (defines, this->Makefile->GetProperty(defPropName.c_str())); this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty(defPropName.c_str()), lang); + (defines, this->Target->GetProperty(defPropName.c_str())); - ByLanguageMap::value_type entry(l, defines); + std::string definesString; + this->LocalGenerator->JoinDefines(defines, definesString, lang); + + ByLanguageMap::value_type entry(l, definesString); i = this->DefinesByLanguage.insert(entry).first; } return i->second; @@ -587,14 +590,12 @@ cmMakefileTargetGenerator } // Add language-specific defines. - std::string defines = "$("; - defines += lang; - defines += "_DEFINES)"; + std::set defines; // Add source-sepcific preprocessor definitions. if(const char* compile_defs = source.GetProperty("COMPILE_DEFINITIONS")) { - this->LocalGenerator->AppendDefines(defines, compile_defs, lang); + this->LocalGenerator->AppendDefines(defines, compile_defs); *this->FlagFileStream << "# Custom defines: " << relativeObj << "_DEFINES = " << compile_defs << "\n" @@ -607,7 +608,7 @@ cmMakefileTargetGenerator if(const char* config_compile_defs = source.GetProperty(defPropName.c_str())) { - this->LocalGenerator->AppendDefines(defines, config_compile_defs, lang); + this->LocalGenerator->AppendDefines(defines, config_compile_defs); *this->FlagFileStream << "# Custom defines: " << relativeObj << "_DEFINES_" << configUpper @@ -676,7 +677,14 @@ cmMakefileTargetGenerator cmLocalGenerator::SHELL); vars.ObjectDir = objectDir.c_str(); vars.Flags = flags.c_str(); - vars.Defines = defines.c_str(); + + std::string definesString = "$("; + definesString += lang; + definesString += "_DEFINES)"; + + this->LocalGenerator->JoinDefines(defines, definesString, lang); + + vars.Defines = definesString.c_str(); bool lang_is_c_or_cxx = ((strcmp(lang, "C") == 0) || (strcmp(lang, "CXX") == 0)); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 3532c8ba4..185965ce5 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -184,46 +184,43 @@ std::string cmNinjaTargetGenerator:: ComputeDefines(cmSourceFile *source, const std::string& language) { - std::string defines; + std::set defines; // Add the export symbol definition for shared library objects. if(const char* exportMacro = this->Target->GetExportMacro()) { - this->LocalGenerator->AppendDefines(defines, exportMacro, - language.c_str()); + this->LocalGenerator->AppendDefines(defines, exportMacro); } // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines (defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); + this->Makefile->GetProperty("COMPILE_DEFINITIONS")); this->LocalGenerator->AppendDefines (defines, - this->Target->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); + this->Target->GetProperty("COMPILE_DEFINITIONS")); this->LocalGenerator->AppendDefines (defines, - source->GetProperty("COMPILE_DEFINITIONS"), - language.c_str()); + source->GetProperty("COMPILE_DEFINITIONS")); { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(this->GetConfigName()); this->LocalGenerator->AppendDefines (defines, - this->Makefile->GetProperty(defPropName.c_str()), - language.c_str()); + this->Makefile->GetProperty(defPropName.c_str())); this->LocalGenerator->AppendDefines (defines, - this->Target->GetProperty(defPropName.c_str()), - language.c_str()); + this->Target->GetProperty(defPropName.c_str())); this->LocalGenerator->AppendDefines (defines, - source->GetProperty(defPropName.c_str()), - language.c_str()); + source->GetProperty(defPropName.c_str())); } - return defines; + std::string definesString; + this->LocalGenerator->JoinDefines(defines, definesString, + language.c_str()); + + return definesString; } cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 9512ea6e6..239757745 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -218,6 +218,7 @@ if(BUILD_TESTING) ADD_TEST_MACRO(Unset Unset) ADD_TEST_MACRO(PolicyScope PolicyScope) ADD_TEST_MACRO(EmptyLibrary EmptyLibrary) + ADD_TEST_MACRO(CompileDefinitions CompileDefinitions) set_tests_properties(EmptyLibrary PROPERTIES PASS_REGULAR_EXPRESSION "CMake Error: CMake can not determine linker language for target:test") ADD_TEST_MACRO(CrossCompile CrossCompile) diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt new file mode 100644 index 000000000..3e4181b8d --- /dev/null +++ b/Tests/CompileDefinitions/CMakeLists.txt @@ -0,0 +1,12 @@ + +cmake_minimum_required(VERSION 2.8) + +project(CompileDefinitions) + +add_subdirectory(add_definitions_command) +add_subdirectory(target_prop) +add_subdirectory(add_definitions_command_with_target_prop) + +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" "int main(int, char **) { return 0; }\n") + +add_executable(CompileDefinitions "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") diff --git a/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt b/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt new file mode 100644 index 000000000..4ca269d77 --- /dev/null +++ b/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt @@ -0,0 +1,7 @@ + +project(add_definitions_command) + +add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun -DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun") +add_definitions(-DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun" -DCMAKE_IS_FUN -DCMAKE_IS=Fun) + +add_executable(add_definitions_command_executable ../main.cpp) diff --git a/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt b/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt new file mode 100644 index 000000000..4161ed649 --- /dev/null +++ b/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt @@ -0,0 +1,14 @@ + +project(add_definitions_command_with_target_prop) + +add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun) + +add_executable(add_definitions_command_with_target_prop_executable ../main.cpp) + +set_target_properties(add_definitions_command_with_target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_="Fun") + +set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun") + +add_definitions(-DCMAKE_IS_FUN) + +set_property(TARGET add_definitions_command_with_target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS=Fun CMAKE_IS_="Fun") diff --git a/Tests/CompileDefinitions/main.cpp b/Tests/CompileDefinitions/main.cpp new file mode 100644 index 000000000..d80c9dc9a --- /dev/null +++ b/Tests/CompileDefinitions/main.cpp @@ -0,0 +1,28 @@ + +#ifndef CMAKE_IS_FUN +#error Expect CMAKE_IS_FUN definition +#endif + +#if CMAKE_IS != Fun +#error Expect CMAKE_IS=Fun definition +#endif + + +template +struct CMakeStaticAssert; + +template<> +struct CMakeStaticAssert {}; + +static const char fun_string[] = CMAKE_IS_; +static const char very_fun_string[] = CMAKE_IS_REALLY; + +enum { + StringLiteralTest1 = sizeof(CMakeStaticAssert), + StringLiteralTest2 = sizeof(CMakeStaticAssert) +}; + +int main(int argc, char **argv) +{ + return 0; +} diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt new file mode 100644 index 000000000..8248a2149 --- /dev/null +++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt @@ -0,0 +1,9 @@ + +project(target_prop) + +add_executable(target_prop_executable ../main.cpp) + +set_target_properties(target_prop_executable PROPERTIES CMAKE_IS_FUN -DCMAKE_IS_REALLY="Very Fun") + +set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun" CMAKE_IS=Fun) +set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_FUN CMAKE_IS_="Fun") From c82fbe0c1f9c39db2421afc1079e2aa071f50a37 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Mon, 13 Aug 2012 08:58:41 +0200 Subject: [PATCH 011/152] Fix unfortunate documentation error for PIC feature. The wrong variable is documented, and it is not referred to in the target-specific property. --- Source/cmDocumentVariables.cxx | 2 +- Source/cmTarget.cxx | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 05ef8fc71..0fa0b2959 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -1351,7 +1351,7 @@ void cmDocumentVariables::DefineVariables(cmake* cm) false, "Variables that Control the Build"); cm->DefineProperty - ("CMAKE_POSITION_INDEPENDENT_FLAGS", cmProperty::VARIABLE, + ("CMAKE_POSITION_INDEPENDENT_CODE", cmProperty::VARIABLE, "Default value for POSITION_INDEPENDENT_CODE of targets.", "This variable is used to initialize the " "POSITION_INDEPENDENT_CODE property on all the targets. " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 775662cc3..b93650019 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -761,7 +761,10 @@ void cmTarget::DefineProperties(cmake *cm) "The POSITION_INDEPENDENT_CODE property determines whether position " "independent executables or shared libraries will be created. " "This property is true by default for SHARED and MODULE library " - "targets and false otherwise."); + "targets and false otherwise. " + "This property is initialized by the value of the variable " + "CMAKE_POSITION_INDEPENDENT_CODE if it is set when a target is" + "created."); cm->DefineProperty ("POST_INSTALL_SCRIPT", cmProperty::TARGET, From db207e4065f4d1ecec9432cd4cc948f706bc973c Mon Sep 17 00:00:00 2001 From: James Bigler Date: Mon, 20 Aug 2012 15:14:37 -0600 Subject: [PATCH 012/152] FindCUDA: Added CUDA_HOST_COMPILER variable. Added a new CUDA variable for specifying the CUDA_HOST_COMPILER. This will allow users to be able to specify which host compiler to use for invoking NVCC with. By default it will use the compiler used for host compilation. This is convenient for when you want to specify a different compiler than the default compiler. You end up using the same compiler for both the NVCC compilation and the host compilation instead of using the default compiler in the path for NVCC. --- Modules/FindCUDA.cmake | 22 +++++++++++++++++----- Modules/FindCUDA/run_nvcc.cmake | 12 ++++++++++-- 2 files changed, 27 insertions(+), 7 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 9f8d5755f..ed009c107 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -68,6 +68,13 @@ # CUDA_HOST_COMPILATION_CPP (Default ON) # -- Set to OFF for C compilation of host code. # +# CUDA_HOST_COMPILER (Default CMAKE_C_COMPILER, $(VCInstallDir)/bin for VS) +# -- Set the host compiler to be used by nvcc. Ignored if -ccbin or +# --compiler-bindir is already present in the CUDA_NVCC_FLAGS or +# CUDA_NVCC_FLAGS_ variables. For Visual Studio targets +# $(VCInstallDir)/bin is a special value that expands out to the path when +# the command is run from withing VS. +# # CUDA_NVCC_FLAGS # CUDA_NVCC_FLAGS_ # -- Additional NVCC command line arguments. NOTE: multiple arguments must be @@ -390,6 +397,12 @@ option(CUDA_HOST_COMPILATION_CPP "Generated file extension" ON) # Extra user settable flags set(CUDA_NVCC_FLAGS "" CACHE STRING "Semi-colon delimit multiple arguments.") +if(CMAKE_GENERATOR MATCHES "Visual Studio") + set(CUDA_HOST_COMPILER "$(VCInstallDir)bin" CACHE FILEPATH "Host side compiler used by NVCC") +else() + set(CUDA_HOST_COMPILER "${CMAKE_C_COMPILER}" CACHE FILEPATH "Host side compiler used by NVCC") +endif() + # Propagate the host flags to the host compiler via -Xcompiler option(CUDA_PROPAGATE_HOST_FLAGS "Propage C/CXX_FLAGS and friends to the host compiler via -Xcompile" ON) @@ -938,12 +951,11 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) endif() # This needs to be passed in at this stage, because VS needs to fill out the - # value of VCInstallDir from within VS. + # value of VCInstallDir from within VS. Note that CCBIN is only used if + # -ccbin or --compiler-bindir isn't used and CUDA_HOST_COMPILER matches + # $(VCInstallDir)/bin. if(CMAKE_GENERATOR MATCHES "Visual Studio") - if( CMAKE_SIZEOF_VOID_P EQUAL 8 ) - # Add nvcc flag for 64b Windows - set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" ) - endif() + set(ccbin_flags -D "\"CCBIN:PATH=$(VCInstallDir)bin\"" ) endif() # Figure out which configure we will use and pass that in as an argument to diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index b31011c0e..381246d01 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -62,6 +62,7 @@ set(cmake_dependency_file "@cmake_dependency_file@") # path set(CUDA_make2cmake "@CUDA_make2cmake@") # path set(CUDA_parse_cubin "@CUDA_parse_cubin@") # path set(build_cubin @build_cubin@) # bool +set(CUDA_HOST_COMPILER "@CUDA_HOST_COMPILER@") # bool # We won't actually use these variables for now, but we need to set this, in # order to force this file to be run again if it changes. set(generated_file_path "@generated_file_path@") # path @@ -102,8 +103,15 @@ endif() # Add the build specific configuration flags list(APPEND CUDA_NVCC_FLAGS ${CUDA_NVCC_FLAGS_${build_configuration}}) -if(DEFINED CCBIN) - set(CCBIN -ccbin "${CCBIN}") +# Any -ccbin existing in CUDA_NVCC_FLAGS gets highest priority +list( FIND CUDA_NVCC_FLAGS "-ccbin" ccbin_found0 ) +list( FIND CUDA_NVCC_FLAGS "--compiler-bindir" ccbin_found1 ) +if( ccbin_found0 LESS 0 AND ccbin_found1 LESS 0 ) + if (CUDA_HOST_COMPILER STREQUAL "$(VCInstallDir)bin" AND DEFINED CCBIN) + set(CCBIN -ccbin "${CCBIN}") + else() + set(CCBIN -ccbin "${CUDA_HOST_COMPILER}") + endif() endif() # cuda_execute_process - Executes a command with optional command echo and status message. From 95e502ee7c9c751d308f5685f048ba1b555cc038 Mon Sep 17 00:00:00 2001 From: Alex Neundorf Date: Mon, 20 Aug 2012 23:19:44 +0200 Subject: [PATCH 013/152] error out if CTEST_USE_LAUNCHERS is TRUE but RULE_LAUNCH_* are not set Otherwise, CTEST_USE_LAUNCHERS can be set to true in a driving ctest script, and everything looks like it would work and reports 0 build errors, but actually there can be any amount of errors and they are just not reported. By adding this check cmake now errors out if CTEST_USE_LAUNCHERS is enabled, but the RULE properties are not set, which would lead to a not-working ctest run. Alex --- Source/cmake.cxx | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 75aa4712c..08c232984 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2326,6 +2326,17 @@ int cmake::ActualConfigure() this->CacheManager->RemoveCacheEntry("CMAKE_GENERATOR"); this->CacheManager->RemoveCacheEntry("CMAKE_EXTRA_GENERATOR"); } + + cmMakefile* mf=this->GlobalGenerator->GetLocalGenerators()[0]->GetMakefile(); + if (mf->IsOn("CTEST_USE_LAUNCHERS") + && !this->GetProperty("RULE_LAUNCH_COMPILE", cmProperty::GLOBAL)) + { + cmSystemTools::Error("CTEST_USE_LAUNCHERS is enabled, but the " + "RULE_LAUNCH_COMPILE global property is not defined.\n" + "Did you forget to include(CTest) in the toplevel " + "CMakeLists.txt ?"); + } + // only save the cache if there were no fatal errors if ( this->GetWorkingMode() == NORMAL_MODE ) { From 787287cc4605dca8831efd56722cb6675e6998c5 Mon Sep 17 00:00:00 2001 From: James Bigler Date: Mon, 20 Aug 2012 17:33:35 -0600 Subject: [PATCH 014/152] Added CUDA_SOURCE_PROPERTY_FORMAT. Allows setting per file format (OBJ or PTX) Added CUDA_SOURCE_PROPERTY_FORMAT that allows users to set the format (OBJ or PTX) on a per file basis. --- Modules/FindCUDA.cmake | 48 +++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 19 deletions(-) diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 6a6be47c6..0cc80bea5 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -900,14 +900,6 @@ endfunction() macro(CUDA_WRAP_SRCS cuda_target format generated_files) - if( ${format} MATCHES "PTX" ) - set( compile_to_ptx ON ) - elseif( ${format} MATCHES "OBJ") - set( compile_to_ptx OFF ) - else() - message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS: '${format}'. Use OBJ or PTX.") - endif() - # Set up all the command line flags here, so that they can be overridden on a per target basis. set(nvcc_flags "") @@ -1004,12 +996,12 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) # Only add the CMAKE_{C,CXX}_FLAGS if we are propagating host flags. We # always need to set the SHARED_FLAGS, though. if(CUDA_PROPAGATE_HOST_FLAGS) - set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CMAKE_${CUDA_C_OR_CXX}_FLAGS} ${CUDA_HOST_SHARED_FLAGS})") + set(_cuda_host_flags "set(CMAKE_HOST_FLAGS ${CMAKE_${CUDA_C_OR_CXX}_FLAGS} ${CUDA_HOST_SHARED_FLAGS})") else() - set(CUDA_HOST_FLAGS "set(CMAKE_HOST_FLAGS ${CUDA_HOST_SHARED_FLAGS})") + set(_cuda_host_flags "set(CMAKE_HOST_FLAGS ${CUDA_HOST_SHARED_FLAGS})") endif() - set(CUDA_NVCC_FLAGS_CONFIG "# Build specific configuration flags") + set(_cuda_nvcc_flags_config "# Build specific configuration flags") # Loop over all the configuration types to generate appropriate flags for run_nvcc.cmake foreach(config ${CUDA_configuration_types}) string(TOUPPER ${config} config_upper) @@ -1024,21 +1016,15 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") endif() - set(CUDA_HOST_FLAGS "${CUDA_HOST_FLAGS}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})") + set(_cuda_host_flags "${_cuda_host_flags}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})") endif() # Note that if we ever want CUDA_NVCC_FLAGS_ to be string (instead of a list # like it is currently), we can remove the quotes around the # ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_ variable. - set(CUDA_NVCC_FLAGS_CONFIG "${CUDA_NVCC_FLAGS_CONFIG}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})") + set(_cuda_nvcc_flags_config "${_cuda_nvcc_flags_config}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})") endforeach() - if(compile_to_ptx) - # Don't use any of the host compilation flags for PTX targets. - set(CUDA_HOST_FLAGS) - set(CUDA_NVCC_FLAGS_CONFIG) - endif() - # Get the list of definitions from the directory property get_directory_property(CUDA_NVCC_DEFINITIONS COMPILE_DEFINITIONS) if(CUDA_NVCC_DEFINITIONS) @@ -1061,6 +1047,30 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) get_source_file_property(_is_header ${file} HEADER_FILE_ONLY) if(${file} MATCHES ".*\\.cu$" AND NOT _is_header) + # Allow per source file overrides of the format. + get_source_file_property(_cuda_source_format ${file} CUDA_SOURCE_PROPERTY_FORMAT) + if(NOT _cuda_source_format) + set(_cuda_source_format ${format}) + endif() + + if( ${_cuda_source_format} MATCHES "PTX" ) + set( compile_to_ptx ON ) + elseif( ${_cuda_source_format} MATCHES "OBJ") + set( compile_to_ptx OFF ) + else() + message( FATAL_ERROR "Invalid format flag passed to CUDA_WRAP_SRCS for file '${file}': '${_cuda_source_format}'. Use OBJ or PTX.") + endif() + + + if(compile_to_ptx) + # Don't use any of the host compilation flags for PTX targets. + set(CUDA_HOST_FLAGS) + set(CUDA_NVCC_FLAGS_CONFIG) + else() + set(CUDA_HOST_FLAGS ${_cuda_host_flags}) + set(CUDA_NVCC_FLAGS_CONFIG ${_cuda_nvcc_flags_config}) + endif() + # Determine output directory cuda_compute_build_path("${file}" cuda_build_path) set(cuda_compile_intermediate_directory "${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/${cuda_target}.dir/${cuda_build_path}") From 733deb66c63dbbd8caa84f7630318c6f76da2d9f Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 21 Aug 2012 11:04:09 +0200 Subject: [PATCH 015/152] Fix CompileDefinitions test on Visual Studio. Avoid testing unsupported spaces in define values. --- Tests/CompileDefinitions/CMakeLists.txt | 4 ++++ Tests/CompileDefinitions/main.cpp | 7 ++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt index 3e4181b8d..337aeb1cf 100644 --- a/Tests/CompileDefinitions/CMakeLists.txt +++ b/Tests/CompileDefinitions/CMakeLists.txt @@ -3,6 +3,10 @@ cmake_minimum_required(VERSION 2.8) project(CompileDefinitions) +if ("${CMAKE_GENERATOR}" STREQUAL "Visual Studio 6") + add_definitions(-DNO_SPACES_IN_DEFINE_VALUES) +endif() + add_subdirectory(add_definitions_command) add_subdirectory(target_prop) add_subdirectory(add_definitions_command_with_target_prop) diff --git a/Tests/CompileDefinitions/main.cpp b/Tests/CompileDefinitions/main.cpp index d80c9dc9a..6db6f3f96 100644 --- a/Tests/CompileDefinitions/main.cpp +++ b/Tests/CompileDefinitions/main.cpp @@ -15,11 +15,16 @@ template<> struct CMakeStaticAssert {}; static const char fun_string[] = CMAKE_IS_; +#ifndef NO_SPACES_IN_DEFINE_VALUES static const char very_fun_string[] = CMAKE_IS_REALLY; +#endif enum { - StringLiteralTest1 = sizeof(CMakeStaticAssert), + StringLiteralTest1 = sizeof(CMakeStaticAssert) +#ifndef NO_SPACES_IN_DEFINE_VALUES + , StringLiteralTest2 = sizeof(CMakeStaticAssert) +#endif }; int main(int argc, char **argv) From ca7fb14f9b966805cb11fdf71648337b71c1047b Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 21 Aug 2012 11:05:07 +0200 Subject: [PATCH 016/152] Fix the test setting COMPILE_DEFINITIONS target property --- Tests/CompileDefinitions/target_prop/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt index 8248a2149..6dbee9a4e 100644 --- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt +++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt @@ -3,7 +3,7 @@ project(target_prop) add_executable(target_prop_executable ../main.cpp) -set_target_properties(target_prop_executable PROPERTIES CMAKE_IS_FUN -DCMAKE_IS_REALLY="Very Fun") +set_target_properties(target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_FUN) set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_REALLY="Very Fun" CMAKE_IS=Fun) set_property(TARGET target_prop_executable APPEND PROPERTY COMPILE_DEFINITIONS CMAKE_IS_FUN CMAKE_IS_="Fun") From bd728f6feeab10db189e82d3100c9df9ee64ad5c Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 17 Aug 2012 20:09:43 +0200 Subject: [PATCH 017/152] Add a return-after-error if an old Qt is found. No need for an else after a return. --- Source/QtDialog/CMakeLists.txt | 207 ++++++++++++++++----------------- 1 file changed, 103 insertions(+), 104 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 0969aea01..221e4d25c 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -15,109 +15,108 @@ find_package(Qt4 REQUIRED) if(NOT QT4_FOUND) message(SEND_ERROR "Failed to find Qt 4.4 or greater.") -else() - - include(${QT_USE_FILE}) - set(CMAKE_PACKAGE_QTGUI TRUE) - set(SRCS - AddCacheEntry.cxx - AddCacheEntry.h - CMakeSetup.cxx - CMakeSetupDialog.cxx - CMakeSetupDialog.h - FirstConfigure.cxx - FirstConfigure.h - QCMake.cxx - QCMake.h - QCMakeCacheView.cxx - QCMakeCacheView.h - QCMakeWidgets.cxx - QCMakeWidgets.h - QMacInstallDialog.cxx - QMacInstallDialog.h - ) - QT4_WRAP_UI(UI_SRCS - CMakeSetupDialog.ui - Compilers.ui - CrossCompiler.ui - AddCacheEntry.ui - MacInstallDialog.ui - ) - QT4_WRAP_CPP(MOC_SRCS - AddCacheEntry.h - Compilers.h - CMakeSetupDialog.h - FirstConfigure.h - QCMake.h - QCMakeCacheView.h - QCMakeWidgets.h - QMacInstallDialog.h - ) - QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) - - set(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS}) - if(Q_WS_WIN) - set(SRCS ${SRCS} CMakeSetup.rc) - endif() - if(Q_WS_MAC) - set(SRCS ${SRCS} CMakeSetup.icns) - set(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns) - set_source_files_properties(CMakeSetup.icns PROPERTIES - MACOSX_PACKAGE_LOCATION Resources) - endif() - - include_directories(${CMAKE_CURRENT_BINARY_DIR}) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - - add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) - target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) - if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) - if(APPLE) - set_target_properties(cmake-gui PROPERTIES - OUTPUT_NAME ${CMAKE_BUNDLE_NAME}) - endif() - set(CMAKE_INSTALL_DESTINATION_ARGS - BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") - endif() - - install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) - - if(UNIX) - # install a desktop file so CMake appears in the application start menu - # with an icon - install(FILES CMake.desktop DESTINATION share/applications ) - install(FILES CMakeSetup32.png DESTINATION share/pixmaps ) - install(FILES cmakecache.xml DESTINATION share/mime/packages ) - endif() - - if(APPLE) - set(CMAKE_POSTFLIGHT_SCRIPT - "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") - set(CMAKE_POSTUPGRADE_SCRIPT - "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") - configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postflight.sh.in" - "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") - configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postupgrade.sh.in" - "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") - install(CODE "execute_process(COMMAND ln -s \"../MacOS/${CMAKE_BUNDLE_NAME}\" cmake-gui - WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") - endif() - - if(APPLE OR WIN32) - # install rules for including 3rd party libs such as Qt - # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation - set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") - if(APPLE) - set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}") - endif() - install(CODE " - include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") - set(BU_CHMOD_BUNDLE_ITEMS ON) - fixup_bundle(\"${fixup_exe}\" \"\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") - ") - endif() - - configure_file("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in" - "${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY) + return() endif() +include(${QT_USE_FILE}) +set(CMAKE_PACKAGE_QTGUI TRUE) +set(SRCS + AddCacheEntry.cxx + AddCacheEntry.h + CMakeSetup.cxx + CMakeSetupDialog.cxx + CMakeSetupDialog.h + FirstConfigure.cxx + FirstConfigure.h + QCMake.cxx + QCMake.h + QCMakeCacheView.cxx + QCMakeCacheView.h + QCMakeWidgets.cxx + QCMakeWidgets.h + QMacInstallDialog.cxx + QMacInstallDialog.h + ) +QT4_WRAP_UI(UI_SRCS + CMakeSetupDialog.ui + Compilers.ui + CrossCompiler.ui + AddCacheEntry.ui + MacInstallDialog.ui + ) +QT4_WRAP_CPP(MOC_SRCS + AddCacheEntry.h + Compilers.h + CMakeSetupDialog.h + FirstConfigure.h + QCMake.h + QCMakeCacheView.h + QCMakeWidgets.h + QMacInstallDialog.h + ) +QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) + +set(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS}) +if(Q_WS_WIN) + set(SRCS ${SRCS} CMakeSetup.rc) +endif() +if(Q_WS_MAC) + set(SRCS ${SRCS} CMakeSetup.icns) + set(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns) + set_source_files_properties(CMakeSetup.icns PROPERTIES + MACOSX_PACKAGE_LOCATION Resources) +endif() + +include_directories(${CMAKE_CURRENT_BINARY_DIR}) +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) +target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) +if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) + if(APPLE) + set_target_properties(cmake-gui PROPERTIES + OUTPUT_NAME ${CMAKE_BUNDLE_NAME}) + endif() + set(CMAKE_INSTALL_DESTINATION_ARGS + BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") +endif() + +install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) + +if(UNIX) + # install a desktop file so CMake appears in the application start menu + # with an icon + install(FILES CMake.desktop DESTINATION share/applications ) + install(FILES CMakeSetup32.png DESTINATION share/pixmaps ) + install(FILES cmakecache.xml DESTINATION share/mime/packages ) +endif() + +if(APPLE) + set(CMAKE_POSTFLIGHT_SCRIPT + "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") + set(CMAKE_POSTUPGRADE_SCRIPT + "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") + configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postflight.sh.in" + "${CMake_BINARY_DIR}/Source/QtDialog/postflight.sh") + configure_file("${CMake_SOURCE_DIR}/Source/QtDialog/postupgrade.sh.in" + "${CMake_BINARY_DIR}/Source/QtDialog/postupgrade.sh") + install(CODE "execute_process(COMMAND ln -s \"../MacOS/${CMAKE_BUNDLE_NAME}\" cmake-gui + WORKING_DIRECTORY \$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin)") +endif() + +if(APPLE OR WIN32) + # install rules for including 3rd party libs such as Qt + # if a system Qt is used (e.g. installed in /usr/lib/), it will not be included in the installation + set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/bin/cmake-gui${CMAKE_EXECUTABLE_SUFFIX}") + if(APPLE) + set(fixup_exe "\$ENV{DESTDIR}\${CMAKE_INSTALL_PREFIX}/MacOS/${CMAKE_BUNDLE_NAME}") + endif() + install(CODE " + include(\"${CMake_SOURCE_DIR}/Modules/BundleUtilities.cmake\") + set(BU_CHMOD_BUNDLE_ITEMS ON) + fixup_bundle(\"${fixup_exe}\" \"\" \"${QT_LIBRARY_DIR};${QT_BINARY_DIR}\") + ") +endif() + +configure_file("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in" + "${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY) From 8ab312b6930c52a8f04688d8834383be4f09f5d5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 23 Feb 2012 12:33:11 +0100 Subject: [PATCH 018/152] Use CMake platform variables instead of Qt ones. The Qt ones no longer exist in Qt 5. --- Source/QtDialog/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 221e4d25c..00fc9faf2 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -57,10 +57,10 @@ QT4_WRAP_CPP(MOC_SRCS QT4_ADD_RESOURCES(RC_SRCS CMakeSetup.qrc) set(SRCS ${SRCS} ${UI_SRCS} ${MOC_SRCS} ${RC_SRCS}) -if(Q_WS_WIN) +if(WIN32) set(SRCS ${SRCS} CMakeSetup.rc) endif() -if(Q_WS_MAC) +if(APPLE) set(SRCS ${SRCS} CMakeSetup.icns) set(MACOSX_BUNDLE_ICON_FILE CMakeSetup.icns) set_source_files_properties(CMakeSetup.icns PROPERTIES From 0b6625c605b95ef7e936717e946906d422d3d4f7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 17 Aug 2012 20:24:14 +0200 Subject: [PATCH 019/152] Move variable setting down to where it relates to. --- Source/QtDialog/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 00fc9faf2..625e6d16d 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -19,7 +19,6 @@ if(NOT QT4_FOUND) endif() include(${QT_USE_FILE}) -set(CMAKE_PACKAGE_QTGUI TRUE) set(SRCS AddCacheEntry.cxx AddCacheEntry.h @@ -118,5 +117,6 @@ if(APPLE OR WIN32) ") endif() +set(CMAKE_PACKAGE_QTGUI TRUE) configure_file("${QtDialog_SOURCE_DIR}/QtDialogCPack.cmake.in" "${QtDialog_BINARY_DIR}/QtDialogCPack.cmake" @ONLY) From 32a572564a94380a543593f9568d34fc2c4a8b70 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 17 Aug 2012 20:48:15 +0200 Subject: [PATCH 020/152] Remove an if which is always true. CMake based CMake build requires version 2.8.2 as of version 2.8.9. --- Source/QtDialog/CMakeLists.txt | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 625e6d16d..1eaa8dcbb 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -71,14 +71,13 @@ include_directories(${CMAKE_CURRENT_SOURCE_DIR}) add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) -if(${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION} GREATER 2.4) - if(APPLE) - set_target_properties(cmake-gui PROPERTIES - OUTPUT_NAME ${CMAKE_BUNDLE_NAME}) - endif() - set(CMAKE_INSTALL_DESTINATION_ARGS - BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") + +if(APPLE) + set_target_properties(cmake-gui PROPERTIES + OUTPUT_NAME ${CMAKE_BUNDLE_NAME}) endif() +set(CMAKE_INSTALL_DESTINATION_ARGS + BUNDLE DESTINATION "${CMAKE_BUNDLE_LOCATION}") install(TARGETS cmake-gui RUNTIME DESTINATION bin ${CMAKE_INSTALL_DESTINATION_ARGS}) From 430ba9faef26d66e2fb3ffb938122b62f627562d Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 17 Aug 2012 20:37:54 +0200 Subject: [PATCH 021/152] Use add_subdirectory instead of the obsolete subdirs. --- Source/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index e79689b08..242470d7a 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -548,7 +548,7 @@ endif() # Qt GUI option(BUILD_QtDialog "Build Qt dialog for CMake" FALSE) if(BUILD_QtDialog) - subdirs(QtDialog) + add_subdirectory(QtDialog) endif() include (${CMake_BINARY_DIR}/Source/LocalUserOptions.cmake OPTIONAL) From 066e85893ffa3492e4247e59a80ee1de67babef5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Fri, 17 Aug 2012 20:25:51 +0200 Subject: [PATCH 022/152] Replace two include_directories with a setting. --- Source/QtDialog/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 1eaa8dcbb..51e61d0cb 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -66,8 +66,7 @@ if(APPLE) MACOSX_PACKAGE_LOCATION Resources) endif() -include_directories(${CMAKE_CURRENT_BINARY_DIR}) -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +set(CMAKE_INCLUDE_CURRENT_DIR ON) add_executable(cmake-gui WIN32 MACOSX_BUNDLE ${SRCS}) target_link_libraries(cmake-gui CMakeLib ${QT_QTMAIN_LIBRARY} ${QT_LIBRARIES}) From 717f31a877e701b801043b893c97f4a186f93739 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 23 Feb 2012 12:35:53 +0100 Subject: [PATCH 023/152] Compile with both Qt4 and Qt5. --- Source/QtDialog/QCMake.cxx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index a2b1567bf..0d0118164 100644 --- a/Source/QtDialog/QCMake.cxx +++ b/Source/QtDialog/QCMake.cxx @@ -348,7 +348,11 @@ void QCMake::interrupt() bool QCMake::interruptCallback(void* cd) { QCMake* self = reinterpret_cast(cd); +#if QT_VERSION < QT_VERSION_CHECK(5, 0, 0) return self->InterruptFlag; +#else + return self->InterruptFlag.load(); +#endif } void QCMake::progressCallback(const char* msg, float percent, void* cd) From 4c9ae472ecb1a2b8e8ce0b115d0f54bf5f875fb1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Aug 2012 12:06:35 -0400 Subject: [PATCH 024/152] VS11: Rename 'Immersive' to 'WindowsAppContainer' (#12930) Since commit 9e01aefd (VS: Add support for WinRT project properties, 2012-02-03) CMake generates for VS 11 projects the 'Immersive' element for the VS_WINRT_EXTENSIONS target property. That was based on the VS 11 preview version. The final version renamed the element to 'WindowsAppContainer', so generate that instead. Suggested-by: Eugene Golushkov --- Source/cmVisualStudio10TargetGenerator.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6caaad1bc..6626e5bc1 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -413,7 +413,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() } if(this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS")) { - this->WriteString("true\n", 2); + this->WriteString("true" + "\n", 2); } this->WriteString("\n", 1); } From 59cbc28b92bf0cd91f760985edcde625a6fbcf6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Wed, 22 Aug 2012 12:26:56 +0200 Subject: [PATCH 025/152] Ninja: prepare msvc pdb cleanup --- Source/cmNinjaNormalTargetGenerator.cxx | 30 ++++++++++++------------- Source/cmNinjaTargetGenerator.cxx | 6 +++-- 2 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index a923d6068..59db29564 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -459,23 +459,23 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } } - std::string path; if (!this->TargetNameImport.empty()) { - path = this->GetLocalGenerator()->ConvertToOutputFormat( - targetOutputImplib.c_str(), cmLocalGenerator::SHELL); - vars["TARGET_IMPLIB"] = path; - EnsureParentDirectoryExists(path); + const std::string impLibPath = this->GetLocalGenerator() + ->ConvertToOutputFormat(targetOutputImplib.c_str(), + cmLocalGenerator::SHELL); + vars["TARGET_IMPLIB"] = impLibPath; + EnsureParentDirectoryExists(impLibPath); } cmMakefile* mf = this->GetMakefile(); if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) { - path = this->GetTargetPDB(); + const std::string pdbPath = this->GetTargetPDB(); vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(path.c_str()).c_str(), + ConvertToNinjaPath(pdbPath.c_str()).c_str(), cmLocalGenerator::SHELL); - EnsureParentDirectoryExists(path); + EnsureParentDirectoryExists(pdbPath); } else { @@ -494,9 +494,9 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() if (mf->IsOn("CMAKE_COMPILER_IS_MINGW")) { - path = GetTarget()->GetSupportDirectory(); - vars["OBJECT_DIR"] = ConvertToNinjaPath(path.c_str()); - EnsureDirectoryExists(path); + const std::string objPath = GetTarget()->GetSupportDirectory(); + vars["OBJECT_DIR"] = ConvertToNinjaPath(objPath.c_str()); + EnsureDirectoryExists(objPath); // ar.exe can't handle backslashes in rsp files (implictly used by gcc) std::string& linkLibraries = vars["LINK_LIBRARIES"]; std::replace(linkLibraries.begin(), linkLibraries.end(), '\\', '/'); @@ -527,10 +527,10 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() // If we have any PRE_LINK commands, we need to go back to HOME_OUTPUT for // the link commands. if (!preLinkCmdLines.empty()) { - path = this->GetLocalGenerator()->ConvertToOutputFormat( - this->GetMakefile()->GetHomeOutputDirectory(), - cmLocalGenerator::SHELL); - preLinkCmdLines.push_back("cd " + path); + const std::string homeOutDir = this->GetLocalGenerator() + ->ConvertToOutputFormat(this->GetMakefile()->GetHomeOutputDirectory(), + cmLocalGenerator::SHELL); + preLinkCmdLines.push_back("cd " + homeOutDir); } vars["PRE_LINK"] = diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b6bdfdcdf..328ca2d73 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -542,9 +542,11 @@ cmNinjaTargetGenerator if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) { + const std::string pdbPath = this->GetTargetPDB(); vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(GetTargetPDB().c_str()).c_str(), - cmLocalGenerator::SHELL); + ConvertToNinjaPath(pdbPath.c_str()).c_str(), + cmLocalGenerator::SHELL); + EnsureParentDirectoryExists(pdbPath); } if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS")) From 4bb4787780e51d18b9744f52bfa635818dd34ca5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Wed, 22 Aug 2012 12:37:55 +0200 Subject: [PATCH 026/152] Ninja:split out setting of msvc TARGET_PDB --- Source/cmNinjaNormalTargetGenerator.cxx | 11 +-------- Source/cmNinjaTargetGenerator.cxx | 31 ++++++++++++++----------- Source/cmNinjaTargetGenerator.h | 7 ++++-- 3 files changed, 24 insertions(+), 25 deletions(-) diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 59db29564..9dc860ee9 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -468,16 +468,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() } cmMakefile* mf = this->GetMakefile(); - if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || - mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) - { - const std::string pdbPath = this->GetTargetPDB(); - vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(pdbPath.c_str()).c_str(), - cmLocalGenerator::SHELL); - EnsureParentDirectoryExists(pdbPath); - } - else + if (!this->SetMsvcTargetPdbVariable(vars)) { // It is common to place debug symbols at a specific place, // so we need a plain target name in the rule available. diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 328ca2d73..b89602e2f 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -311,6 +311,21 @@ std::string cmNinjaTargetGenerator::GetTargetPDB() const return targetFullPathPDB.c_str(); } +bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const +{ + cmMakefile* mf = this->GetMakefile(); + if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || + mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) + { + const std::string pdbPath = this->GetTargetPDB(); + vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( + ConvertToNinjaPath(pdbPath.c_str()).c_str(), + cmLocalGenerator::SHELL); + EnsureParentDirectoryExists(pdbPath); + return true; + } + return false; +} void cmNinjaTargetGenerator @@ -537,17 +552,7 @@ cmNinjaTargetGenerator vars["DEP_FILE"] = objectFileName + ".d";; EnsureParentDirectoryExists(objectFileName); - // TODO move to GetTargetPDB - cmMakefile* mf = this->GetMakefile(); - if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || - mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) - { - const std::string pdbPath = this->GetTargetPDB(); - vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( - ConvertToNinjaPath(pdbPath.c_str()).c_str(), - cmLocalGenerator::SHELL); - EnsureParentDirectoryExists(pdbPath); - } + this->SetMsvcTargetPdbVariable(vars); if(this->Makefile->IsOn("CMAKE_EXPORT_COMPILE_COMMANDS")) { @@ -643,14 +648,14 @@ cmNinjaTargetGenerator void cmNinjaTargetGenerator -::EnsureDirectoryExists(const std::string& dir) +::EnsureDirectoryExists(const std::string& dir) const { cmSystemTools::MakeDirectory(dir.c_str()); } void cmNinjaTargetGenerator -::EnsureParentDirectoryExists(const std::string& path) +::EnsureParentDirectoryExists(const std::string& path) const { EnsureDirectoryExists(cmSystemTools::GetParentDirectory(path.c_str())); } diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 84573cec2..0c52fc409 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -44,6 +44,9 @@ public: std::string GetTargetName() const; protected: + + bool SetMsvcTargetPdbVariable(cmNinjaVars&) const; + cmGeneratedFileStream& GetBuildFileStream() const; cmGeneratedFileStream& GetRulesFileStream() const; @@ -112,8 +115,8 @@ protected: // Helper to add flag for windows .def file. void AddModuleDefinitionFlag(std::string& flags); - void EnsureDirectoryExists(const std::string& dir); - void EnsureParentDirectoryExists(const std::string& path); + void EnsureDirectoryExists(const std::string& dir) const; + void EnsureParentDirectoryExists(const std::string& path) const; // write rules for Mac OS X Application Bundle content. struct MacOSXContentGeneratorType : From 25a4f5675490d9311db271942ecd1781de5f3558 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 23 Feb 2012 12:40:38 +0100 Subject: [PATCH 027/152] Build with Qt5 if it is found. --- Source/QtDialog/CMakeLists.txt | 31 ++++++++++++++++++++++++------- 1 file changed, 24 insertions(+), 7 deletions(-) diff --git a/Source/QtDialog/CMakeLists.txt b/Source/QtDialog/CMakeLists.txt index 51e61d0cb..a1ffa2076 100644 --- a/Source/QtDialog/CMakeLists.txt +++ b/Source/QtDialog/CMakeLists.txt @@ -9,16 +9,33 @@ # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. # See the License for more information. #============================================================================= -project(QtDialog) -set(QT_MIN_VERSION "4.4.0") -find_package(Qt4 REQUIRED) -if(NOT QT4_FOUND) - message(SEND_ERROR "Failed to find Qt 4.4 or greater.") - return() +project(QtDialog) +find_package(Qt5Widgets QUIET) +if (Qt5Widgets_FOUND) + include_directories(${Qt5Widgets_INCLUDE_DIRS}) + add_definitions(${Qt5Widgets_DEFINITONS}) + macro(qt4_wrap_ui) + qt5_wrap_ui(${ARGN}) + endmacro() + macro(qt4_wrap_cpp) + qt5_wrap_cpp(${ARGN}) + endmacro() + macro(qt4_add_resources) + qt5_add_resources(${ARGN}) + endmacro() + set(QT_LIBRARIES ${Qt5Widgets_LIBRARIES}) +else() + set(QT_MIN_VERSION "4.4.0") + find_package(Qt4 REQUIRED) + if(NOT QT4_FOUND) + message(SEND_ERROR "Failed to find Qt 4.4 or greater.") + return() + endif() + + include(${QT_USE_FILE}) endif() -include(${QT_USE_FILE}) set(SRCS AddCacheEntry.cxx AddCacheEntry.h From f0a1065393a57f503bc2c86f432f50dd4b8d5bbd Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Wed, 22 Aug 2012 13:03:56 +0200 Subject: [PATCH 028/152] Rename files from main.cpp to more meaningful names. Because the main file for the dummy-executable and the actual compile test were both called main.cpp, they were overwriting each other during in-source builds. --- Tests/CompileDefinitions/CMakeLists.txt | 4 ++-- .../CompileDefinitions/add_definitions_command/CMakeLists.txt | 2 +- .../add_definitions_command_with_target_prop/CMakeLists.txt | 2 +- Tests/CompileDefinitions/{main.cpp => compiletest.cpp} | 0 Tests/CompileDefinitions/target_prop/CMakeLists.txt | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) rename Tests/CompileDefinitions/{main.cpp => compiletest.cpp} (100%) diff --git a/Tests/CompileDefinitions/CMakeLists.txt b/Tests/CompileDefinitions/CMakeLists.txt index 337aeb1cf..e7d91bf94 100644 --- a/Tests/CompileDefinitions/CMakeLists.txt +++ b/Tests/CompileDefinitions/CMakeLists.txt @@ -11,6 +11,6 @@ add_subdirectory(add_definitions_command) add_subdirectory(target_prop) add_subdirectory(add_definitions_command_with_target_prop) -file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/main.cpp" "int main(int, char **) { return 0; }\n") +file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp" "int main(int, char **) { return 0; }\n") -add_executable(CompileDefinitions "${CMAKE_CURRENT_BINARY_DIR}/main.cpp") +add_executable(CompileDefinitions "${CMAKE_CURRENT_BINARY_DIR}/dummyexecutable.cpp") diff --git a/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt b/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt index 4ca269d77..a6372af74 100644 --- a/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt +++ b/Tests/CompileDefinitions/add_definitions_command/CMakeLists.txt @@ -4,4 +4,4 @@ project(add_definitions_command) add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun -DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun") add_definitions(-DCMAKE_IS_="Fun" -DCMAKE_IS_REALLY="Very Fun" -DCMAKE_IS_FUN -DCMAKE_IS=Fun) -add_executable(add_definitions_command_executable ../main.cpp) +add_executable(add_definitions_command_executable ../compiletest.cpp) diff --git a/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt b/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt index 4161ed649..e415390c0 100644 --- a/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt +++ b/Tests/CompileDefinitions/add_definitions_command_with_target_prop/CMakeLists.txt @@ -3,7 +3,7 @@ project(add_definitions_command_with_target_prop) add_definitions(-DCMAKE_IS_FUN -DCMAKE_IS=Fun) -add_executable(add_definitions_command_with_target_prop_executable ../main.cpp) +add_executable(add_definitions_command_with_target_prop_executable ../compiletest.cpp) set_target_properties(add_definitions_command_with_target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_="Fun") diff --git a/Tests/CompileDefinitions/main.cpp b/Tests/CompileDefinitions/compiletest.cpp similarity index 100% rename from Tests/CompileDefinitions/main.cpp rename to Tests/CompileDefinitions/compiletest.cpp diff --git a/Tests/CompileDefinitions/target_prop/CMakeLists.txt b/Tests/CompileDefinitions/target_prop/CMakeLists.txt index 6dbee9a4e..e2b6ba9b2 100644 --- a/Tests/CompileDefinitions/target_prop/CMakeLists.txt +++ b/Tests/CompileDefinitions/target_prop/CMakeLists.txt @@ -1,7 +1,7 @@ project(target_prop) -add_executable(target_prop_executable ../main.cpp) +add_executable(target_prop_executable ../compiletest.cpp) set_target_properties(target_prop_executable PROPERTIES COMPILE_DEFINITIONS CMAKE_IS_FUN) From 709fa59562569b6c6a8244f5ba53b60ebf840a30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Wed, 22 Aug 2012 12:42:16 +0200 Subject: [PATCH 029/152] Ninja: remove GetTargetPDB because it is used only once --- Source/cmNinjaTargetGenerator.cxx | 27 +++++++++++---------------- Source/cmNinjaTargetGenerator.h | 1 - 2 files changed, 11 insertions(+), 17 deletions(-) diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b89602e2f..0256aa93e 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -295,21 +295,6 @@ std::string cmNinjaTargetGenerator::GetTargetName() const return this->Target->GetName(); } -std::string cmNinjaTargetGenerator::GetTargetPDB() const -{ - std::string targetFullPathPDB; - if(this->Target->GetType() == cmTarget::EXECUTABLE || - this->Target->GetType() == cmTarget::STATIC_LIBRARY || - this->Target->GetType() == cmTarget::SHARED_LIBRARY || - this->Target->GetType() == cmTarget::MODULE_LIBRARY) - { - targetFullPathPDB = this->Target->GetDirectory(this->GetConfigName()); - targetFullPathPDB += "/"; - targetFullPathPDB += this->Target->GetPDBName(this->GetConfigName()); - } - - return targetFullPathPDB.c_str(); -} bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const { @@ -317,7 +302,17 @@ bool cmNinjaTargetGenerator::SetMsvcTargetPdbVariable(cmNinjaVars& vars) const if (mf->GetDefinition("MSVC_C_ARCHITECTURE_ID") || mf->GetDefinition("MSVC_CXX_ARCHITECTURE_ID")) { - const std::string pdbPath = this->GetTargetPDB(); + std::string pdbPath; + if(this->Target->GetType() == cmTarget::EXECUTABLE || + this->Target->GetType() == cmTarget::STATIC_LIBRARY || + this->Target->GetType() == cmTarget::SHARED_LIBRARY || + this->Target->GetType() == cmTarget::MODULE_LIBRARY) + { + pdbPath = this->Target->GetDirectory(this->GetConfigName()); + pdbPath += "/"; + pdbPath += this->Target->GetPDBName(this->GetConfigName()); + } + vars["TARGET_PDB"] = this->GetLocalGenerator()->ConvertToOutputFormat( ConvertToNinjaPath(pdbPath.c_str()).c_str(), cmLocalGenerator::SHELL); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index 0c52fc409..cd20694b4 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -40,7 +40,6 @@ public: virtual void Generate() = 0; - std::string GetTargetPDB() const; std::string GetTargetName() const; protected: From 3553001bcc425dfb5d84a2dc8d657fe92c007962 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 08:33:12 -0400 Subject: [PATCH 030/152] Qt4Macros: Fix recently broken resource file parsing Commit 4be67837 (read less from version headers into variables, 2012-08-19) switched from file(READ) and string(REGEX MATCHALL) to just file(STRINGS) to extract the list of resource entries. However, the latter extracts entire lines that match the regex, not just the part that matches the regex, so the subsequent string(REGEX REPLACE) fails to match and replace anything. Return to the original parsing logic but replace file(READ) with file(STRINGS) to load a minimal part of the file before using string(REGEX MATCHALL) as before. --- Modules/Qt4Macros.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 95a2176c8..6cf16fdd5 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -187,15 +187,17 @@ macro (QT4_ADD_RESOURCES outfiles ) if(EXISTS "${infile}") # parse file for dependencies # all files are absolute paths or relative to the location of the qrc file - file(STRINGS "${infile}" _RC_FILES REGEX "]*>[^<]+") - foreach(_RC_FILE IN LISTS _RC_FILES) - string(REGEX REPLACE "^]*>([^<]*)" "\\1" _RC_FILE "${_RC_FILE}") + file(STRINGS "${infile}" _RC_FILE_CONTENTS REGEX "]*>[^<]+") + string(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") if(NOT IS_ABSOLUTE "${_RC_FILE}") set(_RC_FILE "${rc_path}/${_RC_FILE}") endif() set(_RC_DEPENDS ${_RC_DEPENDS} "${_RC_FILE}") endforeach() unset(_RC_FILES) + unset(_RC_FILE_CONTENTS) # Since this cmake macro is doing the dependency scanning for these files, # let's make a configured file and add it as a dependency so cmake is run # again when dependencies need to be recomputed. From f0ae381c73dd2b421cb7df407152ad4498428fc2 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 08:50:50 -0400 Subject: [PATCH 031/152] VS: Disable precompiled headers unless enabled by project (#12930) In VS 11 the WindowsAppContainer element enabled by the VS_WINRT_EXTENSIONS property activates precompiled header support automatically if no PrecompiledHeader setting is specified. For VS 10 and 11 set PrecompiledHeader to "NotUsing" explicitly by default unless overridden by a project-specified flag. Suggested-by: Eugene Golushkov --- Source/cmVisualStudio10TargetGenerator.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 6626e5bc1..244284116 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1219,6 +1219,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( // Get preprocessor definitions for this directory. std::string defineFlags = this->Target->GetMakefile()->GetDefineFlags(); clOptions.FixExceptionHandlingDefault(); + clOptions.AddFlag("PrecompiledHeader", "NotUsing"); clOptions.Parse(flags.c_str()); clOptions.Parse(defineFlags.c_str()); clOptions.AddDefines From 707aefd853d1fec2960058e2e921e5d24c736526 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 10:15:00 -0400 Subject: [PATCH 032/152] Detect Compaq compiler version with its id Decode decimal digits from __DECC_VER and __DECCXX_VER to compute version number components. See documentation at: http://www.openvms.compaq.com/commercial/c/docs/5492p024.html#decc_ver_sec http://www.tru64unix.compaq.com/cplus/ugu_impl.html#predef_vernum http://sourceforge.net/p/predef/wiki/Compilers/#compaq-cchttpwwwopenvmscompaqcomopenvmsbrochuresdeccplus --- Modules/CMakeCCompilerId.c.in | 4 ++++ Modules/CMakeCXXCompilerId.cpp.in | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 06aa9bf06..7771dbf25 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -67,6 +67,10 @@ #elif defined(__DECC) # define COMPILER_ID "Compaq" + /* __DECC_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECC_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECC_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECC_VER % 10000) #elif defined(__IBMC__) # if defined(__COMPILER_VER__) diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 95fc852d6..47cd45c32 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -69,6 +69,10 @@ #elif defined(__DECCXX) # define COMPILER_ID "Compaq" + /* __DECCXX_VER = VVRRTPPPP */ +# define COMPILER_VERSION_MAJOR DEC(__DECCXX_VER/10000000) +# define COMPILER_VERSION_MINOR DEC(__DECCXX_VER/100000 % 100) +# define COMPILER_VERSION_PATCH DEC(__DECCXX_VER % 10000) #elif defined(__IBMCPP__) # if defined(__COMPILER_VER__) From 74c57d99b4328c18b533d76e7f009e7daddc04df Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 10:15:40 -0400 Subject: [PATCH 033/152] Detect PathScale compiler version with its id Decode decimal digits from __PATHCC__ __PATHCC_MINOR__ __PATHCC_PATCHLEVEL__ to compute version number components. See documentation at: http://www.pathscale.com/docs/UserGuide.pdf http://sourceforge.net/p/predef/wiki/Compilers/#ekopathhttpenwikipediaorgwikipathscale --- Modules/CMakeCCompilerId.c.in | 7 ++++++- Modules/CMakeCXXCompilerId.cpp.in | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 7771dbf25..8b5b899a7 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -95,8 +95,13 @@ # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) # endif -#elif defined(__PATHSCALE__) +#elif defined(__PATHCC__) # define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif #elif defined(_CRAYC) # define COMPILER_ID "Cray" diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 47cd45c32..80e6d19d8 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -97,8 +97,13 @@ # define COMPILER_VERSION_PATCH DEC(__PGIC_PATCHLEVEL__) # endif -#elif defined(__PATHSCALE__) +#elif defined(__PATHCC__) # define COMPILER_ID "PathScale" +# define COMPILER_VERSION_MAJOR DEC(__PATHCC__) +# define COMPILER_VERSION_MINOR DEC(__PATHCC_MINOR__) +# if defined(__PATHCC_PATCHLEVEL__) +# define COMPILER_VERSION_PATCH DEC(__PATHCC_PATCHLEVEL__) +# endif #elif defined(_CRAYC) # define COMPILER_ID "Cray" From 952651c6428755f50a80d3b64a4e09d3bd1afc3b Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 10:15:58 -0400 Subject: [PATCH 034/152] Detect TI compiler version with its id Decode decimal digits from __TI_COMPILER_VERSION__ to compute version number components. See documentation at: http://processors.wiki.ti.com/index.php/Refer_to_Compiler_Version_in_Your_Source http://www.ti.com/general/docs/lit/getliterature.tsp?literatureNumber=spru187o http://sourceforge.net/p/predef/wiki/Compilers/#texas-instruments-cc-compiler --- Modules/CMakeCCompilerId.c.in | 4 ++++ Modules/CMakeCXXCompilerId.cpp.in | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 8b5b899a7..331be069e 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -108,6 +108,10 @@ #elif defined(__TI_COMPILER_VERSION__) # define COMPILER_ID "TI_DSP" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) #elif defined(__TINYC__) # define COMPILER_ID "TinyCC" diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index 80e6d19d8..acffbf489 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -110,6 +110,10 @@ #elif defined(__TI_COMPILER_VERSION__) # define COMPILER_ID "TI_DSP" + /* __TI_COMPILER_VERSION__ = VVVRRRPPP */ +# define COMPILER_VERSION_MAJOR DEC(__TI_COMPILER_VERSION__/1000000) +# define COMPILER_VERSION_MINOR DEC(__TI_COMPILER_VERSION__/1000 % 1000) +# define COMPILER_VERSION_PATCH DEC(__TI_COMPILER_VERSION__ % 1000) #elif defined(__SCO_VERSION__) # define COMPILER_ID "SCO" From 4ad7fa64889d4a05bce3540ae1a6dbd87f654d9d Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 10:16:12 -0400 Subject: [PATCH 035/152] Detect Comeau compiler version with its id Decode decimal digits from __COMO_VERSION__ to compute the version number components. See documentation at: http://www.comeaucomputing.com/4.0/docs/userman/predefs.html http://sourceforge.net/p/predef/wiki/Compilers/#comeau-chttpenwikipediaorgwikicomeau_cc2b2b --- Modules/CMakeCXXCompilerId.cpp.in | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index acffbf489..a11996d3e 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -10,6 +10,9 @@ #if defined(__COMO__) # define COMPILER_ID "Comeau" + /* __COMO_VERSION__ = VRR */ +# define COMPILER_VERSION_MAJOR DEC(__COMO_VERSION__ / 100) +# define COMPILER_VERSION_MINOR DEC(__COMO_VERSION__ % 100) #elif defined(__INTEL_COMPILER) || defined(__ICC) # define COMPILER_ID "Intel" From 622d9a789dc72b159f7d571e3a700db5d090c1ef Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 10:27:09 -0400 Subject: [PATCH 036/152] Detect SDCC compiler version with its id Decode decimal digits from SDCC to compute version number components. See documentation at: http://sdcc.sourceforge.net/doc/sdccman.pdf http://sourceforge.net/p/predef/wiki/Compilers/#small-device-c-compilerhttpenwikipediaorgwikismall_device_c_compiler --- Modules/CMakeCCompilerId.c.in | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index 331be069e..d6e192d60 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -160,6 +160,10 @@ http://sdcc.sourceforge.net */ #elif defined(SDCC) # define COMPILER_ID "SDCC" + /* SDCC = VRP */ +# define COMPILER_VERSION_MAJOR DEC(SDCC/100) +# define COMPILER_VERSION_MINOR DEC(SDCC/10 % 10) +# define COMPILER_VERSION_PATCH DEC(SDCC % 10) #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) # define COMPILER_ID "MIPSpro" From 4cb99b1dbc3932a74a7c34b0b31187e0e913d625 Mon Sep 17 00:00:00 2001 From: Zack Galbreath Date: Wed, 22 Aug 2012 10:17:00 -0400 Subject: [PATCH 037/152] cmparseMSBuildXML: Include DisplayName in the output --- Source/cmparseMSBuildXML.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py index a0c7ec44a..eba84aaea 100755 --- a/Source/cmparseMSBuildXML.py +++ b/Source/cmparseMSBuildXML.py @@ -148,7 +148,7 @@ class Property: self.argumentProperty = child.getAttribute("Property") self.argumentIsRequired = child.getAttribute("IsRequired") if child.nodeName == self.prefix_type+"Value": - va = Property(self.prefix_type,["Name","Switch"]) + va = Property(self.prefix_type,["Name","DisplayName","Switch"]) va.suffix_type = "Value" va.populate(child) self.values.append(va) @@ -203,11 +203,11 @@ class MSBuildToCMake: if child.nodeName == "EnumProperty": self.enumProperties.append(Property("Enum",["Name","Category"],child)) if child.nodeName == "StringProperty": - self.stringProperties.append(Property("String",["Name","Subtype","Separator","Category","Visible","IncludeInCommandLine","Switch","ReadOnly"],child)) + self.stringProperties.append(Property("String",["Name","Subtype","Separator","Category","Visible","IncludeInCommandLine","Switch","DisplayName","ReadOnly"],child)) if child.nodeName == "StringListProperty": - self.stringListProperties.append(Property("StringList",["Name","Category","Switch","Subtype"],child)) + self.stringListProperties.append(Property("StringList",["Name","Category","Switch","DisplayName","Subtype"],child)) if child.nodeName == "BoolProperty": - self.boolProperties.append(Property("Bool",["ReverseSwitch","Name","Category","Switch","SwitchPrefix","IncludeInCommandLine"],child)) + self.boolProperties.append(Property("Bool",["ReverseSwitch","Name","Category","Switch","DisplayName","SwitchPrefix","IncludeInCommandLine"],child)) if child.nodeName == "IntProperty": self.intProperties.append(Property("Int",["Name","Category","Visible"],child)) self.populate(child,spaces+"----") @@ -226,15 +226,15 @@ class MSBuildToCMake: for j in i.values: #hardcore Brad King's manual fixes for cmVS10CLFlagTable.h if i.attributes["Name"] == "PrecompiledHeader" and j.attributes["Switch"] != "": - toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" + toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" else: #default (normal, non-hardcoded) case - toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\", 0},\n" + toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\", 0},\n" toReturn += "\n" if lastProp != {}: for j in lastProp.values: - toReturn+=" {\""+lastProp.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\", 0},\n" + toReturn+=" {\""+lastProp.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.attributes["DisplayName"]+"\", \""+j.attributes["Name"]+"\", 0},\n" toReturn += "\n" toReturn += "\n //Bool Properties\n" @@ -250,17 +250,17 @@ class MSBuildToCMake: if i.argumentProperty != "": if i.attributes["ReverseSwitch"] != "": toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" + toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.attributes["DisplayName"]+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" if i.attributes["Switch"] != "": toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n" - toReturn += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" + toReturn += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.attributes["DisplayName"]+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n" toReturn += "\n //String List Properties\n" for i in self.stringListProperties: if i.attributes["Switch"] == "": toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n"; else: - toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\",\n \""+i.DisplayName+"\",\n \"\", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},\n" + toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\",\n \""+i.attributes["DisplayName"]+"\",\n \"\", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable},\n" toReturn += "\n //String Properties\n" for i in self.stringProperties: @@ -276,7 +276,7 @@ class MSBuildToCMake: else: toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n"; else: - toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+i.attributes["Separator"]+"\",\n \""+i.DisplayName+"\",\n \"\", cmVS7FlagTable::UserValue},\n" + toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+i.attributes["Separator"]+"\",\n \""+i.attributes["DisplayName"]+"\",\n \"\", cmVS7FlagTable::UserValue},\n" toReturn += " {0,0,0,0,0}\n};" return toReturn From 9b2dda5db57415e6f8b910e0fa3d770ec478e9f3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 10:49:47 -0400 Subject: [PATCH 038/152] VS11: Generate flag tables from MSBuild V110 tool files Run cmparseMSBuildXML.py on cl.xml, lib.xml, and link.xml to generate our flag tables: python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/V110/1033/cl.xml" > cmVS11CLFlagTable.h python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/V110/1033/lib.xml" > cmVS11LibFlagTable.h python cmparseMSBuildXML.py -x ".../MSBuild/Microsoft.Cpp/v4.0/V110/1033/link.xml" > cmVS11LinkFlagTable.h Fix up the declaration names at the top of each file. Finally, teach cmVisualStudio10TargetGenerator to select the version of the table matching the version of VS. --- Source/cmVS11CLFlagTable.h | 291 +++++++++++++++++ Source/cmVS11LibFlagTable.h | 102 ++++++ Source/cmVS11LinkFlagTable.h | 343 +++++++++++++++++++++ Source/cmVisualStudio10TargetGenerator.cxx | 35 ++- Source/cmparseMSBuildXML.py | 3 + 5 files changed, 770 insertions(+), 4 deletions(-) create mode 100644 Source/cmVS11CLFlagTable.h create mode 100644 Source/cmVS11LibFlagTable.h create mode 100644 Source/cmVS11LinkFlagTable.h diff --git a/Source/cmVS11CLFlagTable.h b/Source/cmVS11CLFlagTable.h new file mode 100644 index 000000000..5ab8ebbb3 --- /dev/null +++ b/Source/cmVS11CLFlagTable.h @@ -0,0 +1,291 @@ +static cmVS7FlagTable cmVS11CLFlagTable[] = +{ + + //Enum Properties + {"DebugInformationFormat", "", + "None", "None", 0}, + {"DebugInformationFormat", "Z7", + "C7 compatible", "OldStyle", 0}, + {"DebugInformationFormat", "Zi", + "Program Database", "ProgramDatabase", 0}, + {"DebugInformationFormat", "ZI", + "Program Database for Edit And Continue", "EditAndContinue", 0}, + + {"WarningLevel", "W0", + "Turn Off All Warnings", "TurnOffAllWarnings", 0}, + {"WarningLevel", "W1", + "Level1", "Level1", 0}, + {"WarningLevel", "W2", + "Level2", "Level2", 0}, + {"WarningLevel", "W3", + "Level3", "Level3", 0}, + {"WarningLevel", "W4", + "Level4", "Level4", 0}, + {"WarningLevel", "Wall", + "EnableAllWarnings", "EnableAllWarnings", 0}, + + {"Optimization", "Od", + "Disabled", "Disabled", 0}, + {"Optimization", "O1", + "Minimize Size", "MinSpace", 0}, + {"Optimization", "O2", + "Maximize Speed", "MaxSpeed", 0}, + {"Optimization", "Ox", + "Full Optimization", "Full", 0}, + + {"InlineFunctionExpansion", "", + "Default", "Default", 0}, + {"InlineFunctionExpansion", "Ob0", + "Disabled", "Disabled", 0}, + {"InlineFunctionExpansion", "Ob1", + "Only __inline", "OnlyExplicitInline", 0}, + {"InlineFunctionExpansion", "Ob2", + "Any Suitable", "AnySuitable", 0}, + + {"FavorSizeOrSpeed", "Os", + "Favor small code", "Size", 0}, + {"FavorSizeOrSpeed", "Ot", + "Favor fast code", "Speed", 0}, + {"FavorSizeOrSpeed", "", + "Neither", "Neither", 0}, + + {"ExceptionHandling", "EHa", + "Yes with SEH Exceptions", "Async", 0}, + {"ExceptionHandling", "EHsc", + "Yes", "Sync", 0}, + {"ExceptionHandling", "EHs", + "Yes with Extern C functions", "SyncCThrow", 0}, + {"ExceptionHandling", "", + "No", "false", 0}, + + {"BasicRuntimeChecks", "RTCs", + "Stack Frames", "StackFrameRuntimeCheck", 0}, + {"BasicRuntimeChecks", "RTCu", + "Uninitialized variables", "UninitializedLocalUsageCheck", 0}, + {"BasicRuntimeChecks", "RTC1", + "Both (/RTC1, equiv. to /RTCsu)", "EnableFastChecks", 0}, + {"BasicRuntimeChecks", "", + "Default", "Default", 0}, + + {"RuntimeLibrary", "MT", + "Multi-threaded", "MultiThreaded", 0}, + {"RuntimeLibrary", "MTd", + "Multi-threaded Debug", "MultiThreadedDebug", 0}, + {"RuntimeLibrary", "MD", + "Multi-threaded DLL", "MultiThreadedDLL", 0}, + {"RuntimeLibrary", "MDd", + "Multi-threaded Debug DLL", "MultiThreadedDebugDLL", 0}, + + {"StructMemberAlignment", "Zp1", + "1 Byte", "1Byte", 0}, + {"StructMemberAlignment", "Zp2", + "2 Bytes", "2Bytes", 0}, + {"StructMemberAlignment", "Zp4", + "4 Byte", "4Bytes", 0}, + {"StructMemberAlignment", "Zp8", + "8 Bytes", "8Bytes", 0}, + {"StructMemberAlignment", "Zp16", + "16 Bytes", "16Bytes", 0}, + {"StructMemberAlignment", "", + "Default", "Default", 0}, + + {"EnableEnhancedInstructionSet", "arch:SSE", + "Streaming SIMD Extensions", "StreamingSIMDExtensions", 0}, + {"EnableEnhancedInstructionSet", "arch:SSE2", + "Streaming SIMD Extensions 2", "StreamingSIMDExtensions2", 0}, + {"EnableEnhancedInstructionSet", "arch:AVX", + "Advanced Vector Extensions", "AdvancedVectorExtensions", 0}, + {"EnableEnhancedInstructionSet", "arch:IA32", + "No Enhanced Instructions", "NoExtensions", 0}, + {"EnableEnhancedInstructionSet", "", + "Not Set", "NotSet", 0}, + + {"FloatingPointModel", "fp:precise", + "Precise", "Precise", 0}, + {"FloatingPointModel", "fp:strict", + "Strict", "Strict", 0}, + {"FloatingPointModel", "fp:fast", + "Fast", "Fast", 0}, + + {"PrecompiledHeader", "Yc", + "Create", "Create", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeader", "Yu", + "Use", "Use", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"PrecompiledHeader", "", + "Not Using Precompiled Headers", "NotUsing", 0}, + + {"AssemblerOutput", "", + "No Listing", "NoListing", 0}, + {"AssemblerOutput", "FA", + "Assembly-Only Listing", "AssemblyCode", 0}, + {"AssemblerOutput", "FAc", + "Assembly With Machine Code", "AssemblyAndMachineCode", 0}, + {"AssemblerOutput", "FAs", + "Assembly With Source Code", "AssemblyAndSourceCode", 0}, + {"AssemblerOutput", "FAcs", + "Assembly, Machine Code and Source", "All", 0}, + + {"CallingConvention", "Gd", + "__cdecl", "Cdecl", 0}, + {"CallingConvention", "Gr", + "__fastcall", "FastCall", 0}, + {"CallingConvention", "Gz", + "__stdcall", "StdCall", 0}, + + {"CompileAs", "", + "Default", "Default", 0}, + {"CompileAs", "TC", + "Compile as C Code", "CompileAsC", 0}, + {"CompileAs", "TP", + "Compile as C++ Code", "CompileAsCpp", 0}, + + {"ErrorReporting", "errorReport:none", + "Do Not Send Report", "None", 0}, + {"ErrorReporting", "errorReport:prompt", + "Prompt Immediately", "Prompt", 0}, + {"ErrorReporting", "errorReport:queue", + "Queue For Next Login", "Queue", 0}, + {"ErrorReporting", "errorReport:send", + "Send Automatically", "Send", 0}, + + {"CompileAsManaged", "", + "No Common Language RunTime Support", "false", 0}, + {"CompileAsManaged", "clr", + "Common Language RunTime Support", "true", 0}, + {"CompileAsManaged", "clr:pure", + "Pure MSIL Common Language RunTime Support", "Pure", 0}, + {"CompileAsManaged", "clr:safe", + "Safe MSIL Common Language RunTime Support", "Safe", 0}, + {"CompileAsManaged", "clr:oldSyntax", + "Common Language RunTime Support, Old Syntax", "OldSyntax", 0}, + + + //Bool Properties + {"CompileAsWinRT", "ZW", "", "true", 0}, + {"WinRTNoStdLib", "ZW:nostdlib", "", "true", 0}, + {"SuppressStartupBanner", "nologo-", "", "false", 0}, + {"SuppressStartupBanner", "nologo", "", "true", 0}, + {"TreatWarningAsError", "WX-", "", "false", 0}, + {"TreatWarningAsError", "WX", "", "true", 0}, + {"SDLCheck", "sdl-", "", "false", 0}, + {"SDLCheck", "sdl", "", "true", 0}, + {"IntrinsicFunctions", "Oi", "", "true", 0}, + {"OmitFramePointers", "Oy-", "", "false", 0}, + {"OmitFramePointers", "Oy", "", "true", 0}, + {"EnableFiberSafeOptimizations", "GT", "", "true", 0}, + {"WholeProgramOptimization", "GL", "", "true", 0}, + {"UndefineAllPreprocessorDefinitions", "u", "", "true", 0}, + {"IgnoreStandardIncludePath", "X", "", "true", 0}, + {"PreprocessToFile", "P", "", "true", 0}, + {"PreprocessSuppressLineNumbers", "EP", "", "true", 0}, + {"PreprocessKeepComments", "C", "", "true", 0}, + {"StringPooling", "GF-", "", "false", 0}, + {"StringPooling", "GF", "", "true", 0}, + {"MinimalRebuild", "Gm-", "", "false", 0}, + {"MinimalRebuild", "Gm", "", "true", 0}, + {"SmallerTypeCheck", "RTCc", "", "true", 0}, + {"BufferSecurityCheck", "GS-", "", "false", 0}, + {"BufferSecurityCheck", "GS", "", "true", 0}, + {"FunctionLevelLinking", "Gy-", "", "false", 0}, + {"FunctionLevelLinking", "Gy", "", "true", 0}, + {"EnableParallelCodeGeneration", "Qpar-", "", "false", 0}, + {"EnableParallelCodeGeneration", "Qpar", "", "true", 0}, + {"FloatingPointExceptions", "fp:except-", "", "false", 0}, + {"FloatingPointExceptions", "fp:except", "", "true", 0}, + {"CreateHotpatchableImage", "hotpatch", "", "true", 0}, + {"DisableLanguageExtensions", "Za", "", "true", 0}, + {"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0}, + {"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0}, + {"ForceConformanceInForLoopScope", "Zc:forScope-", "", "false", 0}, + {"ForceConformanceInForLoopScope", "Zc:forScope", "", "true", 0}, + {"RuntimeTypeInfo", "GR-", "", "false", 0}, + {"RuntimeTypeInfo", "GR", "", "true", 0}, + {"OpenMPSupport", "openmp-", "", "false", 0}, + {"OpenMPSupport", "openmp", "", "true", 0}, + {"ExpandAttributedSource", "Fx", "", "true", 0}, + {"UseUnicodeForAssemblerListing", "FAu", "", "true", 0}, + {"ShowIncludes", "showIncludes", "", "true", 0}, + {"EnablePREfast", "analyze-", "", "false", 0}, + {"EnablePREfast", "analyze", "", "true", 0}, + {"UseFullPaths", "FC", "", "true", 0}, + {"OmitDefaultLibName", "Zl", "", "true", 0}, + + //Bool Properties With Argument + {"MultiProcessorCompilation", "MP", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"ProcessorNumber", "MP", "Multi-processor Compilation", "", + cmVS7FlagTable::UserValueRequired}, + {"GenerateXMLDocumentationFiles", "doc", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "", + cmVS7FlagTable::UserValueRequired}, + {"BrowseInformation", "FR", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"BrowseInformationFile", "FR", "Enable Browse Information", "", + cmVS7FlagTable::UserValueRequired}, + + //String List Properties + {"AdditionalIncludeDirectories", "I", + "Additional Include Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AdditionalUsingDirectories", "AI", + "Additional #using Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PreprocessorDefinitions", "D ", + "Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"UndefinePreprocessorDefinitions", "U", + "Undefine Preprocessor Definitions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"DisableSpecificWarnings", "wd", + "Disable Specific Warnings", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForcedIncludeFiles", "FI", + "Forced Include File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForcedUsingFiles", "FU", + "Forced #using File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PREfastAdditionalOptions", "analyze:", + "Additional Code Analysis Native options", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"PREfastAdditionalPlugins", "analyze:plugin", + "Additional Code Analysis Native plugins", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"TreatSpecificWarningsAsErrors", "we", + "Treat Specific Warnings As Errors", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + // Skip [TrackerLogDirectory] - no command line Switch. + {"PreprocessOutputPath", "Fi", + "Preprocess Output Path", + "", cmVS7FlagTable::UserValue}, + {"PrecompiledHeaderFile", "Yc", + "Precompiled Header Name", + "", cmVS7FlagTable::UserValueRequired}, + {"PrecompiledHeaderFile", "Yu", + "Precompiled Header Name", + "", cmVS7FlagTable::UserValueRequired}, + {"PrecompiledHeaderOutputFile", "Fp", + "Precompiled Header Output File", + "", cmVS7FlagTable::UserValue}, + {"AssemblerListingLocation", "Fa", + "ASM List Location", + "", cmVS7FlagTable::UserValue}, + {"ObjectFileName", "Fo", + "Object File Name", + "", cmVS7FlagTable::UserValue}, + {"ProgramDataBaseFileName", "Fd", + "Program Database File Name", + "", cmVS7FlagTable::UserValue}, + // Skip [XMLDocumentationFileName] - no command line Switch. + // Skip [BrowseInformationFile] - no command line Switch. + {"PREfastLog", "analyze:log ", + "Code Analysis Log", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS11LibFlagTable.h b/Source/cmVS11LibFlagTable.h new file mode 100644 index 000000000..942944241 --- /dev/null +++ b/Source/cmVS11LibFlagTable.h @@ -0,0 +1,102 @@ +static cmVS7FlagTable cmVS11LibFlagTable[] = +{ + + //Enum Properties + {"ErrorReporting", "ERRORREPORT:PROMPT", + "PromptImmediately", "PromptImmediately", 0}, + {"ErrorReporting", "ERRORREPORT:QUEUE", + "Queue For Next Login", "QueueForNextLogin", 0}, + {"ErrorReporting", "ERRORREPORT:SEND", + "Send Error Report", "SendErrorReport", 0}, + {"ErrorReporting", "ERRORREPORT:NONE", + "No Error Report", "NoErrorReport", 0}, + + {"TargetMachine", "MACHINE:ARM", + "MachineARM", "MachineARM", 0}, + {"TargetMachine", "MACHINE:EBC", + "MachineEBC", "MachineEBC", 0}, + {"TargetMachine", "MACHINE:IA64", + "MachineIA64", "MachineIA64", 0}, + {"TargetMachine", "MACHINE:MIPS", + "MachineMIPS", "MachineMIPS", 0}, + {"TargetMachine", "MACHINE:MIPS16", + "MachineMIPS16", "MachineMIPS16", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", + "MachineMIPSFPU", "MachineMIPSFPU", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", + "MachineMIPSFPU16", "MachineMIPSFPU16", 0}, + {"TargetMachine", "MACHINE:SH4", + "MachineSH4", "MachineSH4", 0}, + {"TargetMachine", "MACHINE:THUMB", + "MachineTHUMB", "MachineTHUMB", 0}, + {"TargetMachine", "MACHINE:X64", + "MachineX64", "MachineX64", 0}, + {"TargetMachine", "MACHINE:X86", + "MachineX86", "MachineX86", 0}, + + {"SubSystem", "SUBSYSTEM:CONSOLE", + "Console", "Console", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", + "Windows", "Windows", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", + "Native", "Native", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", + "EFI Application", "EFI Application", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", + "EFI Boot Service Driver", "EFI Boot Service Driver", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", + "EFI ROM", "EFI ROM", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", + "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWSCE", + "WindowsCE", "WindowsCE", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", + "POSIX", "POSIX", 0}, + + + //Bool Properties + {"SuppressStartupBanner", "NOLOGO", "", "true", 0}, + {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0}, + {"TreatLibWarningAsErrors", "WX:NO", "", "false", 0}, + {"TreatLibWarningAsErrors", "WX", "", "true", 0}, + {"Verbose", "VERBOSE", "", "true", 0}, + {"LinkTimeCodeGeneration", "LTCG", "", "true", 0}, + + //Bool Properties With Argument + + //String List Properties + // Skip [AdditionalDependencies] - no command line Switch. + {"AdditionalLibraryDirectories", "LIBPATH:", + "Additional Library Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", + "Ignore Specific Default Libraries", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ExportNamedFunctions", "EXPORT:", + "Export Named Functions", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"RemoveObjects", "REMOVE:", + "Remove Objects", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + {"OutputFile", "OUT:", + "Output File", + "", cmVS7FlagTable::UserValue}, + {"ModuleDefinitionFile", "DEF:", + "Module Definition File Name", + "", cmVS7FlagTable::UserValue}, + {"ForceSymbolReferences", "INCLUDE:", + "Force Symbol References", + "", cmVS7FlagTable::UserValue}, + {"DisplayLibrary", "LIST:", + "Display Library to standard output", + "", cmVS7FlagTable::UserValue}, + // Skip [MinimumRequiredVersion] - no command line Switch. + {"Name", "NAME:", + "Name", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + // Skip [TrackerLogDirectory] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVS11LinkFlagTable.h b/Source/cmVS11LinkFlagTable.h new file mode 100644 index 000000000..ea0d0f0b0 --- /dev/null +++ b/Source/cmVS11LinkFlagTable.h @@ -0,0 +1,343 @@ +static cmVS7FlagTable cmVS11LinkFlagTable[] = +{ + + //Enum Properties + {"ShowProgress", "", + "Not Set", "NotSet", 0}, + {"ShowProgress", "VERBOSE", + "Display all progress messages", "LinkVerbose", 0}, + {"ShowProgress", "VERBOSE:Lib", + "For Libraries Searched", "LinkVerboseLib", 0}, + {"ShowProgress", "VERBOSE:ICF", + "About COMDAT folding during optimized linking", "LinkVerboseICF", 0}, + {"ShowProgress", "VERBOSE:REF", + "About data removed during optimized linking", "LinkVerboseREF", 0}, + {"ShowProgress", "VERBOSE:SAFESEH", + "About Modules incompatible with SEH", "LinkVerboseSAFESEH", 0}, + {"ShowProgress", "VERBOSE:CLR", + "About linker activity related to managed code", "LinkVerboseCLR", 0}, + + {"ForceFileOutput", "FORCE", + "Enabled", "Enabled", 0}, + {"ForceFileOutput", "FORCE:MULTIPLE", + "Multiply Defined Symbol Only", "MultiplyDefinedSymbolOnly", 0}, + {"ForceFileOutput", "FORCE:UNRESOLVED", + "Undefined Symbol Only", "UndefinedSymbolOnly", 0}, + + {"CreateHotPatchableImage", "FUNCTIONPADMIN", + "Enabled", "Enabled", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:5", + "X86 Image Only", "X86Image", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:6", + "X64 Image Only", "X64Image", 0}, + {"CreateHotPatchableImage", "FUNCTIONPADMIN:16", + "Itanium Image Only", "ItaniumImage", 0}, + + {"UACExecutionLevel", "level='asInvoker'", + "asInvoker", "AsInvoker", 0}, + {"UACExecutionLevel", "level='highestAvailable'", + "highestAvailable", "HighestAvailable", 0}, + {"UACExecutionLevel", "level='requireAdministrator'", + "requireAdministrator", "RequireAdministrator", 0}, + + {"SubSystem", "", + "Not Set", "NotSet", 0}, + {"SubSystem", "SUBSYSTEM:CONSOLE", + "Console", "Console", 0}, + {"SubSystem", "SUBSYSTEM:WINDOWS", + "Windows", "Windows", 0}, + {"SubSystem", "SUBSYSTEM:NATIVE", + "Native", "Native", 0}, + {"SubSystem", "SUBSYSTEM:EFI_APPLICATION", + "EFI Application", "EFI Application", 0}, + {"SubSystem", "SUBSYSTEM:EFI_BOOT_SERVICE_DRIVER", + "EFI Boot Service Driver", "EFI Boot Service Driver", 0}, + {"SubSystem", "SUBSYSTEM:EFI_ROM", + "EFI ROM", "EFI ROM", 0}, + {"SubSystem", "SUBSYSTEM:EFI_RUNTIME_DRIVER", + "EFI Runtime", "EFI Runtime", 0}, + {"SubSystem", "SUBSYSTEM:POSIX", + "POSIX", "POSIX", 0}, + + {"Driver", "", + "Not Set", "NotSet", 0}, + {"Driver", "Driver", + "Driver", "Driver", 0}, + {"Driver", "DRIVER:UPONLY", + "UP Only", "UpOnly", 0}, + {"Driver", "DRIVER:WDM", + "WDM", "WDM", 0}, + + {"LinkTimeCodeGeneration", "", + "Default", "Default", 0}, + {"LinkTimeCodeGeneration", "LTCG", + "Use Link Time Code Generation", "UseLinkTimeCodeGeneration", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGInstrument", + "Profile Guided Optimization - Instrument", "PGInstrument", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGOptimize", + "Profile Guided Optimization - Optimization", "PGOptimization", 0}, + {"LinkTimeCodeGeneration", "LTCG:PGUpdate", + "Profile Guided Optimization - Update", "PGUpdate", 0}, + + {"GenerateWindowsMetadata", "WINMD", + "Yes", "true", 0}, + {"GenerateWindowsMetadata", "WINMD:NO", + "No", "false", 0}, + + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA1", + "SHA1", "SHA1", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA256", + "SHA256", "SHA256", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA384", + "SHA384", "SHA384", 0}, + {"WindowsMetadataSignHash", "WINMDSIGNHASH:SHA512", + "SHA512", "SHA512", 0}, + + {"TargetMachine", "", + "Not Set", "NotSet", 0}, + {"TargetMachine", "MACHINE:ARM", + "MachineARM", "MachineARM", 0}, + {"TargetMachine", "MACHINE:EBC", + "MachineEBC", "MachineEBC", 0}, + {"TargetMachine", "MACHINE:IA64", + "MachineIA64", "MachineIA64", 0}, + {"TargetMachine", "MACHINE:MIPS", + "MachineMIPS", "MachineMIPS", 0}, + {"TargetMachine", "MACHINE:MIPS16", + "MachineMIPS16", "MachineMIPS16", 0}, + {"TargetMachine", "MACHINE:MIPSFPU", + "MachineMIPSFPU", "MachineMIPSFPU", 0}, + {"TargetMachine", "MACHINE:MIPSFPU16", + "MachineMIPSFPU16", "MachineMIPSFPU16", 0}, + {"TargetMachine", "MACHINE:SH4", + "MachineSH4", "MachineSH4", 0}, + {"TargetMachine", "MACHINE:THUMB", + "MachineTHUMB", "MachineTHUMB", 0}, + {"TargetMachine", "MACHINE:X64", + "MachineX64", "MachineX64", 0}, + {"TargetMachine", "MACHINE:X86", + "MachineX86", "MachineX86", 0}, + + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:MTA", + "MTA threading attribute", "MTAThreadingAttribute", 0}, + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:STA", + "STA threading attribute", "STAThreadingAttribute", 0}, + {"CLRThreadAttribute", "CLRTHREADATTRIBUTE:NONE", + "Default threading attribute", "DefaultThreadingAttribute", 0}, + + {"CLRImageType", "CLRIMAGETYPE:IJW", + "Force IJW image", "ForceIJWImage", 0}, + {"CLRImageType", "CLRIMAGETYPE:PURE", + "Force Pure IL Image", "ForcePureILImage", 0}, + {"CLRImageType", "CLRIMAGETYPE:SAFE", + "Force Safe IL Image", "ForceSafeILImage", 0}, + {"CLRImageType", "", + "Default image type", "Default", 0}, + + {"SignHash", "CLRSIGNHASH:SHA1", + "SHA1", "SHA1", 0}, + {"SignHash", "CLRSIGNHASH:SHA256", + "SHA256", "SHA256", 0}, + {"SignHash", "CLRSIGNHASH:SHA384", + "SHA384", "SHA384", 0}, + {"SignHash", "CLRSIGNHASH:SHA512", + "SHA512", "SHA512", 0}, + + {"LinkErrorReporting", "ERRORREPORT:PROMPT", + "PromptImmediately", "PromptImmediately", 0}, + {"LinkErrorReporting", "ERRORREPORT:QUEUE", + "Queue For Next Login", "QueueForNextLogin", 0}, + {"LinkErrorReporting", "ERRORREPORT:SEND", + "Send Error Report", "SendErrorReport", 0}, + {"LinkErrorReporting", "ERRORREPORT:NONE", + "No Error Report", "NoErrorReport", 0}, + + {"CLRSupportLastError", "CLRSupportLastError", + "Enabled", "Enabled", 0}, + {"CLRSupportLastError", "CLRSupportLastError:NO", + "Disabled", "Disabled", 0}, + {"CLRSupportLastError", "CLRSupportLastError:SYSTEMDLL", + "System Dlls Only", "SystemDlls", 0}, + + + //Bool Properties + {"LinkIncremental", "INCREMENTAL:NO", "", "false", 0}, + {"LinkIncremental", "INCREMENTAL", "", "true", 0}, + {"SuppressStartupBanner", "NOLOGO", "", "true", 0}, + {"LinkStatus", "LTCG:NOSTATUS", "", "false", 0}, + {"LinkStatus", "LTCG:STATUS", "", "true", 0}, + {"PreventDllBinding", "ALLOWBIND:NO", "", "false", 0}, + {"PreventDllBinding", "ALLOWBIND", "", "true", 0}, + {"TreatLinkerWarningAsErrors", "WX:NO", "", "false", 0}, + {"TreatLinkerWarningAsErrors", "WX", "", "true", 0}, + {"IgnoreAllDefaultLibraries", "NODEFAULTLIB", "", "true", 0}, + {"GenerateManifest", "MANIFEST:NO", "", "false", 0}, + {"GenerateManifest", "MANIFEST", "", "true", 0}, + {"AllowIsolation", "ALLOWISOLATION:NO", "", "false", 0}, + {"UACUIAccess", "uiAccess='false'", "", "false", 0}, + {"UACUIAccess", "uiAccess='true'", "", "true", 0}, + {"ManifestEmbed", "manifest:embed", "", "true", 0}, + {"GenerateDebugInformation", "DEBUG", "", "true", 0}, + {"MapExports", "MAPINFO:EXPORTS", "", "true", 0}, + {"AssemblyDebug", "ASSEMBLYDEBUG:DISABLE", "", "false", 0}, + {"AssemblyDebug", "ASSEMBLYDEBUG", "", "true", 0}, + {"LargeAddressAware", "LARGEADDRESSAWARE:NO", "", "false", 0}, + {"LargeAddressAware", "LARGEADDRESSAWARE", "", "true", 0}, + {"TerminalServerAware", "TSAWARE:NO", "", "false", 0}, + {"TerminalServerAware", "TSAWARE", "", "true", 0}, + {"SwapRunFromCD", "SWAPRUN:CD", "", "true", 0}, + {"SwapRunFromNET", "SWAPRUN:NET", "", "true", 0}, + {"OptimizeReferences", "OPT:NOREF", "", "false", 0}, + {"OptimizeReferences", "OPT:REF", "", "true", 0}, + {"EnableCOMDATFolding", "OPT:NOICF", "", "false", 0}, + {"EnableCOMDATFolding", "OPT:ICF", "", "true", 0}, + {"IgnoreEmbeddedIDL", "IGNOREIDL", "", "true", 0}, + {"AppContainer", "APPCONTAINER", "", "true", 0}, + {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN:NO", "", "false", 0}, + {"WindowsMetadataLinkDelaySign", "WINMDDELAYSIGN", "", "true", 0}, + {"NoEntryPoint", "NOENTRY", "", "true", 0}, + {"SetChecksum", "RELEASE", "", "true", 0}, + {"RandomizedBaseAddress", "DYNAMICBASE:NO", "", "false", 0}, + {"RandomizedBaseAddress", "DYNAMICBASE", "", "true", 0}, + {"FixedBaseAddress", "FIXED:NO", "", "false", 0}, + {"FixedBaseAddress", "FIXED", "", "true", 0}, + {"DataExecutionPrevention", "NXCOMPAT:NO", "", "false", 0}, + {"DataExecutionPrevention", "NXCOMPAT", "", "true", 0}, + {"TurnOffAssemblyGeneration", "NOASSEMBLY", "", "true", 0}, + {"SupportUnloadOfDelayLoadedDLL", "DELAY:UNLOAD", "", "true", 0}, + {"SupportNobindOfDelayLoadedDLL", "DELAY:NOBIND", "", "true", 0}, + {"Profile", "PROFILE", "", "true", 0}, + {"LinkDelaySign", "DELAYSIGN:NO", "", "false", 0}, + {"LinkDelaySign", "DELAYSIGN", "", "true", 0}, + {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK:NO", "", "false", 0}, + {"CLRUnmanagedCodeCheck", "CLRUNMANAGEDCODECHECK", "", "true", 0}, + {"DetectOneDefinitionRule", "ODR", "", "true", 0}, + {"ImageHasSafeExceptionHandlers", "SAFESEH:NO", "", "false", 0}, + {"ImageHasSafeExceptionHandlers", "SAFESEH", "", "true", 0}, + {"LinkDLL", "DLL", "", "true", 0}, + + //Bool Properties With Argument + {"EnableUAC", "MANIFESTUAC:NO", "", "false", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"EnableUAC", "MANIFESTUAC:NO", "Enable User Account Control (UAC)", "", + cmVS7FlagTable::UserValueRequired}, + {"EnableUAC", "MANIFESTUAC:", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "", + cmVS7FlagTable::UserValueRequired}, + {"GenerateMapFile", "MAP", "", "true", + cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue}, + {"MapFileName", "MAP", "Generate Map File", "", + cmVS7FlagTable::UserValueRequired}, + + //String List Properties + {"AdditionalLibraryDirectories", "LIBPATH:", + "Additional Library Directories", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + // Skip [AdditionalDependencies] - no command line Switch. + {"IgnoreSpecificDefaultLibraries", "NODEFAULTLIB:", + "Ignore Specific Default Libraries", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AddModuleNamesToAssembly", "ASSEMBLYMODULE:", + "Add Module to Assembly", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"EmbedManagedResourceFile", "ASSEMBLYRESOURCE:", + "Embed Managed Resource File", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ForceSymbolReferences", "INCLUDE:", + "Force Symbol References", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"DelayLoadDLLs", "DELAYLOAD:", + "Delay Loaded Dlls", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AssemblyLinkResource", "ASSEMBLYLINKRESOURCE:", + "Assembly Link Resource", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"AdditionalManifestDependencies", "MANIFESTDEPENDENCY:", + "Additional Manifest Dependencies", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + {"ManifestInput", "manifestinput:", + "Manifest Input", + "", cmVS7FlagTable::UserValue | cmVS7FlagTable::SemicolonAppendable}, + + //String Properties + {"OutputFile", "OUT:", + "Output File", + "", cmVS7FlagTable::UserValue}, + {"Version", "VERSION:", + "Version", + "", cmVS7FlagTable::UserValue}, + {"SpecifySectionAttributes", "SECTION:", + "Specify Section Attributes", + "", cmVS7FlagTable::UserValue}, + {"MSDOSStubFileName", "STUB:", + "MS-DOS Stub File Name", + "", cmVS7FlagTable::UserValue}, + // Skip [TrackerLogDirectory] - no command line Switch. + {"ModuleDefinitionFile", "DEF:", + "Module Definition File", + "", cmVS7FlagTable::UserValue}, + {"ManifestFile", "ManifestFile:", + "Manifest File", + "", cmVS7FlagTable::UserValue}, + {"ProgramDatabaseFile", "PDB:", + "Generate Program Database File", + "", cmVS7FlagTable::UserValue}, + {"StripPrivateSymbols", "PDBSTRIPPED:", + "Strip Private Symbols", + "", cmVS7FlagTable::UserValue}, + // Skip [MapFileName] - no command line Switch. + // Skip [MinimumRequiredVersion] - no command line Switch. + {"HeapReserveSize", "HEAP:", + "Heap Reserve Size", + "", cmVS7FlagTable::UserValue}, + // Skip [HeapCommitSize] - no command line Switch. + {"StackReserveSize", "STACK:", + "Stack Reserve Size", + "", cmVS7FlagTable::UserValue}, + // Skip [StackCommitSize] - no command line Switch. + {"FunctionOrder", "ORDER:@", + "Function Order", + "", cmVS7FlagTable::UserValue}, + {"ProfileGuidedDatabase", "PGD:", + "Profile Guided Database", + "", cmVS7FlagTable::UserValue}, + {"MidlCommandFile", "MIDL:@", + "MIDL Commands", + "", cmVS7FlagTable::UserValue}, + {"MergedIDLBaseFileName", "IDLOUT:", + "Merged IDL Base File Name", + "", cmVS7FlagTable::UserValue}, + {"TypeLibraryFile", "TLBOUT:", + "Type Library", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataFile", "WINMDFILE:", + "Windows Metadata File", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataLinkKeyFile", "WINMDKEYFILE:", + "Windows Metadata Key File", + "", cmVS7FlagTable::UserValue}, + {"WindowsMetadataKeyContainer", "WINMDKEYCONTAINER:", + "Windows Metadata Key Container", + "", cmVS7FlagTable::UserValue}, + {"EntryPointSymbol", "ENTRY:", + "Entry Point", + "", cmVS7FlagTable::UserValue}, + {"BaseAddress", "BASE:", + "Base Address", + "", cmVS7FlagTable::UserValue}, + {"ImportLibrary", "IMPLIB:", + "Import Library", + "", cmVS7FlagTable::UserValue}, + {"MergeSections", "MERGE:", + "Merge Sections", + "", cmVS7FlagTable::UserValue}, + {"LinkKeyFile", "KEYFILE:", + "Key File", + "", cmVS7FlagTable::UserValue}, + {"KeyContainer", "KEYCONTAINER:", + "Key Container", + "", cmVS7FlagTable::UserValue}, + // Skip [AdditionalOptions] - no command line Switch. + {0,0,0,0,0} +}; diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 53b6a9bb7..c7d2706c2 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -22,9 +22,36 @@ #include "cmVS10CLFlagTable.h" #include "cmVS10LinkFlagTable.h" #include "cmVS10LibFlagTable.h" +#include "cmVS11CLFlagTable.h" +#include "cmVS11LinkFlagTable.h" +#include "cmVS11LibFlagTable.h" #include +static cmVS7FlagTable const* +cmVSGetCLFlagTable(cmLocalVisualStudioGenerator* lg) +{ + if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11) + { return cmVS11CLFlagTable; } + return cmVS10CLFlagTable; +} + +static cmVS7FlagTable const* +cmVSGetLibFlagTable(cmLocalVisualStudioGenerator* lg) +{ + if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11) + { return cmVS11LibFlagTable; } + return cmVS10LibFlagTable; +} + +static cmVS7FlagTable const* +cmVSGetLinkFlagTable(cmLocalVisualStudioGenerator* lg) +{ + if(lg->GetVersion() >= cmLocalVisualStudioGenerator::VS11) + { return cmVS11LinkFlagTable; } + return cmVS10LinkFlagTable; +} + static std::string cmVS10EscapeXML(std::string arg) { cmSystemTools::ReplaceString(arg, "&", "&"); @@ -957,7 +984,7 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags( cmVisualStudioGeneratorOptions clOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Compiler, - cmVS10CLFlagTable, 0, this); + cmVSGetCLFlagTable(this->LocalGenerator), 0, this); clOptions.Parse(flags.c_str()); clOptions.AddDefines(configDefines.c_str()); clOptions.SetConfiguration((*config).c_str()); @@ -1151,7 +1178,7 @@ bool cmVisualStudio10TargetGenerator::ComputeClOptions( cmsys::auto_ptr pOptions( new Options(this->LocalGenerator, Options::Compiler, - cmVS10CLFlagTable)); + cmVSGetCLFlagTable(this->LocalGenerator))); Options& clOptions = *pOptions; std::string flags; @@ -1311,7 +1338,7 @@ cmVisualStudio10TargetGenerator::WriteLibOptions(std::string const& config) cmVisualStudioGeneratorOptions libOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, - cmVS10LibFlagTable, 0, this); + cmVSGetLibFlagTable(this->LocalGenerator), 0, this); libOptions.Parse(libflags?libflags:""); libOptions.Parse(libflagsConfig?libflagsConfig:""); libOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); @@ -1391,7 +1418,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& cmVisualStudioGeneratorOptions linkOptions(this->LocalGenerator, cmVisualStudioGeneratorOptions::Linker, - cmVS10LinkFlagTable, 0, this); + cmVSGetLinkFlagTable(this->LocalGenerator), 0, this); if ( this->Target->GetPropertyAsBool("WIN32_EXECUTABLE") ) { flags += " /SUBSYSTEM:WINDOWS"; diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py index eba84aaea..35b55ca25 100755 --- a/Source/cmparseMSBuildXML.py +++ b/Source/cmparseMSBuildXML.py @@ -6,6 +6,9 @@ # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/cl.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/lib.xml" # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/link.xml" +# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/cl.xml" +# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/lib.xml" +# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/V110/1033/link.xml" # # BoolProperty true|false # simple example: From cca386b0a058c050a03c10bf1b9f1344aef7de3f Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 11:31:33 -0400 Subject: [PATCH 039/152] Detect Cray compiler version with its id Decode decimal digits from _RELEASE _RELEASE_MINOR to compute version number components. See documentation at: http://docs.cray.com/books/S-2179-52/html-S-2179-52/zfixed5fvzxnxo.html http://sourceforge.net/p/predef/wiki/Compilers/#cray-c --- Modules/CMakeCCompilerId.c.in | 2 ++ Modules/CMakeCXXCompilerId.cpp.in | 2 ++ 2 files changed, 4 insertions(+) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index d6e192d60..f57a52a6e 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -105,6 +105,8 @@ #elif defined(_CRAYC) # define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) #elif defined(__TI_COMPILER_VERSION__) # define COMPILER_ID "TI_DSP" diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index a11996d3e..a784ba885 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -110,6 +110,8 @@ #elif defined(_CRAYC) # define COMPILER_ID "Cray" +# define COMPILER_VERSION_MAJOR DEC(_RELEASE) +# define COMPILER_VERSION_MINOR DEC(_RELEASE_MINOR) #elif defined(__TI_COMPILER_VERSION__) # define COMPILER_ID "TI_DSP" From e9bc502fb82d7e48e12d9a2bd380c137f6cbc03d Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 22 Aug 2012 11:48:07 -0400 Subject: [PATCH 040/152] Detect Analog VisualDSP++ compiler version with its id Decode hex digits from __VISUALDSPVERSION__ to compute the version number components. Note that the constant encodes decimal digits as hex digits (never larger than 9). We represent them as decimal after extraction. See documentation at: http://download.analog.com/dsp/tools/VisualDSP_45_Update_6_Release_Note_v4.pdf http://www.analog.com/static/imported-files/software_manuals/50_asm_man.rev3.1.pdf Note that __VISUALDSPVERSION__ was introduced in version 4.5.6. --- Modules/CMakeCCompilerId.c.in | 11 +++++++++-- Modules/CMakeCXXCompilerId.cpp.in | 11 +++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) diff --git a/Modules/CMakeCCompilerId.c.in b/Modules/CMakeCCompilerId.c.in index f57a52a6e..c5bde9a92 100644 --- a/Modules/CMakeCCompilerId.c.in +++ b/Modules/CMakeCCompilerId.c.in @@ -147,9 +147,16 @@ # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) # endif +/* Analog VisualDSP++ >= 4.5.6 */ +#elif defined(__VISUALDSPVERSION__) +# define COMPILER_ID "ADSP" + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) + +/* Analog VisualDSP++ < 4.5.6 */ #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -/* Analog Devices C++ compiler for Blackfin, TigerSHARC and - SHARC (21000) DSPs */ # define COMPILER_ID "ADSP" /* IAR Systems compiler for embedded systems. diff --git a/Modules/CMakeCXXCompilerId.cpp.in b/Modules/CMakeCXXCompilerId.cpp.in index a784ba885..2c8dd4bc7 100644 --- a/Modules/CMakeCXXCompilerId.cpp.in +++ b/Modules/CMakeCXXCompilerId.cpp.in @@ -149,9 +149,16 @@ # define COMPILER_VERSION_TWEAK DEC(_MSC_BUILD) # endif +/* Analog VisualDSP++ >= 4.5.6 */ +#elif defined(__VISUALDSPVERSION__) +# define COMPILER_ID "ADSP" + /* __VISUALDSPVERSION__ = 0xVVRRPP00 */ +# define COMPILER_VERSION_MAJOR HEX(__VISUALDSPVERSION__>>24) +# define COMPILER_VERSION_MINOR HEX(__VISUALDSPVERSION__>>16 & 0xFF) +# define COMPILER_VERSION_PATCH HEX(__VISUALDSPVERSION__>>8 & 0xFF) + +/* Analog VisualDSP++ < 4.5.6 */ #elif defined(__ADSPBLACKFIN__) || defined(__ADSPTS__) || defined(__ADSP21000__) -/* Analog Devices C++ compiler for Blackfin, TigerSHARC and - SHARC (21000) DSPs */ # define COMPILER_ID "ADSP" #elif defined(_SGI_COMPILER_VERSION) || defined(_COMPILER_VERSION) From 2c7a451de003782b1ba5e47ab377f33f1fa5c4e5 Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Sat, 21 Jul 2012 15:37:46 +0200 Subject: [PATCH 041/152] VS: Cleanup AddPlatformDefinitions() of Visual Studio generators Move adding of definitions into cmGlobalVisualStudioGenerator to share code and avoid duplicate architecture string literals. --- Source/cmGlobalVisualStudio10Generator.cxx | 9 +-------- Source/cmGlobalVisualStudio10Generator.h | 1 - Source/cmGlobalVisualStudio10IA64Generator.cxx | 3 +-- Source/cmGlobalVisualStudio10Win64Generator.cxx | 3 +-- Source/cmGlobalVisualStudio11ARMGenerator.cxx | 15 ++++++--------- Source/cmGlobalVisualStudio11ARMGenerator.h | 4 +--- Source/cmGlobalVisualStudio11Generator.cxx | 9 +-------- Source/cmGlobalVisualStudio11Generator.h | 1 - Source/cmGlobalVisualStudio11Win64Generator.cxx | 8 ++++++-- Source/cmGlobalVisualStudio11Win64Generator.h | 2 +- Source/cmGlobalVisualStudio6Generator.cxx | 5 ++--- Source/cmGlobalVisualStudio71Generator.cxx | 9 +-------- Source/cmGlobalVisualStudio71Generator.h | 1 - Source/cmGlobalVisualStudio7Generator.cxx | 8 +------- Source/cmGlobalVisualStudio7Generator.h | 1 - Source/cmGlobalVisualStudio8Generator.cxx | 10 +--------- Source/cmGlobalVisualStudio8Generator.h | 3 --- Source/cmGlobalVisualStudio9Generator.cxx | 9 +-------- Source/cmGlobalVisualStudio9Generator.h | 1 - Source/cmGlobalVisualStudioGenerator.cxx | 14 ++++++++++++++ Source/cmGlobalVisualStudioGenerator.h | 5 +++++ 21 files changed, 43 insertions(+), 78 deletions(-) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 48ead25db..b44b78031 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -19,6 +19,7 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() { + this->VersionId = "MSVC10"; this->FindMakeProgramFile = "CMakeVS10FindMake.cmake"; std::string vc10Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( @@ -26,14 +27,6 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC10", "1"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index 47ce790f8..a4a9d401f 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -38,7 +38,6 @@ public: virtual const char* GetName() const { return cmGlobalVisualStudio10Generator::GetActualName();} static const char* GetActualName() {return "Visual Studio 10";} - virtual void AddPlatformDefinitions(cmMakefile* mf); /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; diff --git a/Source/cmGlobalVisualStudio10IA64Generator.cxx b/Source/cmGlobalVisualStudio10IA64Generator.cxx index 5f70f6bba..25dd88f2a 100644 --- a/Source/cmGlobalVisualStudio10IA64Generator.cxx +++ b/Source/cmGlobalVisualStudio10IA64Generator.cxx @@ -16,6 +16,7 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio10IA64Generator::cmGlobalVisualStudio10IA64Generator() { + this->ArchitectureId = "x64"; } //---------------------------------------------------------------------------- @@ -33,8 +34,6 @@ void cmGlobalVisualStudio10IA64Generator { this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx index 49dc47364..d0a0c49a1 100644 --- a/Source/cmGlobalVisualStudio10Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx @@ -16,6 +16,7 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator() { + this->ArchitectureId = "x64"; } //---------------------------------------------------------------------------- @@ -33,8 +34,6 @@ void cmGlobalVisualStudio10Win64Generator { this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.cxx b/Source/cmGlobalVisualStudio11ARMGenerator.cxx index fef1aba61..efd71c65d 100644 --- a/Source/cmGlobalVisualStudio11ARMGenerator.cxx +++ b/Source/cmGlobalVisualStudio11ARMGenerator.cxx @@ -13,6 +13,12 @@ #include "cmMakefile.h" #include "cmake.h" +//---------------------------------------------------------------------------- +cmGlobalVisualStudio11ARMGenerator::cmGlobalVisualStudio11ARMGenerator() +{ + this->ArchitectureId = "ARM"; +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio11ARMGenerator ::GetDocumentation(cmDocumentationEntry& entry) const @@ -21,12 +27,3 @@ void cmGlobalVisualStudio11ARMGenerator entry.Brief = "Generates Visual Studio 11 ARM project files."; entry.Full = ""; } - -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11ARMGenerator -::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "ARM"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "ARM"); -} diff --git a/Source/cmGlobalVisualStudio11ARMGenerator.h b/Source/cmGlobalVisualStudio11ARMGenerator.h index 77e142994..71dbf2e3b 100644 --- a/Source/cmGlobalVisualStudio11ARMGenerator.h +++ b/Source/cmGlobalVisualStudio11ARMGenerator.h @@ -18,7 +18,7 @@ class cmGlobalVisualStudio11ARMGenerator : public cmGlobalVisualStudio11Generator { public: - cmGlobalVisualStudio11ARMGenerator() {} + cmGlobalVisualStudio11ARMGenerator(); static cmGlobalGenerator* New() { return new cmGlobalVisualStudio11ARMGenerator; } @@ -31,7 +31,5 @@ public: /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; - - virtual void AddPlatformDefinitions(cmMakefile* mf); }; #endif diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index be7fd5572..ab1187df8 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -16,19 +16,12 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator() { + this->VersionId = "MSVC11"; this->FindMakeProgramFile = "CMakeVS11FindMake.cmake"; this->ExpressEdition = false; // TODO: VS 11 Express support this->PlatformToolset = "v110"; } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio11Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC11", "1"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio11Generator::WriteSLNHeader(std::ostream& fout) { diff --git a/Source/cmGlobalVisualStudio11Generator.h b/Source/cmGlobalVisualStudio11Generator.h index 7e8f6aa4e..56337a4db 100644 --- a/Source/cmGlobalVisualStudio11Generator.h +++ b/Source/cmGlobalVisualStudio11Generator.h @@ -28,7 +28,6 @@ public: virtual const char* GetName() const { return cmGlobalVisualStudio11Generator::GetActualName();} static const char* GetActualName() {return "Visual Studio 11";} - virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNHeader(std::ostream& fout); diff --git a/Source/cmGlobalVisualStudio11Win64Generator.cxx b/Source/cmGlobalVisualStudio11Win64Generator.cxx index 10c902753..94e07bf38 100644 --- a/Source/cmGlobalVisualStudio11Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio11Win64Generator.cxx @@ -13,6 +13,12 @@ #include "cmMakefile.h" #include "cmake.h" +//---------------------------------------------------------------------------- +cmGlobalVisualStudio11Win64Generator::cmGlobalVisualStudio11Win64Generator() +{ + this->ArchitectureId = "x64"; +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio11Win64Generator ::GetDocumentation(cmDocumentationEntry& entry) const @@ -28,6 +34,4 @@ void cmGlobalVisualStudio11Win64Generator { this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "x64"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "x64"); } diff --git a/Source/cmGlobalVisualStudio11Win64Generator.h b/Source/cmGlobalVisualStudio11Win64Generator.h index 53f19538c..9445d156c 100644 --- a/Source/cmGlobalVisualStudio11Win64Generator.h +++ b/Source/cmGlobalVisualStudio11Win64Generator.h @@ -18,7 +18,7 @@ class cmGlobalVisualStudio11Win64Generator : public cmGlobalVisualStudio11Generator { public: - cmGlobalVisualStudio11Win64Generator() {} + cmGlobalVisualStudio11Win64Generator(); static cmGlobalGenerator* New() { return new cmGlobalVisualStudio11Win64Generator; } diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index cc7034129..ca06b6631 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -32,6 +32,7 @@ std::string GetVS6TargetName(const std::string& targetName) cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator() { + this->VersionId = "MSVC60"; this->FindMakeProgramFile = "CMakeVS6FindMake.cmake"; } @@ -40,14 +41,12 @@ void cmGlobalVisualStudio6Generator cmMakefile *mf, bool optional) { + cmGlobalVisualStudioGenerator::AddPlatformDefinitions(mf); mf->AddDefinition("CMAKE_GENERATOR_CC", "cl"); mf->AddDefinition("CMAKE_GENERATOR_CXX", "cl"); mf->AddDefinition("CMAKE_GENERATOR_RC", "rc"); mf->AddDefinition("CMAKE_GENERATOR_NO_COMPILER_ENV", "1"); mf->AddDefinition("CMAKE_GENERATOR_Fortran", "ifort"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC60", "1"); this->GenerateConfigurations(mf); this->cmGlobalGenerator::EnableLanguage(lang, mf, optional); } diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index 1da575ef8..d99fa036a 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -18,6 +18,7 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator() { + this->VersionId = "MSVC71"; this->FindMakeProgramFile = "CMakeVS71FindMake.cmake"; this->ProjectConfigurationSectionName = "ProjectConfiguration"; } @@ -33,14 +34,6 @@ cmLocalGenerator *cmGlobalVisualStudio71Generator::CreateLocalGenerator() return lg; } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio71Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - this->cmGlobalVisualStudio7Generator::AddPlatformDefinitions(mf); - mf->RemoveDefinition("MSVC70"); - mf->AddDefinition("MSVC71", "1"); -} - //---------------------------------------------------------------------------- std::string cmGlobalVisualStudio71Generator::GetUserMacrosDirectory() { diff --git a/Source/cmGlobalVisualStudio71Generator.h b/Source/cmGlobalVisualStudio71Generator.h index 285f202dc..a8daad6a2 100644 --- a/Source/cmGlobalVisualStudio71Generator.h +++ b/Source/cmGlobalVisualStudio71Generator.h @@ -53,7 +53,6 @@ public: protected: virtual const char* GetIDEVersion() { return "7.1"; } - virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNFile(std::ostream& fout, cmLocalGenerator* root, std::vector& generators); diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index d485d6ee3..0567d5598 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -18,6 +18,7 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator() { + this->VersionId = "MSVC70"; this->FindMakeProgramFile = "CMakeVS7FindMake.cmake"; } @@ -55,13 +56,6 @@ void cmGlobalVisualStudio7Generator } -void cmGlobalVisualStudio7Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC70", "1"); - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", "X86"); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", "X86"); -} - std::string cmGlobalVisualStudio7Generator ::GenerateBuildCommand(const char* makeProgram, const char *projectName, diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h index 9b9107db7..1df58f97b 100644 --- a/Source/cmGlobalVisualStudio7Generator.h +++ b/Source/cmGlobalVisualStudio7Generator.h @@ -112,7 +112,6 @@ protected: virtual void WriteSLNFooter(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout); virtual std::string WriteUtilityDepend(cmTarget* target); - virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteTargetsToSolution( std::ostream& fout, diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index a74a4eebe..f46918828 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -19,9 +19,9 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator() { + this->VersionId = "MSVC80"; this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; - this->ArchitectureId = "X86"; } //---------------------------------------------------------------------------- @@ -53,14 +53,6 @@ void cmGlobalVisualStudio8Generator entry.Full = ""; } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio8Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC80", "1"); -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Generator::Configure() { diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 31501bc90..5009f2960 100644 --- a/Source/cmGlobalVisualStudio8Generator.h +++ b/Source/cmGlobalVisualStudio8Generator.h @@ -72,7 +72,6 @@ protected: void AddCheckTarget(); static cmIDEFlagTable const* GetExtraFlagTableVS8(); - virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSolutionConfigurations(std::ostream& fout); virtual void WriteProjectConfigurations(std::ostream& fout, @@ -82,7 +81,5 @@ protected: virtual bool ComputeTargetDepends(); virtual void WriteProjectDepends(std::ostream& fout, const char* name, const char* path, cmTarget &t); - - const char* ArchitectureId; }; #endif diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index fcf00d532..531395b8c 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -19,17 +19,10 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator() { + this->VersionId = "MSVC90"; this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; } -//---------------------------------------------------------------------------- -void cmGlobalVisualStudio9Generator::AddPlatformDefinitions(cmMakefile* mf) -{ - mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); - mf->AddDefinition("MSVC90", "1"); -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio9Generator::WriteSLNHeader(std::ostream& fout) { diff --git a/Source/cmGlobalVisualStudio9Generator.h b/Source/cmGlobalVisualStudio9Generator.h index 361b58c76..0b0d1437f 100644 --- a/Source/cmGlobalVisualStudio9Generator.h +++ b/Source/cmGlobalVisualStudio9Generator.h @@ -32,7 +32,6 @@ public: virtual const char* GetName() const { return cmGlobalVisualStudio9Generator::GetActualName();} static const char* GetActualName() {return "Visual Studio 9 2008";} - virtual void AddPlatformDefinitions(cmMakefile* mf); /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index a2b4c6519..feb3ac98b 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -21,6 +21,8 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { + this->ArchitectureId = "X86"; + this->VersionId = 0; } //---------------------------------------------------------------------------- @@ -488,6 +490,18 @@ void cmGlobalVisualStudioGenerator::ComputeVSTargetDepends(cmTarget& target) } } +//---------------------------------------------------------------------------- +void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) +{ + mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); + mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); + + if (this->VersionId) + { + mf->AddDefinition(this->VersionId, "1"); + } +} + //---------------------------------------------------------------------------- std::string cmGlobalVisualStudioGenerator::GetUtilityDepend(cmTarget* target) { diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index 27fc8cf2e..a042dc0db 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -84,6 +84,8 @@ protected: virtual const char* GetIDEVersion() = 0; + virtual void AddPlatformDefinitions(cmMakefile* mf); + virtual bool ComputeTargetDepends(); class VSDependSet: public std::set {}; class VSDependMap: public std::map {}; @@ -96,6 +98,9 @@ protected: std::string GetUtilityDepend(cmTarget* target); typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; + const char* ArchitectureId; + const char* VersionId; + private: void ComputeTargetObjects(cmGeneratorTarget* gt) const; From b8b5c8342a2a2de5f57f9dd83435060b4eb825a8 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Aug 2012 15:53:04 -0400 Subject: [PATCH 042/152] Re-order C/C++/Fortran compiler determination logic Re-organize CMakeDetermine(C|CXX|Fortran)Compiler.cmake to search for the compiler command-line tool only under generators for which it makes sense. For the Visual Studio generators we do not expect to find the compiler tool from the environment, nor would we use the result anyway. Furthermore, set CMAKE_${lang}_COMPILER_ID_TEST_FLAGS only when it has a chance to be used. Extract _CMAKE_TOOLCHAIN_LOCATION from the compiler path after running the compiler id step so in the future that step can help find the path to the compiler. --- Modules/CMakeDetermineCCompiler.cmake | 131 +++++++------- Modules/CMakeDetermineCXXCompiler.cmake | 144 +++++++-------- Modules/CMakeDetermineFortranCompiler.cmake | 188 ++++++++++---------- 3 files changed, 227 insertions(+), 236 deletions(-) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 171eaddfe..3ce1a36da 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -39,76 +39,68 @@ if(NOT CMAKE_C_COMPILER_NAMES) set(CMAKE_C_COMPILER_NAMES cc) endif() -if(NOT CMAKE_C_COMPILER) - set(CMAKE_C_COMPILER_INIT NOTFOUND) - - # prefer the environment variable CC - if($ENV{CC} MATCHES ".+") - get_filename_component(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT) - if(CMAKE_C_FLAGS_ENV_INIT) - set(CMAKE_C_COMPILER_ARG1 "${CMAKE_C_FLAGS_ENV_INIT}" CACHE STRING "First argument to C compiler") - endif() - if(NOT EXISTS ${CMAKE_C_COMPILER_INIT}) - message(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") - endif() - endif() - - # next try prefer the compiler specified by the generator - if(CMAKE_GENERATOR_CC) - if(NOT CMAKE_C_COMPILER_INIT) - set(CMAKE_C_COMPILER_INIT ${CMAKE_GENERATOR_CC}) - endif() - endif() - - # finally list compilers to try - if(NOT CMAKE_C_COMPILER_INIT) - set(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc clang) - endif() - - _cmake_find_compiler(C) - -else() - - # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt - # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE - # if CMAKE_C_COMPILER is a list of length 2, use the first item as - # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1 - - list(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH) - if("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2) - list(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1) - list(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER) - endif() - - # if a compiler was specified by the user but without path, - # now try to find it with the full path - # if it is found, force it into the cache, - # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" - # if the C compiler already had a path, reuse it for searching the CXX compiler - get_filename_component(_CMAKE_USER_C_COMPILER_PATH "${CMAKE_C_COMPILER}" PATH) - if(NOT _CMAKE_USER_C_COMPILER_PATH) - find_program(CMAKE_C_COMPILER_WITH_PATH NAMES ${CMAKE_C_COMPILER}) - mark_as_advanced(CMAKE_C_COMPILER_WITH_PATH) - if(CMAKE_C_COMPILER_WITH_PATH) - set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE) - endif() - endif() -endif() -mark_as_advanced(CMAKE_C_COMPILER) - -if (NOT _CMAKE_TOOLCHAIN_LOCATION) - get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH) -endif () - -# Build a small source file to identify the compiler. if(${CMAKE_GENERATOR} MATCHES "Visual Studio") set(CMAKE_C_COMPILER_ID_RUN 1) set(CMAKE_C_PLATFORM_ID "Windows") set(CMAKE_C_COMPILER_ID "MSVC") -endif() + set(CMAKE_C_COMPILER "${CMAKE_GENERATOR_CC}") +else() + if(NOT CMAKE_C_COMPILER) + set(CMAKE_C_COMPILER_INIT NOTFOUND) -if(NOT CMAKE_C_COMPILER_ID_RUN) - set(CMAKE_C_COMPILER_ID_RUN 1) + # prefer the environment variable CC + if($ENV{CC} MATCHES ".+") + get_filename_component(CMAKE_C_COMPILER_INIT $ENV{CC} PROGRAM PROGRAM_ARGS CMAKE_C_FLAGS_ENV_INIT) + if(CMAKE_C_FLAGS_ENV_INIT) + set(CMAKE_C_COMPILER_ARG1 "${CMAKE_C_FLAGS_ENV_INIT}" CACHE STRING "First argument to C compiler") + endif() + if(NOT EXISTS ${CMAKE_C_COMPILER_INIT}) + message(FATAL_ERROR "Could not find compiler set in environment variable CC:\n$ENV{CC}.") + endif() + endif() + + # next try prefer the compiler specified by the generator + if(CMAKE_GENERATOR_CC) + if(NOT CMAKE_C_COMPILER_INIT) + set(CMAKE_C_COMPILER_INIT ${CMAKE_GENERATOR_CC}) + endif() + endif() + + # finally list compilers to try + if(NOT CMAKE_C_COMPILER_INIT) + set(CMAKE_C_COMPILER_LIST ${_CMAKE_TOOLCHAIN_PREFIX}cc ${_CMAKE_TOOLCHAIN_PREFIX}gcc cl bcc xlc clang) + endif() + + _cmake_find_compiler(C) + + else() + + # we only get here if CMAKE_C_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # if CMAKE_C_COMPILER is a list of length 2, use the first item as + # CMAKE_C_COMPILER and the 2nd one as CMAKE_C_COMPILER_ARG1 + + list(LENGTH CMAKE_C_COMPILER _CMAKE_C_COMPILER_LIST_LENGTH) + if("${_CMAKE_C_COMPILER_LIST_LENGTH}" EQUAL 2) + list(GET CMAKE_C_COMPILER 1 CMAKE_C_COMPILER_ARG1) + list(GET CMAKE_C_COMPILER 0 CMAKE_C_COMPILER) + endif() + + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + # if the C compiler already had a path, reuse it for searching the CXX compiler + get_filename_component(_CMAKE_USER_C_COMPILER_PATH "${CMAKE_C_COMPILER}" PATH) + if(NOT _CMAKE_USER_C_COMPILER_PATH) + find_program(CMAKE_C_COMPILER_WITH_PATH NAMES ${CMAKE_C_COMPILER}) + mark_as_advanced(CMAKE_C_COMPILER_WITH_PATH) + if(CMAKE_C_COMPILER_WITH_PATH) + set(CMAKE_C_COMPILER ${CMAKE_C_COMPILER_WITH_PATH} CACHE STRING "C compiler" FORCE) + endif() + endif() + endif() + mark_as_advanced(CMAKE_C_COMPILER) # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce @@ -120,6 +112,11 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) # Try enabling ANSI mode on HP. "-Aa" ) +endif() + +# Build a small source file to identify the compiler. +if(NOT CMAKE_C_COMPILER_ID_RUN) + set(CMAKE_C_COMPILER_ID_RUN 1) # Try to identify the compiler. set(CMAKE_C_COMPILER_ID) @@ -139,6 +136,10 @@ if(NOT CMAKE_C_COMPILER_ID_RUN) endif() endif() +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_C_COMPILER}" PATH) +endif () + # If we have a gcc cross compiler, they have usually some prefix, like # e.g. powerpc-linux-gcc, arm-elf-gcc or i586-mingw32msvc-gcc, optionally # with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 898947ad1..6ed2c68f6 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -38,87 +38,68 @@ if(NOT CMAKE_CXX_COMPILER_NAMES) set(CMAKE_CXX_COMPILER_NAMES CC) endif() -if(NOT CMAKE_CXX_COMPILER) - set(CMAKE_CXX_COMPILER_INIT NOTFOUND) - - # prefer the environment variable CXX - if($ENV{CXX} MATCHES ".+") - get_filename_component(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT) - if(CMAKE_CXX_FLAGS_ENV_INIT) - set(CMAKE_CXX_COMPILER_ARG1 "${CMAKE_CXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler") - endif() - if(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT}) - message(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}") - endif() - endif() - - # next prefer the generator specified compiler - if(CMAKE_GENERATOR_CXX) - if(NOT CMAKE_CXX_COMPILER_INIT) - set(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX}) - endif() - endif() - - # finally list compilers to try - if(NOT CMAKE_CXX_COMPILER_INIT) - set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC clang++) - endif() - - _cmake_find_compiler(CXX) -else() - -# we only get here if CMAKE_CXX_COMPILER was specified using -D or a pre-made CMakeCache.txt -# (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE -# -# if CMAKE_CXX_COMPILER is a list of length 2, use the first item as -# CMAKE_CXX_COMPILER and the 2nd one as CMAKE_CXX_COMPILER_ARG1 - - list(LENGTH CMAKE_CXX_COMPILER _CMAKE_CXX_COMPILER_LIST_LENGTH) - if("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2) - list(GET CMAKE_CXX_COMPILER 1 CMAKE_CXX_COMPILER_ARG1) - list(GET CMAKE_CXX_COMPILER 0 CMAKE_CXX_COMPILER) - endif() - -# if a compiler was specified by the user but without path, -# now try to find it with the full path -# if it is found, force it into the cache, -# if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" -# if the CXX compiler already had a path, reuse it for searching the C compiler - get_filename_component(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH) - if(NOT _CMAKE_USER_CXX_COMPILER_PATH) - find_program(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER}) - mark_as_advanced(CMAKE_CXX_COMPILER_WITH_PATH) - if(CMAKE_CXX_COMPILER_WITH_PATH) - set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE) - endif() - endif() -endif() -mark_as_advanced(CMAKE_CXX_COMPILER) - -if (NOT _CMAKE_TOOLCHAIN_LOCATION) - get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH) -endif () - -# This block was used before the compiler was identified by building a -# source file. Unless g++ crashes when building a small C++ -# executable this should no longer be needed. -# -# The g++ that comes with BeOS 5 segfaults if you run "g++ -E" -# ("gcc -E" is fine), which throws up a system dialog box that hangs cmake -# until the user clicks "OK"...so for now, we just assume it's g++. -# if(BEOS) -# set(CMAKE_COMPILER_IS_GNUCXX 1) -# set(CMAKE_COMPILER_IS_GNUCXX_RUN 1) -# endif() - -# Build a small source file to identify the compiler. if(${CMAKE_GENERATOR} MATCHES "Visual Studio") set(CMAKE_CXX_COMPILER_ID_RUN 1) set(CMAKE_CXX_PLATFORM_ID "Windows") set(CMAKE_CXX_COMPILER_ID "MSVC") -endif() -if(NOT CMAKE_CXX_COMPILER_ID_RUN) - set(CMAKE_CXX_COMPILER_ID_RUN 1) + set(CMAKE_CXX_COMPILER "${CMAKE_GENERATOR_CXX}") +else() + if(NOT CMAKE_CXX_COMPILER) + set(CMAKE_CXX_COMPILER_INIT NOTFOUND) + + # prefer the environment variable CXX + if($ENV{CXX} MATCHES ".+") + get_filename_component(CMAKE_CXX_COMPILER_INIT $ENV{CXX} PROGRAM PROGRAM_ARGS CMAKE_CXX_FLAGS_ENV_INIT) + if(CMAKE_CXX_FLAGS_ENV_INIT) + set(CMAKE_CXX_COMPILER_ARG1 "${CMAKE_CXX_FLAGS_ENV_INIT}" CACHE STRING "First argument to CXX compiler") + endif() + if(NOT EXISTS ${CMAKE_CXX_COMPILER_INIT}) + message(FATAL_ERROR "Could not find compiler set in environment variable CXX:\n$ENV{CXX}.\n${CMAKE_CXX_COMPILER_INIT}") + endif() + endif() + + # next prefer the generator specified compiler + if(CMAKE_GENERATOR_CXX) + if(NOT CMAKE_CXX_COMPILER_INIT) + set(CMAKE_CXX_COMPILER_INIT ${CMAKE_GENERATOR_CXX}) + endif() + endif() + + # finally list compilers to try + if(NOT CMAKE_CXX_COMPILER_INIT) + set(CMAKE_CXX_COMPILER_LIST CC ${_CMAKE_TOOLCHAIN_PREFIX}c++ ${_CMAKE_TOOLCHAIN_PREFIX}g++ aCC cl bcc xlC clang++) + endif() + + _cmake_find_compiler(CXX) + else() + + # we only get here if CMAKE_CXX_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # + # if CMAKE_CXX_COMPILER is a list of length 2, use the first item as + # CMAKE_CXX_COMPILER and the 2nd one as CMAKE_CXX_COMPILER_ARG1 + + list(LENGTH CMAKE_CXX_COMPILER _CMAKE_CXX_COMPILER_LIST_LENGTH) + if("${_CMAKE_CXX_COMPILER_LIST_LENGTH}" EQUAL 2) + list(GET CMAKE_CXX_COMPILER 1 CMAKE_CXX_COMPILER_ARG1) + list(GET CMAKE_CXX_COMPILER 0 CMAKE_CXX_COMPILER) + endif() + + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + # if the CXX compiler already had a path, reuse it for searching the C compiler + get_filename_component(_CMAKE_USER_CXX_COMPILER_PATH "${CMAKE_CXX_COMPILER}" PATH) + if(NOT _CMAKE_USER_CXX_COMPILER_PATH) + find_program(CMAKE_CXX_COMPILER_WITH_PATH NAMES ${CMAKE_CXX_COMPILER}) + mark_as_advanced(CMAKE_CXX_COMPILER_WITH_PATH) + if(CMAKE_CXX_COMPILER_WITH_PATH) + set(CMAKE_CXX_COMPILER ${CMAKE_CXX_COMPILER_WITH_PATH} CACHE STRING "CXX compiler" FORCE) + endif() + endif() + endif() + mark_as_advanced(CMAKE_CXX_COMPILER) # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce @@ -127,6 +108,11 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) # Try compiling to an object file only. "-c" ) +endif() + +# Build a small source file to identify the compiler. +if(NOT CMAKE_CXX_COMPILER_ID_RUN) + set(CMAKE_CXX_COMPILER_ID_RUN 1) # Try to identify the compiler. set(CMAKE_CXX_COMPILER_ID) @@ -146,6 +132,10 @@ if(NOT CMAKE_CXX_COMPILER_ID_RUN) endif() endif() +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_CXX_COMPILER}" PATH) +endif () + # if we have a g++ cross compiler, they have usually some prefix, like # e.g. powerpc-linux-g++, arm-elf-g++ or i586-mingw32msvc-g++ , optionally # with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index da77e21d6..5bd514a20 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -25,105 +25,100 @@ if(NOT CMAKE_Fortran_COMPILER_NAMES) set(CMAKE_Fortran_COMPILER_NAMES f95) endif() -if(NOT CMAKE_Fortran_COMPILER) - # prefer the environment variable CC - if($ENV{FC} MATCHES ".+") - get_filename_component(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT) - if(CMAKE_Fortran_FLAGS_ENV_INIT) - set(CMAKE_Fortran_COMPILER_ARG1 "${CMAKE_Fortran_FLAGS_ENV_INIT}" CACHE STRING "First argument to Fortran compiler") - endif() - if(EXISTS ${CMAKE_Fortran_COMPILER_INIT}) - else() - message(FATAL_ERROR "Could not find compiler set in environment variable FC:\n$ENV{FC}.") - endif() - endif() - - # next try prefer the compiler specified by the generator - if(CMAKE_GENERATOR_FC) - if(NOT CMAKE_Fortran_COMPILER_INIT) - set(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC}) - endif() - endif() - - # finally list compilers to try - if(NOT CMAKE_Fortran_COMPILER_INIT) - # Known compilers: - # f77/f90/f95: generic compiler names - # g77: GNU Fortran 77 compiler - # gfortran: putative GNU Fortran 95+ compiler (in progress) - # fort77: native F77 compiler under HP-UX (and some older Crays) - # frt: Fujitsu F77 compiler - # pathf90/pathf95/pathf2003: PathScale Fortran compiler - # pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers - # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers - # lf95: Lahey-Fujitsu F95 compiler - # fl32: Microsoft Fortran 77 "PowerStation" compiler - # af77: Apogee F77 compiler for Intergraph hardware running CLIX - # epcf90: "Edinburgh Portable Compiler" F90 - # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha - # ifc: Intel Fortran 95 compiler for Linux/x86 - # efc: Intel Fortran 95 compiler for IA64 - # - # The order is 95 or newer compilers first, then 90, - # then 77 or older compilers, gnu is always last in the group, - # so if you paid for a compiler it is picked by default. - set(CMAKE_Fortran_COMPILER_LIST - ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 - fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 - frt pgf77 xlf fl32 af77 g77 f77 - ) - - # Vendor-specific compiler names. - set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) - set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc) - set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) - set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77) - set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) - set(_Fortran_COMPILER_NAMES_XL xlf) - set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) - endif() - - _cmake_find_compiler(Fortran) - -else() - # we only get here if CMAKE_Fortran_COMPILER was specified using -D or a pre-made CMakeCache.txt - # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE - # if CMAKE_Fortran_COMPILER is a list of length 2, use the first item as - # CMAKE_Fortran_COMPILER and the 2nd one as CMAKE_Fortran_COMPILER_ARG1 - - list(LENGTH CMAKE_Fortran_COMPILER _CMAKE_Fortran_COMPILER_LIST_LENGTH) - if("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2) - list(GET CMAKE_Fortran_COMPILER 1 CMAKE_Fortran_COMPILER_ARG1) - list(GET CMAKE_Fortran_COMPILER 0 CMAKE_Fortran_COMPILER) - endif() - - # if a compiler was specified by the user but without path, - # now try to find it with the full path - # if it is found, force it into the cache, - # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" - # if the C compiler already had a path, reuse it for searching the CXX compiler - get_filename_component(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH) - if(NOT _CMAKE_USER_Fortran_COMPILER_PATH) - find_program(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER}) - mark_as_advanced(CMAKE_Fortran_COMPILER_WITH_PATH) - if(CMAKE_Fortran_COMPILER_WITH_PATH) - set(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH} - CACHE STRING "Fortran compiler" FORCE) - endif() - endif() -endif() - -mark_as_advanced(CMAKE_Fortran_COMPILER) - -# Build a small source file to identify the compiler. if(${CMAKE_GENERATOR} MATCHES "Visual Studio") set(CMAKE_Fortran_COMPILER_ID_RUN 1) set(CMAKE_Fortran_PLATFORM_ID "Windows") set(CMAKE_Fortran_COMPILER_ID "Intel") -endif() + set(CMAKE_Fortran_COMPILER "${CMAKE_GENERATOR_FC}") +else() + if(NOT CMAKE_Fortran_COMPILER) + # prefer the environment variable CC + if($ENV{FC} MATCHES ".+") + get_filename_component(CMAKE_Fortran_COMPILER_INIT $ENV{FC} PROGRAM PROGRAM_ARGS CMAKE_Fortran_FLAGS_ENV_INIT) + if(CMAKE_Fortran_FLAGS_ENV_INIT) + set(CMAKE_Fortran_COMPILER_ARG1 "${CMAKE_Fortran_FLAGS_ENV_INIT}" CACHE STRING "First argument to Fortran compiler") + endif() + if(EXISTS ${CMAKE_Fortran_COMPILER_INIT}) + else() + message(FATAL_ERROR "Could not find compiler set in environment variable FC:\n$ENV{FC}.") + endif() + endif() -if(NOT CMAKE_Fortran_COMPILER_ID_RUN) - set(CMAKE_Fortran_COMPILER_ID_RUN 1) + # next try prefer the compiler specified by the generator + if(CMAKE_GENERATOR_FC) + if(NOT CMAKE_Fortran_COMPILER_INIT) + set(CMAKE_Fortran_COMPILER_INIT ${CMAKE_GENERATOR_FC}) + endif() + endif() + + # finally list compilers to try + if(NOT CMAKE_Fortran_COMPILER_INIT) + # Known compilers: + # f77/f90/f95: generic compiler names + # g77: GNU Fortran 77 compiler + # gfortran: putative GNU Fortran 95+ compiler (in progress) + # fort77: native F77 compiler under HP-UX (and some older Crays) + # frt: Fujitsu F77 compiler + # pathf90/pathf95/pathf2003: PathScale Fortran compiler + # pgf77/pgf90/pgf95/pgfortran: Portland Group F77/F90/F95 compilers + # xlf/xlf90/xlf95: IBM (AIX) F77/F90/F95 compilers + # lf95: Lahey-Fujitsu F95 compiler + # fl32: Microsoft Fortran 77 "PowerStation" compiler + # af77: Apogee F77 compiler for Intergraph hardware running CLIX + # epcf90: "Edinburgh Portable Compiler" F90 + # fort: Compaq (now HP) Fortran 90/95 compiler for Tru64 and Linux/Alpha + # ifc: Intel Fortran 95 compiler for Linux/x86 + # efc: Intel Fortran 95 compiler for IA64 + # + # The order is 95 or newer compilers first, then 90, + # then 77 or older compilers, gnu is always last in the group, + # so if you paid for a compiler it is picked by default. + set(CMAKE_Fortran_COMPILER_LIST + ifort ifc af95 af90 efc f95 pathf2003 pathf95 pgf95 pgfortran lf95 xlf95 + fort gfortran gfortran-4 g95 f90 pathf90 pgf90 xlf90 epcf90 fort77 + frt pgf77 xlf fl32 af77 g77 f77 + ) + + # Vendor-specific compiler names. + set(_Fortran_COMPILER_NAMES_GNU gfortran gfortran-4 g95 g77) + set(_Fortran_COMPILER_NAMES_Intel ifort ifc efc) + set(_Fortran_COMPILER_NAMES_Absoft af95 af90 af77) + set(_Fortran_COMPILER_NAMES_PGI pgf95 pgfortran pgf90 pgf77) + set(_Fortran_COMPILER_NAMES_PathScale pathf2003 pathf95 pathf90) + set(_Fortran_COMPILER_NAMES_XL xlf) + set(_Fortran_COMPILER_NAMES_VisualAge xlf95 xlf90 xlf) + endif() + + _cmake_find_compiler(Fortran) + + else() + # we only get here if CMAKE_Fortran_COMPILER was specified using -D or a pre-made CMakeCache.txt + # (e.g. via ctest) or set in CMAKE_TOOLCHAIN_FILE + # if CMAKE_Fortran_COMPILER is a list of length 2, use the first item as + # CMAKE_Fortran_COMPILER and the 2nd one as CMAKE_Fortran_COMPILER_ARG1 + + list(LENGTH CMAKE_Fortran_COMPILER _CMAKE_Fortran_COMPILER_LIST_LENGTH) + if("${_CMAKE_Fortran_COMPILER_LIST_LENGTH}" EQUAL 2) + list(GET CMAKE_Fortran_COMPILER 1 CMAKE_Fortran_COMPILER_ARG1) + list(GET CMAKE_Fortran_COMPILER 0 CMAKE_Fortran_COMPILER) + endif() + + # if a compiler was specified by the user but without path, + # now try to find it with the full path + # if it is found, force it into the cache, + # if not, don't overwrite the setting (which was given by the user) with "NOTFOUND" + # if the C compiler already had a path, reuse it for searching the CXX compiler + get_filename_component(_CMAKE_USER_Fortran_COMPILER_PATH "${CMAKE_Fortran_COMPILER}" PATH) + if(NOT _CMAKE_USER_Fortran_COMPILER_PATH) + find_program(CMAKE_Fortran_COMPILER_WITH_PATH NAMES ${CMAKE_Fortran_COMPILER}) + mark_as_advanced(CMAKE_Fortran_COMPILER_WITH_PATH) + if(CMAKE_Fortran_COMPILER_WITH_PATH) + set(CMAKE_Fortran_COMPILER ${CMAKE_Fortran_COMPILER_WITH_PATH} + CACHE STRING "Fortran compiler" FORCE) + endif() + endif() + endif() + mark_as_advanced(CMAKE_Fortran_COMPILER) # Each entry in this list is a set of extra flags to try # adding to the compile line to see if it helps produce @@ -135,6 +130,11 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) # Intel on windows does not preprocess by default. "-fpp" ) +endif() + +# Build a small source file to identify the compiler. +if(NOT CMAKE_Fortran_COMPILER_ID_RUN) + set(CMAKE_Fortran_COMPILER_ID_RUN 1) # Table of per-vendor compiler id flags with expected output. list(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) From 9a9e1ee98d59ba1ed2a89a2858224a7f8a92bbf6 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Aug 2012 16:12:05 -0400 Subject: [PATCH 043/152] CMakeDetermineCompilerId: Prepare to detect IDE compiler id Teach CMAKE_DETERMINE_COMPILER_ID to check for variable CMAKE_${lang}_COMPILER_ID_TOOL after CMAKE_DETERMINE_COMPILER_ID_BUILD to use as CMAKE_${lang}_COMPILER since it will not be known until after the IDE runs. In CMAKE_DETERMINE_COMPILER_ID_BUILD prepare a cascading "if" so we can use a generator-specific method to compile the identification source file. Leave "if(0)" as a placeholder for now and put the direct compiler invocation in "else()". After running the compiler to build the compiler identification source we file(GLOB) the list of output files as candidates for extracting the compiler information. An IDE may create directories, so exclude exclude directories from this list. --- Modules/CMakeDetermineCompilerId.cmake | 70 ++++++++++++++++---------- 1 file changed, 43 insertions(+), 27 deletions(-) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index f574978d7..f4b9bb020 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -66,6 +66,15 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) message(STATUS "The ${lang} compiler identification is unknown") endif() + # Check if compiler id detection gave us the compiler tool. + if(NOT CMAKE_${lang}_COMPILER) + if(CMAKE_${lang}_COMPILER_ID_TOOL) + set(CMAKE_${lang}_COMPILER "${CMAKE_${lang}_COMPILER_ID_TOOL}" PARENT_SCOPE) + else() + set(CMAKE_${lang}_COMPILER "CMAKE_${lang}_COMPILER-NOTFOUND" PARENT_SCOPE) + endif() + endif() + set(CMAKE_${lang}_COMPILER_ID "${CMAKE_${lang}_COMPILER_ID}" PARENT_SCOPE) set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" @@ -98,28 +107,31 @@ Id flags: ${testflags} ") # Compile the compiler identification source. - if(COMMAND EXECUTE_PROCESS) - execute_process( - COMMAND ${CMAKE_${lang}_COMPILER} - ${CMAKE_${lang}_COMPILER_ID_ARG1} - ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} - ${testflags} - "${src}" - WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} - OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT - ) + if(0) else() - exec_program( - ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR} - ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1} - ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} - ${testflags} - \"${src}\" - OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT - ) + if(COMMAND EXECUTE_PROCESS) + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + "${src}" + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT + ) + else() + exec_program( + ${CMAKE_${lang}_COMPILER} ${CMAKE_${lang}_COMPILER_ID_DIR} + ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + \"${src}\" + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT + ) + endif() endif() # Check the result of compilation. @@ -153,14 +165,18 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT} # Find the executable produced by the compiler, try all files in the # binary dir. - file(GLOB COMPILER_${lang}_PRODUCED_FILES + file(GLOB files RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR} ${CMAKE_${lang}_COMPILER_ID_DIR}/*) - list(REMOVE_ITEM COMPILER_${lang}_PRODUCED_FILES "${src}") - foreach(file ${COMPILER_${lang}_PRODUCED_FILES}) - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Compilation of the ${lang} compiler identification source \"" - "${src}\" produced \"${file}\"\n\n") + list(REMOVE_ITEM files "${src}") + set(COMPILER_${lang}_PRODUCED_FILES "") + foreach(file ${files}) + if(NOT IS_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}/${file}) + list(APPEND COMPILER_${lang}_PRODUCED_FILES ${file}) + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Compilation of the ${lang} compiler identification source \"" + "${src}\" produced \"${file}\"\n\n") + endif() endforeach() if(NOT COMPILER_${lang}_PRODUCED_FILES) From 965a69dcaa0b67c730f45487abeee97ef652d545 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 15 Aug 2012 16:21:50 -0400 Subject: [PATCH 044/152] Xcode: Detect the compiler id and tool location Configure a hand-generated Xcode project to build the compiler id source file since we cannot run the compiler command-line tool directly. Add a post-build shell script phase to print out the compiler toolset build setting. Run xcodebuild to compile the identification binary. Parse the full path to the compiler tool from the xcodebuild output. --- Modules/CMakeDetermineCCompiler.cmake | 2 + Modules/CMakeDetermineCXXCompiler.cmake | 2 + Modules/CMakeDetermineCompilerId.cmake | 36 +++++- Modules/CMakeDetermineFortranCompiler.cmake | 2 + Modules/CompilerId/Xcode-1.pbxproj.in | 120 ++++++++++++++++++++ Modules/CompilerId/Xcode-2.pbxproj.in | 119 +++++++++++++++++++ Modules/CompilerId/Xcode-3.pbxproj.in | 107 +++++++++++++++++ 7 files changed, 387 insertions(+), 1 deletion(-) create mode 100644 Modules/CompilerId/Xcode-1.pbxproj.in create mode 100644 Modules/CompilerId/Xcode-2.pbxproj.in create mode 100644 Modules/CompilerId/Xcode-3.pbxproj.in diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 3ce1a36da..7f0ffee35 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -44,6 +44,8 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio") set(CMAKE_C_PLATFORM_ID "Windows") set(CMAKE_C_COMPILER_ID "MSVC") set(CMAKE_C_COMPILER "${CMAKE_GENERATOR_CC}") +elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c) else() if(NOT CMAKE_C_COMPILER) set(CMAKE_C_COMPILER_INIT NOTFOUND) diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 6ed2c68f6..110fcb184 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -43,6 +43,8 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio") set(CMAKE_CXX_PLATFORM_ID "Windows") set(CMAKE_CXX_COMPILER_ID "MSVC") set(CMAKE_CXX_COMPILER "${CMAKE_GENERATOR_CXX}") +elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp) else() if(NOT CMAKE_CXX_COMPILER) set(CMAKE_CXX_COMPILER_INIT NOTFOUND) diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index f4b9bb020..d0c1ea576 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -107,7 +107,41 @@ Id flags: ${testflags} ") # Compile the compiler identification source. - if(0) + if("${CMAKE_GENERATOR}" MATCHES "Xcode") + set(id_lang "${lang}") + set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE}) + set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) + get_filename_component(id_src "${src}" NAME) + if(NOT ${XCODE_VERSION} VERSION_LESS 3) + set(v 3) + set(ext xcodeproj) + elseif(NOT ${XCODE_VERSION} VERSION_LESS 2) + set(v 2) + set(ext xcodeproj) + else() + set(v 1) + set(ext xcode) + endif() + configure_file(${CMAKE_ROOT}/Modules/CompilerId/Xcode-${v}.pbxproj.in + ${id_dir}/CompilerId${lang}.${ext}/project.pbxproj @ONLY IMMEDIATE) + execute_process(COMMAND xcodebuild + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT + ) + + # Match the link line from xcodebuild output of the form + # Ld ... + # ... + # /path/to/cc ...CompilerId${lang}/... + # to extract the compiler front-end for the language. + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/\\./CompilerId${lang}[ \t\n\\\"]") + set(_comp "${CMAKE_MATCH_2}") + if(EXISTS "${_comp}") + set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) + endif() + endif() else() if(COMMAND EXECUTE_PROCESS) execute_process( diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 5bd514a20..45213b953 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -30,6 +30,8 @@ if(${CMAKE_GENERATOR} MATCHES "Visual Studio") set(CMAKE_Fortran_PLATFORM_ID "Windows") set(CMAKE_Fortran_COMPILER_ID "Intel") set(CMAKE_Fortran_COMPILER "${CMAKE_GENERATOR_FC}") +elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") + set(CMAKE_Fortran_COMPILER_XCODE_TYPE sourcecode.fortran.f90) else() if(NOT CMAKE_Fortran_COMPILER) # prefer the environment variable CC diff --git a/Modules/CompilerId/Xcode-1.pbxproj.in b/Modules/CompilerId/Xcode-1.pbxproj.in new file mode 100644 index 000000000..f06960fec --- /dev/null +++ b/Modules/CompilerId/Xcode-1.pbxproj.in @@ -0,0 +1,120 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 39; + objects = { + 014CEA460018CE2711CA2923 = { + buildSettings = { + }; + isa = PBXBuildStyle; + name = Development; + }; + 08FB7793FE84155DC02AAC07 = { + buildSettings = { + }; + buildStyles = ( + 014CEA460018CE2711CA2923, + ); + hasScannedForEncodings = 1; + isa = PBXProject; + mainGroup = 08FB7794FE84155DC02AAC07; + projectDirPath = ""; + targets = ( + 8DD76FA90486AB0100D96B5E, + ); + }; + 08FB7794FE84155DC02AAC07 = { + children = ( + 08FB7795FE84155DC02AAC07, + 1AB674ADFE9D54B511CA2CBB, + ); + isa = PBXGroup; + name = CompilerId@id_lang@; + refType = 4; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 = { + children = ( + 2C18F0B415DC1DC700593670, + ); + isa = PBXGroup; + name = Source; + refType = 4; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB = { + children = ( + 8DD76F6C0486A84900D96B5E, + ); + isa = PBXGroup; + name = Products; + refType = 4; + sourceTree = ""; + }; + 2C18F0B415DC1DC700593670 = { + fileEncoding = 30; + isa = PBXFileReference; + lastKnownFileType = @id_type@; + path = @id_src@; + refType = 4; + sourceTree = ""; + }; + 2C18F0B615DC1E0300593670 = { + fileRef = 2C18F0B415DC1DC700593670; + isa = PBXBuildFile; + settings = { + }; + }; + 2C8FEB8E15DC1A1A00E56A5D = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; + }; + 8DD76FA90486AB0100D96B5E = { + buildPhases = ( + 2C18F0B515DC1DCE00593670, + 2C8FEB8E15DC1A1A00E56A5D, + ); + buildRules = ( + ); + buildSettings = { + PRODUCT_NAME = CompilerId@id_lang@; + SYMROOT = .; + }; + dependencies = ( + ); + isa = PBXNativeTarget; + name = CompilerId@id_lang@; + productName = CompilerId@id_lang@; + productReference = 8DD76F6C0486A84900D96B5E; + productType = "com.apple.product-type.tool"; + }; + 2C18F0B515DC1DCE00593670 = { + buildActionMask = 2147483647; + files = ( + 2C18F0B615DC1E0300593670, + ); + isa = PBXSourcesBuildPhase; + runOnlyForDeploymentPostprocessing = 0; + }; + 8DD76F6C0486A84900D96B5E = { + explicitFileType = "compiled.mach-o.executable"; + includeInIndex = 0; + isa = PBXFileReference; + path = CompilerId@id_lang@; + refType = 3; + sourceTree = BUILT_PRODUCTS_DIR; + }; + }; + rootObject = 08FB7793FE84155DC02AAC07; +} diff --git a/Modules/CompilerId/Xcode-2.pbxproj.in b/Modules/CompilerId/Xcode-2.pbxproj.in new file mode 100644 index 000000000..e3c7aa910 --- /dev/null +++ b/Modules/CompilerId/Xcode-2.pbxproj.in @@ -0,0 +1,119 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 42; + objects = { + + 2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; }; + 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = ""; }; + 8DD76F6C0486A84900D96B5E = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = CompilerId@id_lang@; sourceTree = BUILT_PRODUCTS_DIR; }; + + 08FB7794FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 08FB7795FE84155DC02AAC07, + 1AB674ADFE9D54B511CA2CBB, + ); + name = CompilerId@id_lang@; + sourceTree = ""; + }; + 08FB7795FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 2C18F0B415DC1DC700593670, + ); + name = Source; + sourceTree = ""; + }; + 1AB674ADFE9D54B511CA2CBB = { + isa = PBXGroup; + children = ( + 8DD76F6C0486A84900D96B5E, + ); + name = Products; + sourceTree = ""; + }; + + 8DD76FA90486AB0100D96B5E = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB928508733DD80010E9CD; + buildPhases = ( + 2C18F0B515DC1DCE00593670, + 2C8FEB8E15DC1A1A00E56A5D, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CompilerId@id_lang@; + productName = CompilerId@id_lang@; + productReference = 8DD76F6C0486A84900D96B5E; + productType = "com.apple.product-type.tool"; + }; + 08FB7793FE84155DC02AAC07 = { + isa = PBXProject; + buildConfigurationList = 1DEB928908733DD80010E9CD; + hasScannedForEncodings = 1; + mainGroup = 08FB7794FE84155DC02AAC07; + projectDirPath = ""; + targets = ( + 8DD76FA90486AB0100D96B5E, + ); + }; + 2C8FEB8E15DC1A1A00E56A5D = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; + }; + 2C18F0B515DC1DCE00593670 = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2C18F0B615DC1E0300593670, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1DEB928608733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = CompilerId@id_lang@; + }; + name = Debug; + }; + 1DEB928A08733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + SYMROOT = .; + }; + name = Debug; + }; + 1DEB928508733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928608733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1DEB928908733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928A08733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + }; + rootObject = 08FB7793FE84155DC02AAC07; +} diff --git a/Modules/CompilerId/Xcode-3.pbxproj.in b/Modules/CompilerId/Xcode-3.pbxproj.in new file mode 100644 index 000000000..41ca7db72 --- /dev/null +++ b/Modules/CompilerId/Xcode-3.pbxproj.in @@ -0,0 +1,107 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 45; + objects = { + + 2C18F0B615DC1E0300593670 = {isa = PBXBuildFile; fileRef = 2C18F0B415DC1DC700593670; }; + 2C18F0B415DC1DC700593670 = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = @id_type@; path = @id_src@; sourceTree = ""; }; + 08FB7794FE84155DC02AAC07 = { + isa = PBXGroup; + children = ( + 2C18F0B415DC1DC700593670, + ); + name = CompilerId@id_lang@; + sourceTree = ""; + }; + 8DD76FA90486AB0100D96B5E = { + isa = PBXNativeTarget; + buildConfigurationList = 1DEB928508733DD80010E9CD; + buildPhases = ( + 2C18F0B515DC1DCE00593670, + 2C8FEB8E15DC1A1A00E56A5D, + ); + buildRules = ( + ); + dependencies = ( + ); + name = CompilerId@id_lang@; + productName = CompilerId@id_lang@; + productType = "com.apple.product-type.tool"; + }; + 08FB7793FE84155DC02AAC07 = { + isa = PBXProject; + buildConfigurationList = 1DEB928908733DD80010E9CD; + compatibilityVersion = "Xcode 3.1"; + developmentRegion = English; + hasScannedForEncodings = 1; + knownRegions = ( + en, + ); + mainGroup = 08FB7794FE84155DC02AAC07; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 8DD76FA90486AB0100D96B5E, + ); + }; + 2C8FEB8E15DC1A1A00E56A5D = { + isa = PBXShellScriptBuildPhase; + buildActionMask = 2147483647; + files = ( + ); + inputPaths = ( + ); + outputPaths = ( + ); + runOnlyForDeploymentPostprocessing = 0; + shellPath = /bin/sh; + shellScript = "echo \"GCC_VERSION=$GCC_VERSION\""; + showEnvVarsInLog = 0; + }; + 2C18F0B515DC1DCE00593670 = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 2C18F0B615DC1E0300593670, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 1DEB928608733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + PRODUCT_NAME = CompilerId@id_lang@; + }; + name = Debug; + }; + 1DEB928A08733DD80010E9CD = { + isa = XCBuildConfiguration; + buildSettings = { + ARCHS = "$(ARCHS_STANDARD_32_BIT)"; + ONLY_ACTIVE_ARCH = YES; + CONFIGURATION_BUILD_DIR = "$(BUILD_DIR)"; + SYMROOT = .; + }; + name = Debug; + }; + 1DEB928508733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928608733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + 1DEB928908733DD80010E9CD = { + isa = XCConfigurationList; + buildConfigurations = ( + 1DEB928A08733DD80010E9CD, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Debug; + }; + }; + rootObject = 08FB7793FE84155DC02AAC07; +} From 89595d6bceb25ecfa221342f03d1c3dce70c8484 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Aug 2012 16:20:34 -0400 Subject: [PATCH 045/152] VS10: Define CMAKE_VS_PLATFORM_TOOLSET variable When the VS 10 generator selects a non-default PlatformToolset to specify for MSBuild, report the selected name in this variable. --- Source/cmDocumentVariables.cxx | 10 ++++++++++ Source/cmGlobalVisualStudio10Generator.cxx | 11 +++++++++++ Source/cmGlobalVisualStudio10Generator.h | 1 + 3 files changed, 22 insertions(+) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 05ef8fc71..376b9478e 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -282,6 +282,16 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This variable is around for backwards compatibility, " "see CMAKE_BUILD_TOOL.",false, "Variables that Provide Information"); + cm->DefineProperty + ("CMAKE_VS_PLATFORM_TOOLSET", cmProperty::VARIABLE, + "Visual Studio Platform Toolset name.", + "VS 10 and above use MSBuild under the hood and support multiple " + "compiler toolchains. " + "CMake may specify a toolset explicitly, such as \"v110\" for " + "VS 11 or \"Windows7.1SDK\" for 64-bit support in VS 10 Express. " + "CMake provides the name of the chosen toolset in this variable." + ,false, + "Variables that Provide Information"); cm->DefineProperty ("CMAKE_MINOR_VERSION", cmProperty::VARIABLE, "The Minor version of cmake (i.e. the 4 in X.4.X).", diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index b44b78031..39c9ae1c3 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -27,6 +27,17 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() "ProductDir", vc10Express, cmSystemTools::KeyWOW64_32); } +//---------------------------------------------------------------------------- +void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf) +{ + cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf); + if(!this->PlatformToolset.empty()) + { + mf->AddDefinition("CMAKE_VS_PLATFORM_TOOLSET", + this->PlatformToolset.c_str()); + } +} + //---------------------------------------------------------------------------- void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) { diff --git a/Source/cmGlobalVisualStudio10Generator.h b/Source/cmGlobalVisualStudio10Generator.h index a4a9d401f..47ce790f8 100644 --- a/Source/cmGlobalVisualStudio10Generator.h +++ b/Source/cmGlobalVisualStudio10Generator.h @@ -38,6 +38,7 @@ public: virtual const char* GetName() const { return cmGlobalVisualStudio10Generator::GetActualName();} static const char* GetActualName() {return "Visual Studio 10";} + virtual void AddPlatformDefinitions(cmMakefile* mf); /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; From 66cb3356f508da309d599f6148763f7afe3802e1 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 16 Aug 2012 16:23:16 -0400 Subject: [PATCH 046/152] VS: Detect the compiler id and tool location Configure a hand-generated Visual Studio project to build the compiler id source file since we cannot run the compiler command-line tool directly. Add a post-build command to print out the full path to the compiler tool. Parse the full path to the compiler tool from the build output. --- Modules/CMakeDetermineCCompiler.cmake | 4 -- Modules/CMakeDetermineCXXCompiler.cmake | 4 -- Modules/CMakeDetermineCompilerId.cmake | 63 ++++++++++++++++++++++++- Modules/CompilerId/VS-10.vcxproj.in | 53 +++++++++++++++++++++ Modules/CompilerId/VS-6.dsp.in | 48 +++++++++++++++++++ Modules/CompilerId/VS-7.vcproj.in | 60 +++++++++++++++++++++++ 6 files changed, 223 insertions(+), 9 deletions(-) create mode 100644 Modules/CompilerId/VS-10.vcxproj.in create mode 100644 Modules/CompilerId/VS-6.dsp.in create mode 100644 Modules/CompilerId/VS-7.vcproj.in diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 7f0ffee35..01859b60b 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -40,10 +40,6 @@ if(NOT CMAKE_C_COMPILER_NAMES) endif() if(${CMAKE_GENERATOR} MATCHES "Visual Studio") - set(CMAKE_C_COMPILER_ID_RUN 1) - set(CMAKE_C_PLATFORM_ID "Windows") - set(CMAKE_C_COMPILER_ID "MSVC") - set(CMAKE_C_COMPILER "${CMAKE_GENERATOR_CC}") elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") set(CMAKE_C_COMPILER_XCODE_TYPE sourcecode.c.c) else() diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 110fcb184..3f97b40c7 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -39,10 +39,6 @@ if(NOT CMAKE_CXX_COMPILER_NAMES) endif() if(${CMAKE_GENERATOR} MATCHES "Visual Studio") - set(CMAKE_CXX_COMPILER_ID_RUN 1) - set(CMAKE_CXX_PLATFORM_ID "Windows") - set(CMAKE_CXX_COMPILER_ID "MSVC") - set(CMAKE_CXX_COMPILER "${CMAKE_GENERATOR_CXX}") elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") set(CMAKE_CXX_COMPILER_XCODE_TYPE sourcecode.cpp.cpp) else() diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index d0c1ea576..bd88c3ff2 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -107,7 +107,68 @@ Id flags: ${testflags} ") # Compile the compiler identification source. - if("${CMAKE_GENERATOR}" MATCHES "Xcode") + if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)( .NET)?( 200[358])? *((Win64|IA64|ARM))?") + set(vs_version ${CMAKE_MATCH_1}) + set(vs_arch ${CMAKE_MATCH_4}) + set(id_lang "${lang}") + set(id_cl cl.exe) + if(NOT "${vs_version}" VERSION_LESS 10) + set(v 10) + set(ext vcxproj) + elseif(NOT "${vs_version}" VERSION_LESS 7) + set(id_version ${vs_version}.00) + set(v 7) + set(ext vcproj) + else() + set(v 6) + set(ext dsp) + endif() + if("${vs_arch}" STREQUAL "Win64") + set(id_machine_7 17) + set(id_machine_10 MachineX64) + set(id_arch x64) + elseif("${vs_arch}" STREQUAL "IA64") + set(id_machine_7 5) + set(id_machine_10 MachineIA64) + set(id_arch ia64) + else() + set(id_machine_6 x86) + set(id_machine_7 1) + set(id_machine_10 MachineX86) + set(id_arch Win32) + endif() + if(CMAKE_VS_PLATFORM_TOOLSET) + set(id_toolset "${CMAKE_VS_PLATFORM_TOOLSET}") + else() + set(id_toolset "") + endif() + if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]") + set(build /p:Configuration=Debug /p:Platform=@id_arch@) + elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]") + set(build /make) + else() + set(build /build Debug) + endif() + set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) + get_filename_component(id_src "${src}" NAME) + configure_file(${CMAKE_ROOT}/Modules/CompilerId/VS-${v}.${ext}.in + ${id_dir}/CompilerId${lang}.${ext} @ONLY IMMEDIATE) + execute_process( + COMMAND ${CMAKE_MAKE_PROGRAM} CompilerId${lang}.${ext} ${build} + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT + ) + # Match the compiler location line printed out. + if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "CMAKE_${lang}_COMPILER=([^%\r\n]+)[\r\n]") + set(_comp "${CMAKE_MATCH_1}") + if(EXISTS "${_comp}") + file(TO_CMAKE_PATH "${_comp}" _comp) + set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE) + endif() + endif() + elseif("${CMAKE_GENERATOR}" MATCHES "Xcode") set(id_lang "${lang}") set(id_type ${CMAKE_${lang}_COMPILER_XCODE_TYPE}) set(id_dir ${CMAKE_${lang}_COMPILER_ID_DIR}) diff --git a/Modules/CompilerId/VS-10.vcxproj.in b/Modules/CompilerId/VS-10.vcxproj.in new file mode 100644 index 000000000..ab4705fa3 --- /dev/null +++ b/Modules/CompilerId/VS-10.vcxproj.in @@ -0,0 +1,53 @@ + + + + + Debug + @id_arch@ + + + + {CAE07175-D007-4FC3-BFE8-47B392814159} + CompilerId@id_lang@ + Win32Proj + + + + Application + @id_toolset@ + MultiByte + + + + <_ProjectFileVersion>10.0.30319.1 + .\ + $(Configuration)\ + false + + + + Disabled + %(PreprocessorDefinitions) + false + EnableFastChecks + MultiThreadedDebugDLL + + + TurnOffAllWarnings + + + + + false + Console + @id_machine_10@ + + + for %%i in (@id_cl@) do %40echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i + + + + + + + diff --git a/Modules/CompilerId/VS-6.dsp.in b/Modules/CompilerId/VS-6.dsp.in new file mode 100644 index 000000000..4f7e67613 --- /dev/null +++ b/Modules/CompilerId/VS-6.dsp.in @@ -0,0 +1,48 @@ +# Microsoft Developer Studio Project File - Name="CompilerId@id_lang@" - Package Owner=<4> +# Microsoft Developer Studio Generated Build File, Format Version 6.00 + +# TARGTYPE "Win32 (@id_machine_6@) Application" 0x0101 + +CFG=CompilerId@id_lang@ - Win32 Debug +!MESSAGE This is not a valid makefile. To build this project using NMAKE, +!MESSAGE use the Export Makefile command and run +!MESSAGE +!MESSAGE NMAKE /f "CompilerId@id_lang@.mak". +!MESSAGE +!MESSAGE You can specify a configuration when running NMAKE +!MESSAGE by defining the macro CFG on the command line. For example: +!MESSAGE +!MESSAGE NMAKE /f "CompilerId@id_lang@.mak" CFG="CompilerId@id_lang@ - Win32 Debug" +!MESSAGE +!MESSAGE Possible choices for configuration are: +!MESSAGE +!MESSAGE "CompilerId@id_lang@ - Win32 Debug" (based on "Win32 (@id_machine_6@) Application") +!MESSAGE + +# Begin Project +# PROP AllowPerConfigDependencies 0 +CPP=cl.exe +# PROP Use_MFC 0 +# PROP Use_Debug_Libraries 1 +# PROP Output_Dir "." +# PROP Intermediate_Dir "Debug" +# PROP Target_Dir "" +# ADD CPP /nologo /MDd /c +LINK32=link.exe +# ADD LINK32 /nologo /version:0.0 /subsystem:console /machine:@id_machine_6@ /out:"CompilerId@id_lang@.exe" /IGNORE:4089 +# Begin Special Build Tool +SOURCE="$(InputPath)" +PostBuild_Cmds=for %%i in (@id_cl@) do @echo CMAKE_@id_lang@_COMPILER=%%~$PATH:i +# End Special Build Tool +# Begin Target + +# Name "CompilerId@id_lang@ - Win32 Debug" +# Begin Group "Source Files" + +# Begin Source File + +SOURCE="@id_src@" +# End Source File +# End Group +# End Target +# End Project diff --git a/Modules/CompilerId/VS-7.vcproj.in b/Modules/CompilerId/VS-7.vcproj.in new file mode 100644 index 000000000..71bf64de2 --- /dev/null +++ b/Modules/CompilerId/VS-7.vcproj.in @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + From 8be51f6694184fb9044389fb1e18ad1765f6476c Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Aug 2012 13:30:50 -0400 Subject: [PATCH 047/152] Test variables CMAKE_(C|CXX|Fortran)_COMPILER(|_ID|_VERSION) Add tests CMakeOnly.CompilerId(C|CXX|Fortran) to check that the basic compiler tool path, vendor, and version variables have been set as expected. --- Tests/CMakeOnly/CMakeLists.txt | 6 +++++ Tests/CMakeOnly/CompilerIdC/CMakeLists.txt | 14 ++++++++++++ Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt | 14 ++++++++++++ .../CompilerIdFortran/CMakeLists.txt | 22 +++++++++++++++++++ 4 files changed, 56 insertions(+) create mode 100644 Tests/CMakeOnly/CompilerIdC/CMakeLists.txt create mode 100644 Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt create mode 100644 Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt diff --git a/Tests/CMakeOnly/CMakeLists.txt b/Tests/CMakeOnly/CMakeLists.txt index 6fe91c781..ba681d8ac 100644 --- a/Tests/CMakeOnly/CMakeLists.txt +++ b/Tests/CMakeOnly/CMakeLists.txt @@ -19,6 +19,12 @@ add_CMakeOnly_test(CheckCXXCompilerFlag) add_CMakeOnly_test(CheckLanguage) +add_CMakeOnly_test(CompilerIdC) +add_CMakeOnly_test(CompilerIdCXX) +if(CMAKE_Fortran_COMPILER) + add_CMakeOnly_test(CompilerIdFortran) +endif() + add_CMakeOnly_test(AllFindModules) add_CMakeOnly_test(TargetScope) diff --git a/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt new file mode 100644 index 000000000..848ffdd36 --- /dev/null +++ b/Tests/CMakeOnly/CompilerIdC/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CompilerIdC C) + +foreach(v + CMAKE_C_COMPILER + CMAKE_C_COMPILER_ID + CMAKE_C_COMPILER_VERSION + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(SEND_ERROR "${v} not set!") + endif() +endforeach() diff --git a/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt new file mode 100644 index 000000000..94ac31e4c --- /dev/null +++ b/Tests/CMakeOnly/CompilerIdCXX/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CompilerIdCXX CXX) + +foreach(v + CMAKE_CXX_COMPILER + CMAKE_CXX_COMPILER_ID + CMAKE_CXX_COMPILER_VERSION + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(SEND_ERROR "${v} not set!") + endif() +endforeach() diff --git a/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt new file mode 100644 index 000000000..3a2bdebd6 --- /dev/null +++ b/Tests/CMakeOnly/CompilerIdFortran/CMakeLists.txt @@ -0,0 +1,22 @@ +cmake_minimum_required(VERSION 2.8.9) +project(CompilerIdFortran Fortran) + +foreach(v + CMAKE_Fortran_COMPILER + CMAKE_Fortran_COMPILER_ID + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(SEND_ERROR "${v} not set!") + endif() +endforeach() +foreach(v + CMAKE_Fortran_COMPILER_VERSION + ) + if(${v}) + message(STATUS "${v}=[${${v}}]") + else() + message(WARNING "${v} not set!") + endif() +endforeach() From ec22a9b5217c2110db9af1791a61a7552144f028 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Aug 2012 10:59:48 -0400 Subject: [PATCH 048/152] Cleanly enable a language in multiple subdirectories When a language is not enabled at the top level of a project but is enabled in multiple disjoint subdirectories we should re-use the CMakeCompiler.cmake file from the first directory. Load the file whenever it exists and is not left from a different version of CMake. --- Source/cmGlobalGenerator.cxx | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index a47ca3677..52b451cd0 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -376,22 +376,24 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, std::string loadedLang = "CMAKE_"; loadedLang += lang; loadedLang += "_COMPILER_LOADED"; - // If the existing build tree was already configured with this - // version of CMake then try to load the configured file first - // to avoid duplicate compiler tests. - unsigned int cacheMajor = mf->GetCacheMajorVersion(); - unsigned int cacheMinor = mf->GetCacheMinorVersion(); - unsigned int selfMajor = cmVersion::GetMajorVersion(); - unsigned int selfMinor = cmVersion::GetMinorVersion(); - if((this->CMakeInstance->GetIsInTryCompile() || - (selfMajor == cacheMajor && selfMinor == cacheMinor)) - && !mf->GetDefinition(loadedLang.c_str())) + if(!mf->GetDefinition(loadedLang.c_str())) { fpath = rootBin; fpath += "/CMake"; fpath += lang; fpath += "Compiler.cmake"; - if(cmSystemTools::FileExists(fpath.c_str())) + + // If the existing build tree was already configured with this + // version of CMake then try to load the configured file first + // to avoid duplicate compiler tests. + unsigned int cacheMajor = mf->GetCacheMajorVersion(); + unsigned int cacheMinor = mf->GetCacheMinorVersion(); + unsigned int selfMajor = cmVersion::GetMajorVersion(); + unsigned int selfMinor = cmVersion::GetMinorVersion(); + if((this->CMakeInstance->GetIsInTryCompile() || + (cacheMajor == 0 && cacheMinor == 0) || + (selfMajor == cacheMajor && selfMinor == cacheMinor)) && + cmSystemTools::FileExists(fpath.c_str())) { if(!mf->ReadListFile(0,fpath.c_str())) { From 403ead65947751697dc17021b639caa12c6ac74a Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 21 Aug 2012 14:18:35 -0400 Subject: [PATCH 049/152] Document CMAKE__COMPILER_(ID|VERSION) values These values are now available almost everywhere and are tested. Document them for general use and list possible ID values. --- Source/cmDocumentVariables.cxx | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index 376b9478e..ade35e616 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -1391,8 +1391,30 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE__COMPILER_ID", cmProperty::VARIABLE, - "An internal variable subject to change.", - "This is used in determining the compiler and is subject to change.", + "Compiler identification string.", + "A short string unique to the compiler vendor. " + "Possible values include:\n" + " Absoft = Absoft Fortran (absoft.com)\n" + " ADSP = Analog VisualDSP++ (analog.com)\n" + " Clang = LLVM Clang (clang.llvm.org)\n" + " Cray = Cray Compiler (cray.com)\n" + " Embarcadero, Borland = Embarcadero (embarcadero.com)\n" + " G95 = G95 Fortran (g95.org)\n" + " GNU = GNU Compiler Collection (gcc.gnu.org)\n" + " HP = Hewlett-Packard Compiler (hp.com)\n" + " Intel = Intel Compiler (intel.com)\n" + " MIPSpro = SGI MIPSpro (sgi.com)\n" + " MSVC = Microsoft Visual Studio (microsoft.com)\n" + " PGI = The Portland Group (pgroup.com)\n" + " PathScale = PathScale (pathscale.com)\n" + " SDCC = Small Device C Compiler (sdcc.sourceforge.net)\n" + " SunPro = Oracle Solaris Studio (oracle.com)\n" + " TI_DSP = Texas Instruments (ti.com)\n" + " TinyCC = Tiny C Compiler (tinycc.org)\n" + " Watcom = Open Watcom (openwatcom.org)\n" + " XL, VisualAge, zOS = IBM XL (ibm.com)\n" + "This variable is not guaranteed to be defined for all " + "compilers or languages.", false, "Variables for Languages"); @@ -1412,10 +1434,10 @@ void cmDocumentVariables::DefineVariables(cmake* cm) cm->DefineProperty ("CMAKE__COMPILER_VERSION", cmProperty::VARIABLE, - "An internal variable subject to change.", + "Compiler version string.", "Compiler version in major[.minor[.patch[.tweak]]] format. " - "This variable is reserved for internal use by CMake and is not " - "guaranteed to be set.", + "This variable is not guaranteed to be defined for all " + "compilers or languages.", false, "Variables for Languages"); From 8c64702c97a21d702021b2a095b5f9b0f79c9ef6 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 23 Aug 2012 00:01:03 -0400 Subject: [PATCH 050/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index cda0163aa..eb1e6ac7d 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 9) -set(CMake_VERSION_TWEAK 20120822) +set(CMake_VERSION_TWEAK 20120823) #set(CMake_VERSION_RC 1) From 32db033b2713d40899865a06f03d83373078eaa3 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 23 Aug 2012 10:48:16 -0400 Subject: [PATCH 051/152] VS: Remove support for "free" version 2003 tools Several more recent Visual Studio Express editions are now available and they support debug builds. Simplify our VS platform files by removing support for these old tools. If anyone still uses them we can restore support with a more modern way to test for them. --- Modules/CMakeTestForFreeVC.cxx | 3 -- Modules/Platform/Windows-cl.cmake | 67 +++++----------------------- Modules/Platform/Windows-cl.cmake.in | 1 - Source/cmDocumentVariables.cxx | 6 --- 4 files changed, 11 insertions(+), 66 deletions(-) delete mode 100644 Modules/CMakeTestForFreeVC.cxx diff --git a/Modules/CMakeTestForFreeVC.cxx b/Modules/CMakeTestForFreeVC.cxx deleted file mode 100644 index e580c1f6b..000000000 --- a/Modules/CMakeTestForFreeVC.cxx +++ /dev/null @@ -1,3 +0,0 @@ -#include - -int main(){return 0;} diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 05df9467a..265f5559a 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -30,8 +30,6 @@ set(CMAKE_COMPILE_RESOURCE "rc /fo ") # for nmake we need to compute some information about the compiler # that is being used. -# the compiler may be free command line, 6, 7, or 71, and -# each have properties that must be determined. # to avoid running these tests with each cmake run, the # test results are saved in CMakeCPlatform.cmake, a file # that is automatically copied into try_compile directories @@ -96,34 +94,6 @@ if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") "Determining the version of compiler failed with the following output:\n" "${CMAKE_COMPILER_OUTPUT}\n\n") endif() - # try to figure out if we are running the free command line - # tools from Microsoft. These tools do not provide debug libraries, - # so the link flags used have to be different. - make_directory("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2") - set(testForFreeVCFile - "${CMAKE_ROOT}/Modules/CMakeTestForFreeVC.cxx") - string(REGEX REPLACE "/" "\\\\" testForFreeVCFile "${testForFreeVCFile}") - message(STATUS "Check if this is a free VC compiler") - exec_program(${CMAKE_TEST_COMPILER} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp2 - ARGS /nologo /MD /EHsc - \"${testForFreeVCFile}\" - OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT - RETURN_VALUE CMAKE_COMPILER_RETURN - ) - if(CMAKE_COMPILER_RETURN) - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if this is a free VC compiler failed with the following output:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - message(STATUS "Check if this is a free VC compiler - yes") - set(CMAKE_USING_VC_FREE_TOOLS 1) - else() - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if this is a free VC compiler passed with the following output:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - message(STATUS "Check if this is a free VC compiler - no") - set(CMAKE_USING_VC_FREE_TOOLS 0) - endif() - make_directory("${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp3") endif() endif() @@ -166,32 +136,17 @@ if(MSVC_VERSION GREATER 1310) set (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}") else() - if(CMAKE_USING_VC_FREE_TOOLS) - message(STATUS "Using FREE VC TOOLS, NO DEBUG available") - set(CMAKE_BUILD_TYPE_INIT Release) - set (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") - set (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MTd /Zi /Ob0 /Od /GZ") - set (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MT /O1 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_RELEASE_INIT "/MT /O2 /Ob2 /D NDEBUG") - set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MT /Zi /O2 /Ob1 /D NDEBUG") - else() - set(CMAKE_BUILD_TYPE_INIT Debug) - set (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") - set (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") - set (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - endif() + set(CMAKE_BUILD_TYPE_INIT Debug) + set (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") + set (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + set (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + set (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") + set (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") + set (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") + set (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") set (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") endif() diff --git a/Modules/Platform/Windows-cl.cmake.in b/Modules/Platform/Windows-cl.cmake.in index 4f3ec3ee8..1a65004c4 100644 --- a/Modules/Platform/Windows-cl.cmake.in +++ b/Modules/Platform/Windows-cl.cmake.in @@ -1,7 +1,6 @@ set(CMAKE_VC_COMPILER_TESTS_RUN 1) set(CMAKE_COMPILER_SUPPORTS_PDBTYPE @CMAKE_COMPILER_SUPPORTS_PDBTYPE@) set(CMAKE_COMPILER_2005 @CMAKE_COMPILER_2005@) -set(CMAKE_USING_VC_FREE_TOOLS @CMAKE_USING_VC_FREE_TOOLS@) set(CMAKE_CL_64 @CMAKE_CL_64@) set(MSVC60 @MSVC60@) set(MSVC70 @MSVC70@) diff --git a/Source/cmDocumentVariables.cxx b/Source/cmDocumentVariables.cxx index ade35e616..601ca7f6e 100644 --- a/Source/cmDocumentVariables.cxx +++ b/Source/cmDocumentVariables.cxx @@ -382,12 +382,6 @@ void cmDocumentVariables::DefineVariables(cmake* cm) "This is the list of libraries that are linked " "into all executables and libraries.",false, "Variables that Provide Information"); - cm->DefineProperty - ("CMAKE_USING_VC_FREE_TOOLS", cmProperty::VARIABLE, - "True if free visual studio tools being used.", - "This is set to true if the compiler is Visual " - "Studio free tools.",false, - "Variables that Provide Information"); cm->DefineProperty ("CMAKE_VERBOSE_MAKEFILE", cmProperty::VARIABLE, "Create verbose makefiles if on.", From 19d9f5908b541a3d61361cbfd1a315ac3f512543 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 24 Aug 2012 00:01:03 -0400 Subject: [PATCH 052/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eb1e6ac7d..3bdb60c89 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 9) -set(CMake_VERSION_TWEAK 20120823) +set(CMake_VERSION_TWEAK 20120824) #set(CMake_VERSION_RC 1) From 7195aca54f40778f41894c9e62649afe09e71d6c Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 24 Aug 2012 08:48:59 -0400 Subject: [PATCH 053/152] Make platform information files specific to the CMake version At the top of a build tree we configure inside the CMakeFiles directory files such as "CMakeSystem.cmake" and "CMakeCompiler.cmake" to save information detected about the system and compilers in use. The method of detection and the exact results store varies across CMake versions as things improve. This leads to problems when loading files configured by a different version of CMake. Previously we ignored such existing files only if the major.minor part of the CMake version component changed, and depended on the CMakeCache.txt to tell us the last version of CMake that wrote the files. This led to problems if the user deletes the CMakeCache.txt or we add required information to the files in a patch-level release of CMake (still a "feature point" release by modern CMake versioning convention). Ensure that we always have version-consistent platform information files by storing them in a subdirectory named with the CMake version. Every version of CMake will do its own system and compiler identification checks even when a build tree has already been configured by another version of CMake. Stored results will not clobber those from other versions of CMake which may be run again on the same tree in the future. Loaded results will match what the system and language modules expect. Rename the undocumented variable CMAKE_PLATFORM_ROOT_BIN to CMAKE_PLATFORM_INFO_DIR to clarify its purpose. The new variable points at the version-specific directory while the old variable did not. --- Modules/CMakeDetermineASMCompiler.cmake | 2 +- Modules/CMakeDetermineCCompiler.cmake | 2 +- Modules/CMakeDetermineCXXCompiler.cmake | 2 +- Modules/CMakeDetermineCompilerABI.cmake | 2 +- Modules/CMakeDetermineCompilerId.cmake | 4 ++-- Modules/CMakeDetermineFortranCompiler.cmake | 2 +- Modules/CMakeDetermineJavaCompiler.cmake | 2 +- Modules/CMakeDetermineRCCompiler.cmake | 2 +- Modules/CMakeDetermineSystem.cmake | 2 +- Modules/CMakeFindPackageMode.cmake | 2 ++ Modules/CMakeTestCCompiler.cmake | 8 ++++---- Modules/CMakeTestCXXCompiler.cmake | 8 ++++---- Modules/CMakeTestFortranCompiler.cmake | 4 ++-- Modules/Platform/Windows-Intel.cmake | 6 +++--- Modules/Platform/Windows-cl.cmake | 12 ++++++------ Source/cmGlobalGenerator.cxx | 13 ++++--------- Source/cmake.cxx | 3 --- Tests/CMakeTests/ToolchainTest.cmake.in | 2 +- bootstrap | 3 +++ 19 files changed, 39 insertions(+), 42 deletions(-) diff --git a/Modules/CMakeDetermineASMCompiler.cmake b/Modules/CMakeDetermineASMCompiler.cmake index 4cf29dd34..9f0b30ab4 100644 --- a/Modules/CMakeDetermineASMCompiler.cmake +++ b/Modules/CMakeDetermineASMCompiler.cmake @@ -163,7 +163,7 @@ set(_CMAKE_ASM_COMPILER_ENV_VAR "${CMAKE_ASM${ASM_DIALECT}_COMPILER_ENV_VAR}") # configure variables set in this file for fast reload later on configure_file(${CMAKE_ROOT}/Modules/CMakeASMCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY) + ${CMAKE_PLATFORM_INFO_DIR}/CMakeASM${ASM_DIALECT}Compiler.cmake IMMEDIATE @ONLY) set(_CMAKE_ASM_COMPILER) set(_CMAKE_ASM_COMPILER_ARG1) diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 01859b60b..534240860 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -171,7 +171,7 @@ if(MSVC_C_ARCHITECTURE_ID) endif() # configure variables set in this file for fast reload later on configure_file(${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in - "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCCompiler.cmake" + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) set(CMAKE_C_COMPILER_ENV_VAR "CC") diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index 3f97b40c7..ed7de90c9 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -167,7 +167,7 @@ if(MSVC_CXX_ARCHITECTURE_ID) endif() # configure all variables set in this file configure_file(${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index ae2eb9b23..ee4b60e2c 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -23,7 +23,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) message(STATUS "Detecting ${lang} compiler ABI info") # Compile the ABI identification source. - set(BIN "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeDetermineCompilerABI_${lang}.bin") + set(BIN "${CMAKE_PLATFORM_INFO_DIR}/CMakeDetermineCompilerABI_${lang}.bin") set(CMAKE_FLAGS ) if(DEFINED CMAKE_${lang}_VERBOSE_FLAG) set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index bd88c3ff2..3df17c7c6 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -30,7 +30,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) string(REGEX REPLACE " " ";" CMAKE_${lang}_COMPILER_ID_FLAGS_LIST "${CMAKE_${lang}_COMPILER_ID_FLAGS}") # Compute the directory in which to run the test. - set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang}) + set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang}) # Try building with no extra flags and then try each set # of helper flags. Stop when the compiler is identified. @@ -393,7 +393,7 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) # We get here when this function is called not from within CMAKE_DETERMINE_COMPILER_ID() # This is done e.g. for detecting the compiler ID for assemblers. # Compute the directory in which to run the test and Create a clean working directory. - set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CompilerId${lang}) + set(CMAKE_${lang}_COMPILER_ID_DIR ${CMAKE_PLATFORM_INFO_DIR}/CompilerId${lang}) file(REMOVE_RECURSE ${CMAKE_${lang}_COMPILER_ID_DIR}) file(MAKE_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR}) endif() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 45213b953..051f8321a 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -197,7 +197,7 @@ if(MSVC_Fortran_ARCHITECTURE_ID) endif() # configure variables set in this file for fast reload later on configure_file(${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake + ${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) set(CMAKE_Fortran_COMPILER_ENV_VAR "FC") diff --git a/Modules/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake index 3f430b477..c4217f552 100644 --- a/Modules/CMakeDetermineJavaCompiler.cmake +++ b/Modules/CMakeDetermineJavaCompiler.cmake @@ -98,5 +98,5 @@ mark_as_advanced(CMAKE_Java_COMPILER) # configure variables set in this file for fast reload later on configure_file(${CMAKE_ROOT}/Modules/CMakeJavaCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY) + ${CMAKE_PLATFORM_INFO_DIR}/CMakeJavaCompiler.cmake IMMEDIATE @ONLY) set(CMAKE_Java_COMPILER_ENV_VAR "JAVA_COMPILER") diff --git a/Modules/CMakeDetermineRCCompiler.cmake b/Modules/CMakeDetermineRCCompiler.cmake index 669dd16b1..fa78da03c 100644 --- a/Modules/CMakeDetermineRCCompiler.cmake +++ b/Modules/CMakeDetermineRCCompiler.cmake @@ -63,5 +63,5 @@ endif() # configure variables set in this file for fast reload later on configure_file(${CMAKE_ROOT}/Modules/CMakeRCCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeRCCompiler.cmake IMMEDIATE) + ${CMAKE_PLATFORM_INFO_DIR}/CMakeRCCompiler.cmake IMMEDIATE) set(CMAKE_RC_COMPILER_ENV_VAR "RC") diff --git a/Modules/CMakeDetermineSystem.cmake b/Modules/CMakeDetermineSystem.cmake index 22c501614..cd3344756 100644 --- a/Modules/CMakeDetermineSystem.cmake +++ b/Modules/CMakeDetermineSystem.cmake @@ -170,7 +170,7 @@ if(CMAKE_BINARY_DIR) # configure variables set in this file for fast reload, the template file is defined at the top of this file configure_file(${CMAKE_ROOT}/Modules/CMakeSystem.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeSystem.cmake + ${CMAKE_PLATFORM_INFO_DIR}/CMakeSystem.cmake IMMEDIATE @ONLY) endif() diff --git a/Modules/CMakeFindPackageMode.cmake b/Modules/CMakeFindPackageMode.cmake index 30d62bc38..c9f58e3f3 100644 --- a/Modules/CMakeFindPackageMode.cmake +++ b/Modules/CMakeFindPackageMode.cmake @@ -47,6 +47,8 @@ macro(ENABLE_LANGUAGE) # But in --find-package mode, we don't want (and can't) enable any language. endmacro() +set(CMAKE_PLATFORM_INFO_DIR ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}) + include(CMakeDetermineSystem) # short-cut some tests on Darwin, see Darwin-GNU.cmake: diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index 14291a7e7..c01109249 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -47,8 +47,8 @@ if(NOT CMAKE_C_COMPILER_WORKS) # if the compiler is broken make sure to remove the platform file # since Windows-cl configures both c/cxx files both need to be removed # when c or c++ fails - file(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake ) - file(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake ) + file(REMOVE ${CMAKE_PLATFORM_INFO_DIR}/CMakeCPlatform.cmake ) + file(REMOVE ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXPlatform.cmake ) message(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" " "is not able to compile a simple test program.\nIt fails " "with the following output:\n ${__CMAKE_C_COMPILER_OUTPUT}\n\n" @@ -71,10 +71,10 @@ else() CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c) configure_file( ${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) - include(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCCompiler.cmake) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake) endif() if(CMAKE_C_SIZEOF_DATA_PTR) foreach(f ${CMAKE_C_ABI_FILES}) diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index 5ed826b78..f62c0e021 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -37,8 +37,8 @@ if(NOT CMAKE_CXX_COMPILER_WORKS) # if the compiler is broken make sure to remove the platform file # since Windows-cl configures both c/cxx files both need to be removed # when c or c++ fails - file(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake ) - file(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake ) + file(REMOVE ${CMAKE_PLATFORM_INFO_DIR}/CMakeCPlatform.cmake ) + file(REMOVE ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXPlatform.cmake ) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the CXX compiler works failed with " "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") @@ -64,10 +64,10 @@ else() CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp) configure_file( ${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) - include(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXCompiler.cmake) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake) endif() if(CMAKE_CXX_SIZEOF_DATA_PTR) foreach(f ${CMAKE_CXX_ABI_FILES}) diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index b388d1ec7..574dfee37 100644 --- a/Modules/CMakeTestFortranCompiler.cmake +++ b/Modules/CMakeTestFortranCompiler.cmake @@ -87,10 +87,10 @@ else() configure_file( ${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake + ${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 ) - include(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeFortranCompiler.cmake) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake) endif() if(CMAKE_Fortran_SIZEOF_DATA_PTR) foreach(f ${CMAKE_Fortran_ABI_FILES}) diff --git a/Modules/Platform/Windows-Intel.cmake b/Modules/Platform/Windows-Intel.cmake index 337055742..3a30a2e0c 100644 --- a/Modules/Platform/Windows-Intel.cmake +++ b/Modules/Platform/Windows-Intel.cmake @@ -61,7 +61,7 @@ set (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) -include("${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake" OPTIONAL) +include("${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake" OPTIONAL) if(NOT _INTEL_XILINK_TEST_RUN) execute_process(COMMAND xilink /? @@ -70,8 +70,8 @@ if(NOT _INTEL_XILINK_TEST_RUN) if(_XILINK_HELP MATCHES MANIFEST) set(_INTEL_COMPILER_SUPPORTS_MANIFEST 1) endif() - if(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake") - file(WRITE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeIntelInformation.cmake + if(NOT EXISTS "${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake") + file(WRITE ${CMAKE_PLATFORM_INFO_DIR}/CMakeIntelInformation.cmake " set(_INTEL_XILINK_TEST_RUN 1) set(_INTEL_COMPILER_SUPPORTS_MANIFEST ${_INTEL_COMPILER_SUPPORTS_MANIFEST}) diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 05df9467a..fde5677e8 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -1,7 +1,7 @@ # try to load any previously computed information for C on this platform -include( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) +include( ${CMAKE_PLATFORM_INFO_DIR}/CMakeCPlatform.cmake OPTIONAL) # try to load any previously computed information for CXX on this platform -include( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) +include( ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXPlatform.cmake OPTIONAL) set(WIN32 1) @@ -242,12 +242,12 @@ set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INI set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) # save computed information for this platform -if(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") +if(NOT EXISTS "${CMAKE_PLATFORM_INFO_DIR}/CMakeCPlatform.cmake") configure_file(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCPlatform.cmake IMMEDIATE) endif() -if(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") +if(NOT EXISTS "${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXPlatform.cmake") configure_file(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXPlatform.cmake IMMEDIATE) endif() diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 52b451cd0..578fa9ec9 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -315,9 +315,11 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, { rootBin = this->ConfiguredFilesPath; } + rootBin += "/"; + rootBin += cmVersion::GetCMakeVersion(); // set the dir for parent files so they can be used by modules - mf->AddDefinition("CMAKE_PLATFORM_ROOT_BIN",rootBin.c_str()); + mf->AddDefinition("CMAKE_PLATFORM_INFO_DIR",rootBin.c_str()); // find and make sure CMAKE_MAKE_PROGRAM is defined this->FindMakeProgram(mf); @@ -386,14 +388,7 @@ cmGlobalGenerator::EnableLanguage(std::vectorconst& languages, // If the existing build tree was already configured with this // version of CMake then try to load the configured file first // to avoid duplicate compiler tests. - unsigned int cacheMajor = mf->GetCacheMajorVersion(); - unsigned int cacheMinor = mf->GetCacheMinorVersion(); - unsigned int selfMajor = cmVersion::GetMajorVersion(); - unsigned int selfMinor = cmVersion::GetMinorVersion(); - if((this->CMakeInstance->GetIsInTryCompile() || - (cacheMajor == 0 && cacheMinor == 0) || - (selfMajor == cacheMajor && selfMinor == cacheMinor)) && - cmSystemTools::FileExists(fpath.c_str())) + if(cmSystemTools::FileExists(fpath.c_str())) { if(!mf->ReadListFile(0,fpath.c_str())) { diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 75aa4712c..f2a022622 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -2438,9 +2438,6 @@ int cmake::Run(const std::vector& args, bool noconfigure) this->PreLoadCMakeFiles(); - std::string systemFile = this->GetHomeOutputDirectory(); - systemFile += "/CMakeSystem.cmake"; - if ( noconfigure ) { return 0; diff --git a/Tests/CMakeTests/ToolchainTest.cmake.in b/Tests/CMakeTests/ToolchainTest.cmake.in index c010fca7c..96e7196a5 100644 --- a/Tests/CMakeTests/ToolchainTest.cmake.in +++ b/Tests/CMakeTests/ToolchainTest.cmake.in @@ -6,7 +6,7 @@ macro(MARK_AS_ADVANCED) endmacro() # set this to a place where we are allowed to write -set(CMAKE_PLATFORM_ROOT_BIN "${CMAKE_CURRENT_BINARY_DIR}") +set(CMAKE_PLATFORM_INFO_DIR "${CMAKE_CURRENT_BINARY_DIR}") # don't run the compiler detection set(CMAKE_C_COMPILER_ID_RUN 1) diff --git a/bootstrap b/bootstrap index f7bc00436..ec5745df3 100755 --- a/bootstrap +++ b/bootstrap @@ -160,6 +160,9 @@ CMAKE_PROBLEMATIC_FILES="\ CMakeSystem.cmake \ CMakeCCompiler.cmake \ CMakeCXXCompiler.cmake \ + */CMakeSystem.cmake \ + */CMakeCCompiler.cmake \ + */CMakeCXXCompiler.cmake \ Source/cmConfigure.h \ Source/CTest/Curl/config.h \ Utilities/cmexpat/expatConfig.h \ From 3df81b49126cf6dc3e4e9a8fa8c368f33886db54 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 24 Aug 2012 09:10:34 -0400 Subject: [PATCH 054/152] Move CMAKE__COMPILER_WORKS to compiler information files Since the parent commit this test result is specific to the version of CMake. Store it in the version-specific compiler information files instead of CMakeCache.txt so testing can be re-done to meet the requirements of the current version of CMake even if another version of CMake was already used to configure the build tree. --- Modules/CMakeCCompiler.cmake.in | 1 + Modules/CMakeCXXCompiler.cmake.in | 1 + Modules/CMakeForceCompiler.cmake | 3 - Modules/CMakeFortranCompiler.cmake.in | 1 + Modules/CMakeTestCCompiler.cmake | 43 ++++++++----- Modules/CMakeTestCXXCompiler.cmake | 43 ++++++++----- Modules/CMakeTestFortranCompiler.cmake | 84 ++++++++++++++------------ 7 files changed, 104 insertions(+), 72 deletions(-) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index b4eabe599..9d63033df 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -9,6 +9,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@) set(CMAKE_C_COMPILER_LOADED 1) +set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@) set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) if(CMAKE_COMPILER_IS_CYGWIN) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index b6477dfe4..2e891b359 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -9,6 +9,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) set(CMAKE_CXX_COMPILER_LOADED 1) +set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@) set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) if(CMAKE_COMPILER_IS_CYGWIN) diff --git a/Modules/CMakeForceCompiler.cmake b/Modules/CMakeForceCompiler.cmake index 980cc17aa..207c8ad35 100644 --- a/Modules/CMakeForceCompiler.cmake +++ b/Modules/CMakeForceCompiler.cmake @@ -46,7 +46,6 @@ macro(CMAKE_FORCE_C_COMPILER compiler id) set(CMAKE_C_COMPILER "${compiler}") set(CMAKE_C_COMPILER_ID_RUN TRUE) set(CMAKE_C_COMPILER_ID ${id}) - set(CMAKE_C_COMPILER_WORKS TRUE) set(CMAKE_C_COMPILER_FORCED TRUE) # Set old compiler id variables. @@ -59,7 +58,6 @@ macro(CMAKE_FORCE_CXX_COMPILER compiler id) set(CMAKE_CXX_COMPILER "${compiler}") set(CMAKE_CXX_COMPILER_ID_RUN TRUE) set(CMAKE_CXX_COMPILER_ID ${id}) - set(CMAKE_CXX_COMPILER_WORKS TRUE) set(CMAKE_CXX_COMPILER_FORCED TRUE) # Set old compiler id variables. @@ -72,7 +70,6 @@ macro(CMAKE_FORCE_Fortran_COMPILER compiler id) set(CMAKE_Fortran_COMPILER "${compiler}") set(CMAKE_Fortran_COMPILER_ID_RUN TRUE) set(CMAKE_Fortran_COMPILER_ID ${id}) - set(CMAKE_Fortran_COMPILER_WORKS TRUE) set(CMAKE_Fortran_COMPILER_FORCED TRUE) # Set old compiler id variables. diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index c7529fc8e..9ed3aac21 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -7,6 +7,7 @@ set(CMAKE_AR "@CMAKE_AR@") set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) set(CMAKE_Fortran_COMPILER_LOADED 1) +set(CMAKE_Fortran_COMPILER_WORKS @CMAKE_Fortran_COMPILER_WORKS@) set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) if(CMAKE_COMPILER_IS_CYGWIN) diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index c01109249..796ec1056 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2003-2009 Kitware, Inc. +# Copyright 2003-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,8 +12,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +if(CMAKE_C_COMPILER_FORCED) + # The compiler configuration was forced by the user. + # Assume the user has configured all compiler information. + set(CMAKE_C_COMPILER_WORKS TRUE) + return() +endif() + include(CMakeTestCompilerCommon) +# Remove any cached result from an older CMake version. +# We now store this in CMakeCCompiler.cmake. +unset(CMAKE_C_COMPILER_WORKS CACHE) + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected C compiler can actually compile # and link the most basic of programs. If not, a fatal error @@ -36,6 +47,9 @@ if(NOT CMAKE_C_COMPILER_WORKS) try_compile(CMAKE_C_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCCompiler.c OUTPUT_VARIABLE __CMAKE_C_COMPILER_OUTPUT) + # Move result from cache to normal variable. + set(CMAKE_C_COMPILER_WORKS ${CMAKE_C_COMPILER_WORKS}) + unset(CMAKE_C_COMPILER_WORKS CACHE) set(C_TEST_WAS_RUN 1) endif() @@ -60,22 +74,19 @@ else() "Determining if the C compiler works passed with " "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n") endif() - set(CMAKE_C_COMPILER_WORKS 1 CACHE INTERNAL "") - if(CMAKE_C_COMPILER_FORCED) - # The compiler configuration was forced by the user. - # Assume the user has configured all compiler information. - else() - # Try to identify the ABI and configure it into CMakeCCompiler.cmake - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c) - configure_file( - ${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake - @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 - ) - include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake) - endif() + # Try to identify the ABI and configure it into CMakeCCompiler.cmake + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) + CMAKE_DETERMINE_COMPILER_ABI(C ${CMAKE_ROOT}/Modules/CMakeCCompilerABI.c) + + # Re-configure to save learned information. + configure_file( + ${CMAKE_ROOT}/Modules/CMakeCCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake + @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 + ) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCCompiler.cmake) + if(CMAKE_C_SIZEOF_DATA_PTR) foreach(f ${CMAKE_C_ABI_FILES}) include(${f}) diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index f62c0e021..9ed71e646 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2003-2009 Kitware, Inc. +# Copyright 2003-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,8 +12,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +if(CMAKE_CXX_COMPILER_FORCED) + # The compiler configuration was forced by the user. + # Assume the user has configured all compiler information. + set(CMAKE_CXX_COMPILER_WORKS TRUE) + return() +endif() + include(CMakeTestCompilerCommon) +# Remove any cached result from an older CMake version. +# We now store this in CMakeCXXCompiler.cmake. +unset(CMAKE_CXX_COMPILER_WORKS CACHE) + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected C++ compiler can actually compile # and link the most basic of programs. If not, a fatal error @@ -29,6 +40,9 @@ if(NOT CMAKE_CXX_COMPILER_WORKS) try_compile(CMAKE_CXX_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testCXXCompiler.cxx OUTPUT_VARIABLE __CMAKE_CXX_COMPILER_OUTPUT) + # Move result from cache to normal variable. + set(CMAKE_CXX_COMPILER_WORKS ${CMAKE_CXX_COMPILER_WORKS}) + unset(CMAKE_CXX_COMPILER_WORKS CACHE) set(CXX_TEST_WAS_RUN 1) endif() @@ -53,22 +67,19 @@ else() "Determining if the CXX compiler works passed with " "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") endif() - set(CMAKE_CXX_COMPILER_WORKS 1 CACHE INTERNAL "") - if(CMAKE_CXX_COMPILER_FORCED) - # The compiler configuration was forced by the user. - # Assume the user has configured all compiler information. - else() - # Try to identify the ABI and configure it into CMakeCXXCompiler.cmake - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp) - configure_file( - ${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake - @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 - ) - include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake) - endif() + # Try to identify the ABI and configure it into CMakeCXXCompiler.cmake + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) + CMAKE_DETERMINE_COMPILER_ABI(CXX ${CMAKE_ROOT}/Modules/CMakeCXXCompilerABI.cpp) + + # Re-configure to save learned information. + configure_file( + ${CMAKE_ROOT}/Modules/CMakeCXXCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake + @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 + ) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeCXXCompiler.cmake) + if(CMAKE_CXX_SIZEOF_DATA_PTR) foreach(f ${CMAKE_CXX_ABI_FILES}) include(${f}) diff --git a/Modules/CMakeTestFortranCompiler.cmake b/Modules/CMakeTestFortranCompiler.cmake index 574dfee37..e26334514 100644 --- a/Modules/CMakeTestFortranCompiler.cmake +++ b/Modules/CMakeTestFortranCompiler.cmake @@ -1,6 +1,6 @@ #============================================================================= -# Copyright 2004-2009 Kitware, Inc. +# Copyright 2004-2012 Kitware, Inc. # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -12,8 +12,19 @@ # (To distribute this file outside of CMake, substitute the full # License text for the above reference.) +if(CMAKE_Fortran_COMPILER_FORCED) + # The compiler configuration was forced by the user. + # Assume the user has configured all compiler information. + set(CMAKE_Fortran_COMPILER_WORKS TRUE) + return() +endif() + include(CMakeTestCompilerCommon) +# Remove any cached result from an older CMake version. +# We now store this in CMakeFortranCompiler.cmake. +unset(CMAKE_Fortran_COMPILER_WORKS CACHE) + # This file is used by EnableLanguage in cmGlobalGenerator to # determine that that selected Fortran compiler can actually compile # and link the most basic of programs. If not, a fatal error @@ -29,6 +40,9 @@ if(NOT CMAKE_Fortran_COMPILER_WORKS) try_compile(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompiler.f OUTPUT_VARIABLE OUTPUT) + # Move result from cache to normal variable. + set(CMAKE_Fortran_COMPILER_WORKS ${CMAKE_Fortran_COMPILER_WORKS}) + unset(CMAKE_Fortran_COMPILER_WORKS CACHE) set(FORTRAN_TEST_WAS_RUN 1) endif() @@ -48,50 +62,46 @@ else() "Determining if the Fortran compiler works passed with " "the following output:\n${OUTPUT}\n\n") endif() - set(CMAKE_Fortran_COMPILER_WORKS 1 CACHE INTERNAL "") - if(CMAKE_Fortran_COMPILER_FORCED) - # The compiler configuration was forced by the user. - # Assume the user has configured all compiler information. - else() - # Try to identify the ABI and configure it into CMakeFortranCompiler.cmake - include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) - CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F) + # Try to identify the ABI and configure it into CMakeFortranCompiler.cmake + include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerABI.cmake) + CMAKE_DETERMINE_COMPILER_ABI(Fortran ${CMAKE_ROOT}/Modules/CMakeFortranCompilerABI.F) - # Test for Fortran 90 support by using an f90-specific construct. - if(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90) - message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90") - file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 " + # Test for Fortran 90 support by using an f90-specific construct. + if(NOT DEFINED CMAKE_Fortran_COMPILER_SUPPORTS_F90) + message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90") + file(WRITE ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 " PROGRAM TESTFortran90 stop = 1 ; do while ( stop .eq. 0 ) ; end do END PROGRAM TESTFortran90 ") - try_compile(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 - OUTPUT_VARIABLE OUTPUT) - if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) - message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- yes") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining if the Fortran compiler supports Fortran 90 passed with " - "the following output:\n${OUTPUT}\n\n") - set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1) - else() - message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- no") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining if the Fortran compiler supports Fortran 90 failed with " - "the following output:\n${OUTPUT}\n\n") - set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 0) - endif() - unset(CMAKE_Fortran_COMPILER_SUPPORTS_F90 CACHE) + try_compile(CMAKE_Fortran_COMPILER_SUPPORTS_F90 ${CMAKE_BINARY_DIR} + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/testFortranCompilerF90.f90 + OUTPUT_VARIABLE OUTPUT) + if(CMAKE_Fortran_COMPILER_SUPPORTS_F90) + message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- yes") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Determining if the Fortran compiler supports Fortran 90 passed with " + "the following output:\n${OUTPUT}\n\n") + set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 1) + else() + message(STATUS "Checking whether ${CMAKE_Fortran_COMPILER} supports Fortran 90 -- no") + file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Determining if the Fortran compiler supports Fortran 90 failed with " + "the following output:\n${OUTPUT}\n\n") + set(CMAKE_Fortran_COMPILER_SUPPORTS_F90 0) endif() - - configure_file( - ${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in - ${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake - @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 - ) - include(${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake) + unset(CMAKE_Fortran_COMPILER_SUPPORTS_F90 CACHE) endif() + + # Re-configure to save learned information. + configure_file( + ${CMAKE_ROOT}/Modules/CMakeFortranCompiler.cmake.in + ${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake + @ONLY IMMEDIATE # IMMEDIATE must be here for compatibility mode <= 2.0 + ) + include(${CMAKE_PLATFORM_INFO_DIR}/CMakeFortranCompiler.cmake) + if(CMAKE_Fortran_SIZEOF_DATA_PTR) foreach(f ${CMAKE_Fortran_ABI_FILES}) include(${f}) From caa9151169eb26076f3e276c0840e52116ce38b2 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Fri, 24 Aug 2012 09:54:31 -0600 Subject: [PATCH 055/152] Fix errors detecting Qt4 on Windows 8. Thanks to Petr Baloun for the patch. --- Modules/FindQt4.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index f133ae9e2..e1682a0fb 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -482,7 +482,7 @@ endmacro () function(_QT4_QUERY_QMAKE VAR RESULT) execute_process(COMMAND "${QT_QMAKE_EXECUTABLE}" -query ${VAR} RESULT_VARIABLE return_code - OUTPUT_VARIABLE output ERROR_VARIABLE output + OUTPUT_VARIABLE output OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_STRIP_TRAILING_WHITESPACE) if(NOT return_code) file(TO_CMAKE_PATH "${output}" output) From e5fee8a7c2873531c8e8e8ee991e8d0697f9bf73 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 24 Aug 2012 15:15:14 -0400 Subject: [PATCH 056/152] Store ABI detection results in compiler information files Drop use of cache entry CMAKE_DETERMINE__ABI_COMPILED and replace it with variable CMAKE__ABI_COMPILED. Since the grandparent commit this test result is specific to the version of CMake. Store it in the version-specific compiler information files instead of CMakeCache.txt so testing can be re-done to meet the requirements of the current version of CMake even if another version of CMake was already used to configure the build tree. --- Modules/CMakeCCompiler.cmake.in | 1 + Modules/CMakeCXXCompiler.cmake.in | 1 + Modules/CMakeDetermineCompilerABI.cmake | 10 +++++++--- Modules/CMakeFortranCompiler.cmake.in | 1 + 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 9d63033df..17d63ebab 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -10,6 +10,7 @@ set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_COMPILER_IS_GNUCC @CMAKE_COMPILER_IS_GNUCC@) set(CMAKE_C_COMPILER_LOADED 1) set(CMAKE_C_COMPILER_WORKS @CMAKE_C_COMPILER_WORKS@) +set(CMAKE_C_ABI_COMPILED @CMAKE_C_ABI_COMPILED@) set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) if(CMAKE_COMPILER_IS_CYGWIN) diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 2e891b359..7f66be506 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -10,6 +10,7 @@ set(CMAKE_LINKER "@CMAKE_LINKER@") set(CMAKE_COMPILER_IS_GNUCXX @CMAKE_COMPILER_IS_GNUCXX@) set(CMAKE_CXX_COMPILER_LOADED 1) set(CMAKE_CXX_COMPILER_WORKS @CMAKE_CXX_COMPILER_WORKS@) +set(CMAKE_CXX_ABI_COMPILED @CMAKE_CXX_ABI_COMPILED@) set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) if(CMAKE_COMPILER_IS_CYGWIN) diff --git a/Modules/CMakeDetermineCompilerABI.cmake b/Modules/CMakeDetermineCompilerABI.cmake index ee4b60e2c..75247d955 100644 --- a/Modules/CMakeDetermineCompilerABI.cmake +++ b/Modules/CMakeDetermineCompilerABI.cmake @@ -19,7 +19,7 @@ include(${CMAKE_ROOT}/Modules/CMakeParseImplicitLinkInfo.cmake) function(CMAKE_DETERMINE_COMPILER_ABI lang src) - if(NOT DEFINED CMAKE_DETERMINE_${lang}_ABI_COMPILED) + if(NOT DEFINED CMAKE_${lang}_ABI_COMPILED) message(STATUS "Detecting ${lang} compiler ABI info") # Compile the ABI identification source. @@ -28,7 +28,7 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) if(DEFINED CMAKE_${lang}_VERBOSE_FLAG) set(CMAKE_FLAGS "-DCMAKE_EXE_LINKER_FLAGS=${CMAKE_${lang}_VERBOSE_FLAG}") endif() - try_compile(CMAKE_DETERMINE_${lang}_ABI_COMPILED + try_compile(CMAKE_${lang}_ABI_COMPILED ${CMAKE_BINARY_DIR} ${src} CMAKE_FLAGS "${CMAKE_FLAGS}" "-DCMAKE_${lang}_STANDARD_LIBRARIES=" @@ -39,9 +39,13 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src) OUTPUT_VARIABLE OUTPUT COPY_FILE "${BIN}" ) + # Move result from cache to normal variable. + set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED}) + unset(CMAKE_${lang}_ABI_COMPILED CACHE) + set(CMAKE_${lang}_ABI_COMPILED ${CMAKE_${lang}_ABI_COMPILED} PARENT_SCOPE) # Load the resulting information strings. - if(CMAKE_DETERMINE_${lang}_ABI_COMPILED) + if(CMAKE_${lang}_ABI_COMPILED) message(STATUS "Detecting ${lang} compiler ABI info - done") file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "Detecting ${lang} compiler ABI info compiled with the following output:\n${OUTPUT}\n\n") diff --git a/Modules/CMakeFortranCompiler.cmake.in b/Modules/CMakeFortranCompiler.cmake.in index 9ed3aac21..55f827773 100644 --- a/Modules/CMakeFortranCompiler.cmake.in +++ b/Modules/CMakeFortranCompiler.cmake.in @@ -8,6 +8,7 @@ set(CMAKE_RANLIB "@CMAKE_RANLIB@") set(CMAKE_COMPILER_IS_GNUG77 @CMAKE_COMPILER_IS_GNUG77@) set(CMAKE_Fortran_COMPILER_LOADED 1) set(CMAKE_Fortran_COMPILER_WORKS @CMAKE_Fortran_COMPILER_WORKS@) +set(CMAKE_Fortran_ABI_COMPILED @CMAKE_Fortran_ABI_COMPILED@) set(CMAKE_COMPILER_IS_MINGW @CMAKE_COMPILER_IS_MINGW@) set(CMAKE_COMPILER_IS_CYGWIN @CMAKE_COMPILER_IS_CYGWIN@) if(CMAKE_COMPILER_IS_CYGWIN) From 78b30939a8b5c0706ee17a01bc70952ec82fee45 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 25 Aug 2012 00:01:02 -0400 Subject: [PATCH 057/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 3bdb60c89..72ed57771 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 9) -set(CMake_VERSION_TWEAK 20120824) +set(CMake_VERSION_TWEAK 20120825) #set(CMake_VERSION_RC 1) From 496d33a65dbf87fbbd3dd20f6b1b8c9e73e8372f Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 26 Aug 2012 00:01:03 -0400 Subject: [PATCH 058/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 72ed57771..46e6f42dd 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 9) -set(CMake_VERSION_TWEAK 20120825) +set(CMake_VERSION_TWEAK 20120826) #set(CMake_VERSION_RC 1) From f32e7957b4f6cb57e396ec018947d46420072671 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 27 Aug 2012 00:01:02 -0400 Subject: [PATCH 059/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 46e6f42dd..14f61bdbc 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 9) -set(CMake_VERSION_TWEAK 20120826) +set(CMake_VERSION_TWEAK 20120827) #set(CMake_VERSION_RC 1) From 0af27f1f2a18c9e2335d22444777f1a6559000b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Mon, 27 Aug 2012 14:49:51 +0200 Subject: [PATCH 060/152] Ninja: also detect /showInclude prefix for icl --- Modules/CMakeClDeps.cmake | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Modules/CMakeClDeps.cmake b/Modules/CMakeClDeps.cmake index b52641c53..0214ead2b 100644 --- a/Modules/CMakeClDeps.cmake +++ b/Modules/CMakeClDeps.cmake @@ -26,12 +26,9 @@ if(MSVC_C_ARCHITECTURE_ID AND CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPIL file(WRITE ${showdir}/foo.h "\n") file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n") execute_process(COMMAND ${CMAKE_C_COMPILER} /nologo /showIncludes ${showdir}/main.c - WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE showOut) - string(REPLACE main.c "" showOut1 ${showOut}) - string(REPLACE "/" "\\" header1 ${showdir}/foo.h) - string(TOLOWER ${header1} header2) - string(REPLACE ${header2} "" showOut2 ${showOut1}) - string(REPLACE "\n" "" showOut3 ${showOut2}) + WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE outLine) + string(REGEX MATCH "\n([^:]*:[^:]*:[ \t]*)" tmp "${outLine}") + set(localizedPrefix "${CMAKE_MATCH_1}") set(SET_CMAKE_CMCLDEPS_EXECUTABLE "set(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")") - set(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "set(CMAKE_CL_SHOWINCLUDE_PREFIX \"${showOut3}\")") + set(SET_CMAKE_CL_SHOWINCLUDE_PREFIX "set(CMAKE_CL_SHOWINCLUDE_PREFIX \"${localizedPrefix}\")") endif() From be9afbf4535f5dc3650ea41480b2c9a58d4f94c0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Mon, 27 Aug 2012 16:54:21 +0200 Subject: [PATCH 061/152] Find mingw's windres also when Unix Makefiles are used --- Modules/Platform/Windows-GNU.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/Modules/Platform/Windows-GNU.cmake b/Modules/Platform/Windows-GNU.cmake index 50ba80ba6..2bb7a2076 100644 --- a/Modules/Platform/Windows-GNU.cmake +++ b/Modules/Platform/Windows-GNU.cmake @@ -57,6 +57,10 @@ if("${_help}" MATCHES "GNU ld .* 2\\.1[1-6]") set(__WINDOWS_GNU_LD_RESPONSE 0) endif() +if(NOT CMAKE_GENERATOR_RC AND CMAKE_GENERATOR MATCHES "Unix Makefiles") + set(CMAKE_GENERATOR_RC windres) +endif() + enable_language(RC) macro(__windows_compiler_gnu lang) From 9f7e46f77f6b91033ec8e1e3ce5164f2c6523389 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 28 Aug 2012 00:01:02 -0400 Subject: [PATCH 062/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 14f61bdbc..9955d7e9f 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 9) -set(CMake_VERSION_TWEAK 20120827) +set(CMake_VERSION_TWEAK 20120828) #set(CMake_VERSION_RC 1) From 325214900ba14ebb94ba43fbd61dea4bef37d5e5 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Tue, 28 Aug 2012 11:22:17 +0200 Subject: [PATCH 063/152] Fix casing of 'Qt' in docs, comments and user-visible strings. QT (cue-tea) is Apple QuickTime. Qt (cute) is the C++ framework. --- Modules/FindQt.cmake | 26 +++++++++++++------------- Modules/FindQt3.cmake | 4 ++-- Modules/FindQt4.cmake | 2 +- Modules/SquishTestScript.cmake | 2 +- Source/cmQTWrapCPPCommand.h | 4 ++-- Source/cmQTWrapUICommand.h | 4 ++-- Source/cmSetTargetPropertiesCommand.h | 2 +- Source/cmTarget.cxx | 2 +- Tests/Wrapping/CMakeLists.txt | 8 ++++---- 9 files changed, 27 insertions(+), 27 deletions(-) diff --git a/Modules/FindQt.cmake b/Modules/FindQt.cmake index eeeaf5958..13f18fe7a 100644 --- a/Modules/FindQt.cmake +++ b/Modules/FindQt.cmake @@ -1,7 +1,7 @@ -# - Searches for all installed versions of QT. +# - Searches for all installed versions of Qt. # This should only be used if your project can work with multiple -# versions of QT. If not, you should just directly use FindQt4 or FindQt3. -# If multiple versions of QT are found on the machine, then +# versions of Qt. If not, you should just directly use FindQt4 or FindQt3. +# If multiple versions of Qt are found on the machine, then # The user must set the option DESIRED_QT_VERSION to the version # they want to use. If only one version of qt is found on the machine, # then the DESIRED_QT_VERSION is set to that version and the @@ -10,7 +10,7 @@ # is included. # # QT_REQUIRED if this is set to TRUE then if CMake can -# not find QT4 or QT3 an error is raised +# not find Qt4 or Qt3 an error is raised # and a message is sent to the user. # # DESIRED_QT_VERSION OPTION is created @@ -62,7 +62,7 @@ if(QT_QMAKE_EXECUTABLE_FINDQT) exec_program(${QT_QMAKE_EXECUTABLE_FINDQT} ARGS "-query QT_VERSION" OUTPUT_VARIABLE QTVERSION) if(QTVERSION MATCHES "4.*") - set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "QT4 qmake program.") + set(QT_QMAKE_EXECUTABLE ${QT_QMAKE_EXECUTABLE_FINDQT} CACHE PATH "Qt4 qmake program.") set(QT4_INSTALLED TRUE) endif() if(QTVERSION MATCHES "Unknown") @@ -115,14 +115,14 @@ endif() if(QT3_INSTALLED AND QT4_INSTALLED ) # force user to pick if we have both - set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of QT to use: 3 or 4") + set(DESIRED_QT_VERSION 0 CACHE STRING "Pick a version of Qt to use: 3 or 4") else() # if only one found then pick that one if(QT3_INSTALLED) - set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of QT to use: 3 or 4") + set(DESIRED_QT_VERSION 3 CACHE STRING "Pick a version of Qt to use: 3 or 4") endif() if(QT4_INSTALLED) - set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of QT to use: 3 or 4") + set(DESIRED_QT_VERSION 4 CACHE STRING "Pick a version of Qt to use: 3 or 4") endif() endif() @@ -139,21 +139,21 @@ endif() if(NOT QT3_INSTALLED AND NOT QT4_INSTALLED) if(QT_REQUIRED) - message(SEND_ERROR "CMake was unable to find any QT versions, put qmake in your path, or set QT_QMAKE_EXECUTABLE.") + message(SEND_ERROR "CMake was unable to find any Qt versions, put qmake in your path, or set QT_QMAKE_EXECUTABLE.") endif() else() if(NOT QT_FOUND AND NOT DESIRED_QT_VERSION) if(QT_REQUIRED) - message(SEND_ERROR "Multiple versions of QT found please set DESIRED_QT_VERSION") + message(SEND_ERROR "Multiple versions of Qt found please set DESIRED_QT_VERSION") else() - message("Multiple versions of QT found please set DESIRED_QT_VERSION") + message("Multiple versions of Qt found please set DESIRED_QT_VERSION") endif() endif() if(NOT QT_FOUND AND DESIRED_QT_VERSION) if(QT_REQUIRED) - message(FATAL_ERROR "CMake was unable to find QT version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") + message(FATAL_ERROR "CMake was unable to find Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE, if those are set then QT_QT_LIBRARY or QT_LIBRARY_DIR.") else() - message( "CMake was unable to find desired QT version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.") + message( "CMake was unable to find desired Qt version: ${DESIRED_QT_VERSION}. Set advanced values QT_QMAKE_EXECUTABLE and QT${DESIRED_QT_VERSION}_QGLOBAL_FILE.") endif() endif() endif() diff --git a/Modules/FindQt3.cmake b/Modules/FindQt3.cmake index 066506305..07b6fef34 100644 --- a/Modules/FindQt3.cmake +++ b/Modules/FindQt3.cmake @@ -144,7 +144,7 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY lib ) -# qt 3 should prefer QTDIR over the PATH +# Qt 3 should prefer QTDIR over the PATH find_program(QT_MOC_EXECUTABLE NAMES moc-qt3 moc HINTS @@ -168,7 +168,7 @@ if(QT_MOC_EXECUTABLE) set ( QT_WRAP_CPP "YES") endif() -# qt 3 should prefer QTDIR over the PATH +# Qt 3 should prefer QTDIR over the PATH find_program(QT_UIC_EXECUTABLE NAMES uic-qt3 uic HINTS diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index f133ae9e2..b5b790f30 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -1,4 +1,4 @@ -# - Find QT 4 +# - Find Qt 4 # This module can be used to find Qt4. # The most important issue is that the Qt4 qmake is available via the system path. # This qmake is then used to detect basically everything else. diff --git a/Modules/SquishTestScript.cmake b/Modules/SquishTestScript.cmake index 5cdd2123c..d5653051b 100644 --- a/Modules/SquishTestScript.cmake +++ b/Modules/SquishTestScript.cmake @@ -44,7 +44,7 @@ foreach(i ${squish_env_vars}) endforeach() if (QT4_INSTALLED) - # record qt lib directory + # record Qt lib directory set ( ENV{${SQUISH_LIBQTDIR}} ${squish_libqtdir} ) endif () diff --git a/Source/cmQTWrapCPPCommand.h b/Source/cmQTWrapCPPCommand.h index 1af084065..4863402e4 100644 --- a/Source/cmQTWrapCPPCommand.h +++ b/Source/cmQTWrapCPPCommand.h @@ -17,9 +17,9 @@ #include "cmSourceFile.h" /** \class cmQTWrapCPPCommand - * \brief Create moc file rules for QT classes + * \brief Create moc file rules for Qt classes * - * cmQTWrapCPPCommand is used to create wrappers for QT classes into + * cmQTWrapCPPCommand is used to create wrappers for Qt classes into * normal C++ */ class cmQTWrapCPPCommand : public cmCommand diff --git a/Source/cmQTWrapUICommand.h b/Source/cmQTWrapUICommand.h index 1fff04162..b15c5cde0 100644 --- a/Source/cmQTWrapUICommand.h +++ b/Source/cmQTWrapUICommand.h @@ -17,9 +17,9 @@ #include "cmSourceFile.h" /** \class cmQTWrapUICommand - * \brief Create .h and .cxx files rules for QT user interfaces files + * \brief Create .h and .cxx files rules for Qt user interfaces files * - * cmQTWrapUICommand is used to create wrappers for QT classes into normal C++ + * cmQTWrapUICommand is used to create wrappers for Qt classes into normal C++ */ class cmQTWrapUICommand : public cmCommand { diff --git a/Source/cmSetTargetPropertiesCommand.h b/Source/cmSetTargetPropertiesCommand.h index e04f7eb78..65c89fad4 100644 --- a/Source/cmSetTargetPropertiesCommand.h +++ b/Source/cmSetTargetPropertiesCommand.h @@ -138,7 +138,7 @@ public: "are used to initialize these properties.\n" "PROJECT_LABEL can be used to change the name of " "the target in an IDE like visual studio. VS_KEYWORD can be set " - "to change the visual studio keyword, for example QT integration " + "to change the visual studio keyword, for example Qt integration " "works better if this is set to Qt4VSv1.0.\n" "VS_SCC_PROJECTNAME, VS_SCC_LOCALPATH, VS_SCC_PROVIDER and " "VS_SCC_AUXPATH can be set " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 65b586da6..b0d4834a0 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1071,7 +1071,7 @@ void cmTarget::DefineProperties(cmake *cm) ("VS_KEYWORD", cmProperty::TARGET, "Visual Studio project keyword.", "Can be set to change the visual studio keyword, for example " - "QT integration works better if this is set to Qt4VSv1.0. "); + "Qt integration works better if this is set to Qt4VSv1.0. "); cm->DefineProperty ("VS_SCC_PROVIDER", cmProperty::TARGET, "Visual Studio Source Code Control Provider.", diff --git a/Tests/Wrapping/CMakeLists.txt b/Tests/Wrapping/CMakeLists.txt index 22233df6f..58e9c3242 100644 --- a/Tests/Wrapping/CMakeLists.txt +++ b/Tests/Wrapping/CMakeLists.txt @@ -40,7 +40,7 @@ endif() set(WRAP ${EXECUTABLE_OUTPUT_PATH}/${CMAKE_CFG_INTDIR}/Wrap${EXE_EXT}) # -# QT Wrappers +# Qt Wrappers # set (QT_WRAP_CPP "On") @@ -48,7 +48,7 @@ set (QT_MOC_EXE "echo") include( FindQt3 ) if (QT_FOUND AND QT_WRAP_UI) - message("found qt 3 test it...") + message("found Qt 3 test it...") include_directories( ${QT_INCLUDE_DIR} ) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) @@ -67,8 +67,8 @@ if (QT_FOUND AND QT_WRAP_UI) qt_wrap_ui (myqtlib QTUI_H_SRCS QTUI_S_SRCS ${QTUI_SRCS}) qt_wrap_cpp (myqtlib QT_MOC_SRCS ${SRCS} vtkTestMoc.h) - message("QT files are ${QTUI_S_SRCS}") - message("QT other files are ${QTUI_H_SRCS}") + message("Qt files are ${QTUI_S_SRCS}") + message("Qt other files are ${QTUI_H_SRCS}") add_definitions(${QT_DEFINITIONS}) add_library(myqtlib ${QTUI_S_SRCS} ${QT_MOC_SRCS}) add_executable (qtwrapping qtwrappingmain.cxx) From d9db32e5bf7f006743e136631faf57116607b77c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 29 Aug 2012 00:01:02 -0400 Subject: [PATCH 064/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9955d7e9f..66e292b17 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 9) -set(CMake_VERSION_TWEAK 20120828) +set(CMake_VERSION_TWEAK 20120829) #set(CMake_VERSION_RC 1) From 3e72df14845fff7830701a9fd8d587968ad43d4a Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 30 Aug 2012 00:01:03 -0400 Subject: [PATCH 065/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 66e292b17..c5c532608 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 9) -set(CMake_VERSION_TWEAK 20120829) +set(CMake_VERSION_TWEAK 20120830) #set(CMake_VERSION_RC 1) From 42bfc5a3e4dd495db96b0ad9f0e4e1bef4ecfa51 Mon Sep 17 00:00:00 2001 From: Stephen Kelly Date: Thu, 30 Aug 2012 09:47:42 +0200 Subject: [PATCH 066/152] Read entire Qt4 qrc file when parsing for depends info. The qrc file is an xml file, not line based, so the entire 'interesting' content to parse is not necessarily found by STRINGS and a regexp. --- Modules/Qt4Macros.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 6cf16fdd5..b52dde803 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -187,7 +187,7 @@ macro (QT4_ADD_RESOURCES outfiles ) if(EXISTS "${infile}") # parse file for dependencies # all files are absolute paths or relative to the location of the qrc file - file(STRINGS "${infile}" _RC_FILE_CONTENTS REGEX "]*>[^<]+") + file(READ "${infile}" _RC_FILE_CONTENTS) string(REGEX MATCHALL "]*>" "" _RC_FILE "${_RC_FILE}") From af06482d24799106dbf5a2cbd82d20d034df2b45 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer Date: Thu, 30 Aug 2012 15:33:27 +0200 Subject: [PATCH 067/152] FindFLEX: fix version extraction on Apple The space in 'flex 2.5.35 Apple(flex-31)' caused the version extraction to fail. Ignore everything after the first space following the version number. --- Modules/FindFLEX.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Modules/FindFLEX.cmake b/Modules/FindFLEX.cmake index e397d284f..daae94fad 100644 --- a/Modules/FindFLEX.cmake +++ b/Modules/FindFLEX.cmake @@ -94,7 +94,7 @@ if(FLEX_EXECUTABLE) # older versions of flex printed "/full/path/to/executable version X.Y" # newer versions use "basename(executable) X.Y" get_filename_component(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME) - string(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)$" "\\2" + string(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\2" FLEX_VERSION "${FLEX_version_output}") unset(FLEX_EXE_NAME) endif() From 485a940e4c2b07f08e70b6e04733feb724bb6f3f Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 23 Aug 2012 11:20:48 -0400 Subject: [PATCH 068/152] VS: Simplify MSVC version reporting Teach Windows-cl.cmake to use CMAKE_(C|CXX)_COMPILER_VERSION to set the "MSVC##" and MSVC_VERSION variables. It no longer needs the IDE generator to dictate the version or to detect the version by running the command-line tool for NMake and Ninja generators. Drop configuration of CMakeCPlatform.cmake and CMakeCXXPlatform.cmake from Windows-cl.cmake.in because all the results it saved are now cheap to compute every time. --- Modules/CMakeTestCCompiler.cmake | 5 - Modules/CMakeTestCXXCompiler.cmake | 5 - Modules/CMakeTestNMakeCLVersion.c | 2 - Modules/Platform/Windows-cl.cmake | 127 +++++++-------------- Modules/Platform/Windows-cl.cmake.in | 13 --- Source/cmGlobalVisualStudio10Generator.cxx | 1 - Source/cmGlobalVisualStudio11Generator.cxx | 1 - Source/cmGlobalVisualStudio6Generator.cxx | 1 - Source/cmGlobalVisualStudio71Generator.cxx | 1 - Source/cmGlobalVisualStudio7Generator.cxx | 1 - Source/cmGlobalVisualStudio8Generator.cxx | 1 - Source/cmGlobalVisualStudio9Generator.cxx | 1 - Source/cmGlobalVisualStudioGenerator.cxx | 6 - Source/cmGlobalVisualStudioGenerator.h | 1 - 14 files changed, 42 insertions(+), 124 deletions(-) delete mode 100644 Modules/CMakeTestNMakeCLVersion.c delete mode 100644 Modules/Platform/Windows-cl.cmake.in diff --git a/Modules/CMakeTestCCompiler.cmake b/Modules/CMakeTestCCompiler.cmake index 14291a7e7..c8f4d49a5 100644 --- a/Modules/CMakeTestCCompiler.cmake +++ b/Modules/CMakeTestCCompiler.cmake @@ -44,11 +44,6 @@ if(NOT CMAKE_C_COMPILER_WORKS) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the C compiler works failed with " "the following output:\n${__CMAKE_C_COMPILER_OUTPUT}\n\n") - # if the compiler is broken make sure to remove the platform file - # since Windows-cl configures both c/cxx files both need to be removed - # when c or c++ fails - file(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake ) - file(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake ) message(FATAL_ERROR "The C compiler \"${CMAKE_C_COMPILER}\" " "is not able to compile a simple test program.\nIt fails " "with the following output:\n ${__CMAKE_C_COMPILER_OUTPUT}\n\n" diff --git a/Modules/CMakeTestCXXCompiler.cmake b/Modules/CMakeTestCXXCompiler.cmake index 5ed826b78..3aa2075ae 100644 --- a/Modules/CMakeTestCXXCompiler.cmake +++ b/Modules/CMakeTestCXXCompiler.cmake @@ -34,11 +34,6 @@ endif() if(NOT CMAKE_CXX_COMPILER_WORKS) PrintTestCompilerStatus("CXX" " -- broken") - # if the compiler is broken make sure to remove the platform file - # since Windows-cl configures both c/cxx files both need to be removed - # when c or c++ fails - file(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake ) - file(REMOVE ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake ) file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log "Determining if the CXX compiler works failed with " "the following output:\n${__CMAKE_CXX_COMPILER_OUTPUT}\n\n") diff --git a/Modules/CMakeTestNMakeCLVersion.c b/Modules/CMakeTestNMakeCLVersion.c deleted file mode 100644 index 3cece2a63..000000000 --- a/Modules/CMakeTestNMakeCLVersion.c +++ /dev/null @@ -1,2 +0,0 @@ -VERSION=_MSC_VER - diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-cl.cmake index 265f5559a..293f19cbd 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-cl.cmake @@ -1,8 +1,3 @@ -# try to load any previously computed information for C on this platform -include( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake OPTIONAL) -# try to load any previously computed information for CXX on this platform -include( ${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake OPTIONAL) - set(WIN32 1) include(Platform/cl) @@ -19,81 +14,54 @@ if(NOT CMAKE_NO_BUILD_TYPE AND CMAKE_GENERATOR MATCHES "Visual Studio") "Semicolon separated list of supported configuration types, only supports Debug, Release, MinSizeRel, and RelWithDebInfo, anything else will be ignored.") mark_as_advanced(CMAKE_CONFIGURATION_TYPES) endif() -# does the compiler support pdbtype and is it the newer compiler -if(CMAKE_GENERATOR MATCHES "Visual Studio 8") - set(CMAKE_COMPILER_2005 1) -endif() # make sure to enable languages after setting configuration types enable_language(RC) set(CMAKE_COMPILE_RESOURCE "rc /fo ") -# for nmake we need to compute some information about the compiler -# that is being used. -# to avoid running these tests with each cmake run, the -# test results are saved in CMakeCPlatform.cmake, a file -# that is automatically copied into try_compile directories -# by the global generator. -set(MSVC_IDE 1) -if(CMAKE_GENERATOR MATCHES "Makefiles" OR CMAKE_GENERATOR MATCHES "Ninja") +if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") set(MSVC_IDE 0) - if(NOT CMAKE_VC_COMPILER_TESTS_RUN) - set(CMAKE_VC_COMPILER_TESTS 1) - set(testNmakeCLVersionFile - "${CMAKE_ROOT}/Modules/CMakeTestNMakeCLVersion.c") - string(REGEX REPLACE "/" "\\\\" testNmakeCLVersionFile "${testNmakeCLVersionFile}") - message(STATUS "Check for CL compiler version") - set(CMAKE_TEST_COMPILER ${CMAKE_C_COMPILER}) - if (NOT CMAKE_C_COMPILER) - set(CMAKE_TEST_COMPILER ${CMAKE_CXX_COMPILER}) - endif() - exec_program(${CMAKE_TEST_COMPILER} - ARGS /nologo -EP \"${testNmakeCLVersionFile}\" - OUTPUT_VARIABLE CMAKE_COMPILER_OUTPUT - RETURN_VALUE CMAKE_COMPILER_RETURN - ) - if(NOT CMAKE_COMPILER_RETURN) - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log - "Determining the version of compiler passed with the following output:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - string(REGEX REPLACE "\n" " " compilerVersion "${CMAKE_COMPILER_OUTPUT}") - string(REGEX REPLACE ".*VERSION=(.*)" "\\1" - compilerVersion "${compilerVersion}") - message(STATUS "Check for CL compiler version - ${compilerVersion}") - set(MSVC60) - set(MSVC70) - set(MSVC71) - set(MSVC80) - set(CMAKE_COMPILER_2005) - if("${compilerVersion}" LESS 1300) - set(MSVC60 1) - set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) - endif() - if("${compilerVersion}" EQUAL 1300) - set(MSVC70 1) - set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) - endif() - if("${compilerVersion}" EQUAL 1310) - set(MSVC71 1) - set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 0) - endif() - if("${compilerVersion}" EQUAL 1400) - set(MSVC80 1) - set(CMAKE_COMPILER_2005 1) - endif() - if("${compilerVersion}" EQUAL 1500) - set(MSVC90 1) - endif() - if("${compilerVersion}" EQUAL 1600) - set(MSVC10 1) - endif() - set(MSVC_VERSION "${compilerVersion}") - else() - message(STATUS "Check for CL compiler version - failed") - file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log - "Determining the version of compiler failed with the following output:\n" - "${CMAKE_COMPILER_OUTPUT}\n\n") - endif() +else() + set(MSVC_IDE 1) +endif() + +if(NOT MSVC_VERSION) + if(CMAKE_C_COMPILER_VERSION) + set(_compiler_version ${CMAKE_C_COMPILER_VERSION}) + else() + set(_compiler_version ${CMAKE_CXX_COMPILER_VERSION}) + endif() + if("${_compiler_version}" MATCHES "^([0-9]+)\\.([0-9]+)") + math(EXPR MSVC_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") + else() + message(FATAL_ERROR "MSVC compiler version not detected properly: ${_compiler_version}") + endif() + + set(MSVC10) + set(MSVC11) + set(MSVC60) + set(MSVC70) + set(MSVC71) + set(MSVC80) + set(MSVC90) + set(CMAKE_COMPILER_2005) + set(CMAKE_COMPILER_SUPPORTS_PDBTYPE) + if(NOT "${_compiler_version}" VERSION_LESS 17) + set(MSVC11 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 16) + set(MSVC10 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 15) + set(MSVC90 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 14) + set(MSVC80 1) + set(CMAKE_COMPILER_2005 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 13.10) + set(MSVC71 1) + elseif(NOT "${_compiler_version}" VERSION_LESS 13) + set(MSVC70 1) + else() + set(MSVC60 1) + set(CMAKE_COMPILER_SUPPORTS_PDBTYPE 1) endif() endif() @@ -195,14 +163,3 @@ set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) - -# save computed information for this platform -if(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCPlatform.cmake") - configure_file(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCPlatform.cmake IMMEDIATE) -endif() - -if(NOT EXISTS "${CMAKE_PLATFORM_ROOT_BIN}/CMakeCXXPlatform.cmake") - configure_file(${CMAKE_ROOT}/Modules/Platform/Windows-cl.cmake.in - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeCXXPlatform.cmake IMMEDIATE) -endif() diff --git a/Modules/Platform/Windows-cl.cmake.in b/Modules/Platform/Windows-cl.cmake.in deleted file mode 100644 index 1a65004c4..000000000 --- a/Modules/Platform/Windows-cl.cmake.in +++ /dev/null @@ -1,13 +0,0 @@ -set(CMAKE_VC_COMPILER_TESTS_RUN 1) -set(CMAKE_COMPILER_SUPPORTS_PDBTYPE @CMAKE_COMPILER_SUPPORTS_PDBTYPE@) -set(CMAKE_COMPILER_2005 @CMAKE_COMPILER_2005@) -set(CMAKE_CL_64 @CMAKE_CL_64@) -set(MSVC60 @MSVC60@) -set(MSVC70 @MSVC70@) -set(MSVC71 @MSVC71@) -set(MSVC80 @MSVC80@) -set(MSVC90 @MSVC90@) -set(MSVC10 @MSVC10@) -set(MSVC_IDE @MSVC_IDE@) -set(MSVC_VERSION @MSVC_VERSION@) -set(WIN32 1) diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 39c9ae1c3..d1889809d 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -19,7 +19,6 @@ cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator() { - this->VersionId = "MSVC10"; this->FindMakeProgramFile = "CMakeVS10FindMake.cmake"; std::string vc10Express; this->ExpressEdition = cmSystemTools::ReadRegistryValue( diff --git a/Source/cmGlobalVisualStudio11Generator.cxx b/Source/cmGlobalVisualStudio11Generator.cxx index ab1187df8..7bb4d0c4a 100644 --- a/Source/cmGlobalVisualStudio11Generator.cxx +++ b/Source/cmGlobalVisualStudio11Generator.cxx @@ -16,7 +16,6 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator() { - this->VersionId = "MSVC11"; this->FindMakeProgramFile = "CMakeVS11FindMake.cmake"; this->ExpressEdition = false; // TODO: VS 11 Express support this->PlatformToolset = "v110"; diff --git a/Source/cmGlobalVisualStudio6Generator.cxx b/Source/cmGlobalVisualStudio6Generator.cxx index ca06b6631..e8ca78873 100644 --- a/Source/cmGlobalVisualStudio6Generator.cxx +++ b/Source/cmGlobalVisualStudio6Generator.cxx @@ -32,7 +32,6 @@ std::string GetVS6TargetName(const std::string& targetName) cmGlobalVisualStudio6Generator::cmGlobalVisualStudio6Generator() { - this->VersionId = "MSVC60"; this->FindMakeProgramFile = "CMakeVS6FindMake.cmake"; } diff --git a/Source/cmGlobalVisualStudio71Generator.cxx b/Source/cmGlobalVisualStudio71Generator.cxx index d99fa036a..ab2308f50 100644 --- a/Source/cmGlobalVisualStudio71Generator.cxx +++ b/Source/cmGlobalVisualStudio71Generator.cxx @@ -18,7 +18,6 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio71Generator::cmGlobalVisualStudio71Generator() { - this->VersionId = "MSVC71"; this->FindMakeProgramFile = "CMakeVS71FindMake.cmake"; this->ProjectConfigurationSectionName = "ProjectConfiguration"; } diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index 0567d5598..b6eea5d0b 100644 --- a/Source/cmGlobalVisualStudio7Generator.cxx +++ b/Source/cmGlobalVisualStudio7Generator.cxx @@ -18,7 +18,6 @@ cmGlobalVisualStudio7Generator::cmGlobalVisualStudio7Generator() { - this->VersionId = "MSVC70"; this->FindMakeProgramFile = "CMakeVS7FindMake.cmake"; } diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index f46918828..2e3b53018 100644 --- a/Source/cmGlobalVisualStudio8Generator.cxx +++ b/Source/cmGlobalVisualStudio8Generator.cxx @@ -19,7 +19,6 @@ //---------------------------------------------------------------------------- cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator() { - this->VersionId = "MSVC80"; this->FindMakeProgramFile = "CMakeVS8FindMake.cmake"; this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms"; } diff --git a/Source/cmGlobalVisualStudio9Generator.cxx b/Source/cmGlobalVisualStudio9Generator.cxx index 531395b8c..70af50d7b 100644 --- a/Source/cmGlobalVisualStudio9Generator.cxx +++ b/Source/cmGlobalVisualStudio9Generator.cxx @@ -19,7 +19,6 @@ cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator() { - this->VersionId = "MSVC90"; this->FindMakeProgramFile = "CMakeVS9FindMake.cmake"; } diff --git a/Source/cmGlobalVisualStudioGenerator.cxx b/Source/cmGlobalVisualStudioGenerator.cxx index feb3ac98b..0968b771d 100644 --- a/Source/cmGlobalVisualStudioGenerator.cxx +++ b/Source/cmGlobalVisualStudioGenerator.cxx @@ -22,7 +22,6 @@ cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator() { this->ArchitectureId = "X86"; - this->VersionId = 0; } //---------------------------------------------------------------------------- @@ -495,11 +494,6 @@ void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf) { mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId); mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId); - - if (this->VersionId) - { - mf->AddDefinition(this->VersionId, "1"); - } } //---------------------------------------------------------------------------- diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h index a042dc0db..cebf7d741 100644 --- a/Source/cmGlobalVisualStudioGenerator.h +++ b/Source/cmGlobalVisualStudioGenerator.h @@ -99,7 +99,6 @@ protected: typedef std::map UtilityDependsMap; UtilityDependsMap UtilityDepends; const char* ArchitectureId; - const char* VersionId; private: void ComputeTargetObjects(cmGeneratorTarget* gt) const; From f3ddfef137f56c9660a7ad65807387987bcb2996 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 23 Aug 2012 12:00:55 -0400 Subject: [PATCH 069/152] Modernize MSVC compiler information files Remove the old-style "Windows-cl.cmake" and its helper "cl.cmake". Load the information through new-style "Platform/Windows-MSVC-.cmake" files. Factor information common to C and CXX into a helper file "Platform/Windows-MSVC.cmake" loaded from the per-language files. --- Modules/Platform/Windows-MSVC-C.cmake | 2 + Modules/Platform/Windows-MSVC-CXX.cmake | 3 + .../{Windows-cl.cmake => Windows-MSVC.cmake} | 113 ++++++++++++------ Modules/Platform/cl.cmake | 62 ---------- 4 files changed, 81 insertions(+), 99 deletions(-) create mode 100644 Modules/Platform/Windows-MSVC-C.cmake create mode 100644 Modules/Platform/Windows-MSVC-CXX.cmake rename Modules/Platform/{Windows-cl.cmake => Windows-MSVC.cmake} (53%) delete mode 100644 Modules/Platform/cl.cmake diff --git a/Modules/Platform/Windows-MSVC-C.cmake b/Modules/Platform/Windows-MSVC-C.cmake new file mode 100644 index 000000000..e81df9f83 --- /dev/null +++ b/Modules/Platform/Windows-MSVC-C.cmake @@ -0,0 +1,2 @@ +include(Platform/Windows-MSVC) +__windows_compiler_msvc(C) diff --git a/Modules/Platform/Windows-MSVC-CXX.cmake b/Modules/Platform/Windows-MSVC-CXX.cmake new file mode 100644 index 000000000..fdd1dae05 --- /dev/null +++ b/Modules/Platform/Windows-MSVC-CXX.cmake @@ -0,0 +1,3 @@ +include(Platform/Windows-MSVC) +set(_COMPILE_CXX " /TP") +__windows_compiler_msvc(CXX) diff --git a/Modules/Platform/Windows-cl.cmake b/Modules/Platform/Windows-MSVC.cmake similarity index 53% rename from Modules/Platform/Windows-cl.cmake rename to Modules/Platform/Windows-MSVC.cmake index 293f19cbd..b3cb19b60 100644 --- a/Modules/Platform/Windows-cl.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -1,6 +1,42 @@ -set(WIN32 1) -include(Platform/cl) +#============================================================================= +# Copyright 2001-2012 Kitware, Inc. +# +# 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. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# This module is shared by multiple languages; use include blocker. +if(__WINDOWS_MSVC) + return() +endif() +set(__WINDOWS_MSVC 1) + +set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") +set(CMAKE_LINK_LIBRARY_FLAG "") +set(MSVC 1) + +# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree +# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache +# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) +# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex +if(NOT DEFINED CMAKE_LINKER) + set(CMAKE_LINKER link) +endif() + +if(CMAKE_VERBOSE_MAKEFILE) + set(CMAKE_CL_NOLOGO) +else() + set(CMAKE_CL_NOLOGO "/nologo") +endif() + +set(WIN32 1) set(CMAKE_CREATE_WIN32_EXE /subsystem:windows) set(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) @@ -79,43 +115,16 @@ if("${MSVC_VERSION}" GREATER 1599) endif() # default to Debug builds -if(MSVC_VERSION GREATER 1310) - # for 2005 make sure the manifest is put in the dll with mt - set(CMAKE_CXX_CREATE_SHARED_LIBRARY " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - set(CMAKE_CXX_CREATE_SHARED_MODULE " -E vs_link_dll ${CMAKE_CXX_CREATE_SHARED_MODULE}") - # create a C shared library - set(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - # create a C shared module just copy the shared library rule - set(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") - set(CMAKE_CXX_LINK_EXECUTABLE " -E vs_link_exe ${CMAKE_CXX_LINK_EXECUTABLE}") - set(CMAKE_C_LINK_EXECUTABLE " -E vs_link_exe ${CMAKE_C_LINK_EXECUTABLE}") +set(CMAKE_BUILD_TYPE_INIT Debug) - set(CMAKE_BUILD_TYPE_INIT Debug) - set (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /EHsc /GR") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") - set (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /RTC1") - set (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib ") - set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT}") +if(MSVC_VERSION GREATER 1310) + set(_RTC1 "/RTC1") + set(_FLAGS_CXX " /GR /EHsc") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") else() - set(CMAKE_BUILD_TYPE_INIT Debug) - set (CMAKE_CXX_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000 /GX /GR") - set (CMAKE_CXX_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") - set (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000") - set (CMAKE_C_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od /GZ") - set (CMAKE_C_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") - set (CMAKE_C_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") - set (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") - set (CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + set(_RTC1 "/GZ") + set(_FLAGS_CXX " /GR /GX") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") endif() set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") @@ -163,3 +172,33 @@ set (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT set (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_RELEASE_INIT ${CMAKE_EXE_LINKER_FLAGS_RELEASE_INIT}) set (CMAKE_MODULE_LINKER_FLAGS_MINSIZEREL_INIT ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL_INIT}) + +macro(__windows_compiler_msvc lang) + if(NOT "${CMAKE_${lang}_COMPILER_VERSION}" VERSION_LESS 14) + # for 2005 make sure the manifest is put in the dll with mt + set(_CMAKE_VS_LINK_DLL " -E vs_link_dll ") + set(_CMAKE_VS_LINK_EXE " -E vs_link_exe ") + endif() + set(CMAKE_${lang}_CREATE_SHARED_LIBRARY + "${_CMAKE_VS_LINK_DLL} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:. ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_CREATE_SHARED_MODULE ${CMAKE_${lang}_CREATE_SHARED_LIBRARY}) + set(CMAKE_${lang}_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") + + set(CMAKE_${lang}_COMPILE_OBJECT + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /Fo /Fd -c ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE + " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} -E ${CMAKE_END_TEMP_FILE}") + set(CMAKE_${lang}_CREATE_ASSEMBLY_SOURCE + " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO}${_COMPILE_${lang}} /FoNUL /FAs /Fa /c ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_USE_RESPONSE_FILE_FOR_OBJECTS 1) + set(CMAKE_${lang}_LINK_EXECUTABLE + "${_CMAKE_VS_LINK_EXE} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /implib: /version:. ${CMAKE_END_TEMP_FILE}") + + set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") + set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") + set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "/MD /O1 /Ob1 /D NDEBUG") +endmacro() diff --git a/Modules/Platform/cl.cmake b/Modules/Platform/cl.cmake deleted file mode 100644 index 9e4d6070e..000000000 --- a/Modules/Platform/cl.cmake +++ /dev/null @@ -1,62 +0,0 @@ -set(CMAKE_LIBRARY_PATH_FLAG "-LIBPATH:") -set(CMAKE_LINK_LIBRARY_FLAG "") -set(MSVC 1) - -# hack: if a new cmake (which uses CMAKE__LINKER) runs on an old build tree -# (where link was hardcoded) and where CMAKE_LINKER isn't in the cache -# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun) -# hardcode CMAKE_LINKER here to link, so it behaves as it did before, Alex -if(NOT DEFINED CMAKE_LINKER) - set(CMAKE_LINKER link) -endif() - -if(CMAKE_VERBOSE_MAKEFILE) - set(CMAKE_CL_NOLOGO) -else() - set(CMAKE_CL_NOLOGO "/nologo") -endif() -# create a shared C++ library -set(CMAKE_CXX_CREATE_SHARED_LIBRARY - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /pdb: /dll /version:. ${CMAKE_END_TEMP_FILE}") -set(CMAKE_CXX_CREATE_SHARED_MODULE ${CMAKE_CXX_CREATE_SHARED_LIBRARY}) - -# create a C shared library -set(CMAKE_C_CREATE_SHARED_LIBRARY "${CMAKE_CXX_CREATE_SHARED_LIBRARY}") - -# create a C shared module -set(CMAKE_C_CREATE_SHARED_MODULE "${CMAKE_CXX_CREATE_SHARED_MODULE}") - -# create a C++ static library -set(CMAKE_CXX_CREATE_STATIC_LIBRARY " /lib ${CMAKE_CL_NOLOGO} /out: ") - -# create a C static library -set(CMAKE_C_CREATE_STATIC_LIBRARY "${CMAKE_CXX_CREATE_STATIC_LIBRARY}") - -# compile a C++ file into an object file -set(CMAKE_CXX_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP /Fo /Fd -c ${CMAKE_END_TEMP_FILE}") - -# compile a C file into an object file -set(CMAKE_C_COMPILE_OBJECT - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /Fo /Fd -c ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_C_USE_RESPONSE_FILE_FOR_OBJECTS 1) -set(CMAKE_C_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /implib: /version:. ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_OBJECTS 1) -set(CMAKE_CXX_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /implib: /version:. ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_C_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} -E ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE - " > ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP -E ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_C_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /FAs /FoNUL /Fa /c ${CMAKE_END_TEMP_FILE}") - -set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE - " ${CMAKE_START_TEMP_FILE} ${CMAKE_CL_NOLOGO} /TP /FAs /FoNUL /Fa /c ${CMAKE_END_TEMP_FILE}") - From 16fa7b73958ca52bebd0d3a2dd6374bd391ed64d Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 30 Aug 2012 16:08:16 -0400 Subject: [PATCH 070/152] VS: Fix MSVC_IDE definition recently broken by refactoring In commit 485a940e (VS: Simplify MSVC version reporting, 2012-08-23) we accidentally flipped the 0/1 values of MSVC_IDE. Flip them back and teach the CheckCompilerRelatedVariables test to check the variable. --- Modules/Platform/Windows-MSVC.cmake | 4 ++-- Tests/CheckCompilerRelatedVariables/CMakeLists.txt | 11 +++++++++++ 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index b3cb19b60..238aa2467 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -56,9 +56,9 @@ enable_language(RC) set(CMAKE_COMPILE_RESOURCE "rc /fo ") if("${CMAKE_GENERATOR}" MATCHES "Visual Studio") - set(MSVC_IDE 0) -else() set(MSVC_IDE 1) +else() + set(MSVC_IDE 0) endif() if(NOT MSVC_VERSION) diff --git a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt index 8b279a5c4..20001e6ed 100644 --- a/Tests/CheckCompilerRelatedVariables/CMakeLists.txt +++ b/Tests/CheckCompilerRelatedVariables/CMakeLists.txt @@ -46,6 +46,7 @@ echo_var(MSVC80) echo_var(MSVC90) echo_var(MSVC10) echo_var(MSVC11) +echo_var(MSVC_IDE) if(MSVC) # @@ -60,6 +61,13 @@ if(MSVC) else() message(FATAL_ERROR "error: ${msvc_total} MSVC** variables are defined -- exactly 1 expected") endif() + if(NOT DEFINED MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE not defined but should be!") + elseif("${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND NOT MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE is not true but should be (${CMAKE_GENERATOR})!") + elseif(NOT "${CMAKE_GENERATOR}" MATCHES "Visual Studio" AND MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE is true but should not be (${CMAKE_GENERATOR})!") + endif() else() # # The compiler is something other than cl... None of the MSVC** variables @@ -70,6 +78,9 @@ else() else() message(FATAL_ERROR "error: ${msvc_total} MSVC** variables are defined -- exactly 0 expected") endif() + if(DEFINED MSVC_IDE) + message(FATAL_ERROR "MSVC_IDE is defined but should not be!") + endif() endif() From 4bc8879e847fcad84926828b57c740910a327f33 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 31 Aug 2012 00:01:03 -0400 Subject: [PATCH 071/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c5c532608..e7cac196b 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 9) -set(CMake_VERSION_TWEAK 20120830) +set(CMake_VERSION_TWEAK 20120831) #set(CMake_VERSION_RC 1) From 4eaea3c358eba2550223d884d7b0523a91624237 Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 31 Aug 2012 07:32:01 -0400 Subject: [PATCH 072/152] add_library: Document POSITION_INDEPENDENT_CODE default (#13479) The POSITION_INDEPENDENT_CODE property documentation states that its default value depends on whether SHARED or MODULE is given to the add_library call. Since these are options to the add_library command we should document on the command how they affect the property. While at it, add a missing space to the POSITION_INDEPENDENT_CODE property documentation. --- Source/cmAddLibraryCommand.h | 4 +++- Source/cmTarget.cxx | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Source/cmAddLibraryCommand.h b/Source/cmAddLibraryCommand.h index b330e68c8..c14456535 100644 --- a/Source/cmAddLibraryCommand.h +++ b/Source/cmAddLibraryCommand.h @@ -78,7 +78,9 @@ public: "functionality. " "If no type is given explicitly the type is STATIC or SHARED based " "on whether the current value of the variable BUILD_SHARED_LIBS is " - "true." + "true. " + "For SHARED and MODULE libraries the POSITION_INDEPENDENT_CODE " + "target property is set to TRUE automatically." "\n" "By default the library file will be created in the build tree " "directory corresponding to the source tree directory in which " diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index b0d4834a0..789713fcc 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -763,7 +763,7 @@ void cmTarget::DefineProperties(cmake *cm) "This property is true by default for SHARED and MODULE library " "targets and false otherwise. " "This property is initialized by the value of the variable " - "CMAKE_POSITION_INDEPENDENT_CODE if it is set when a target is" + "CMAKE_POSITION_INDEPENDENT_CODE if it is set when a target is " "created."); cm->DefineProperty From 80a95e185e026d77019056b59e81102df9056dea Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 1 Sep 2012 00:01:01 -0400 Subject: [PATCH 073/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e7cac196b..e12139b57 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 9) -set(CMake_VERSION_TWEAK 20120831) +set(CMake_VERSION_TWEAK 20120901) #set(CMake_VERSION_RC 1) From fbda7bb9f23bfbd7efdfc0ef64504f4c2d280267 Mon Sep 17 00:00:00 2001 From: Benjamin Eikel Date: Sat, 1 Sep 2012 10:19:12 +0200 Subject: [PATCH 074/152] Initial version of find module --- Modules/FindGLEW.cmake | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Modules/FindGLEW.cmake diff --git a/Modules/FindGLEW.cmake b/Modules/FindGLEW.cmake new file mode 100644 index 000000000..37dff0324 --- /dev/null +++ b/Modules/FindGLEW.cmake @@ -0,0 +1,30 @@ +# - Find the OpenGL Extension Wrangler Library (GLEW) +# This module defines the following variables: +# GLEW_INCLUDE_DIRS - include directories for GLEW +# GLEW_LIBRARIES - libraries to link against GLEW +# GLEW_FOUND - true if GLEW has been found and can be used + +#============================================================================= +# Copyright 2012 Benjamin Eikel +# +# 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. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +find_path(GLEW_INCLUDE_DIR GL/glew.h) +find_library(GLEW_LIBRARY NAMES GLEW glew32 glew glew32s PATH_SUFFIXES lib64) + +set(GLEW_INCLUDE_DIRS ${GLEW_INCLUDE_DIR}) +set(GLEW_LIBRARIES ${GLEW_LIBRARY}) + +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +find_package_handle_standard_args(GLEW + REQUIRED_VARS GLEW_INCLUDE_DIR GLEW_LIBRARY) + +mark_as_advanced(GLEW_INCLUDE_DIR GLEW_LIBRARY) From e3aac9b8d66bb6d2287f43784c05b4a020673da5 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sun, 2 Sep 2012 00:01:03 -0400 Subject: [PATCH 075/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e12139b57..2fdd4c37b 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 9) -set(CMake_VERSION_TWEAK 20120901) +set(CMake_VERSION_TWEAK 20120902) #set(CMake_VERSION_RC 1) From 6ef858b50195ece350800de746e5c8126dfbae94 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Mon, 3 Sep 2012 00:01:03 -0400 Subject: [PATCH 076/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 2fdd4c37b..d038f2898 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 9) -set(CMake_VERSION_TWEAK 20120902) +set(CMake_VERSION_TWEAK 20120903) #set(CMake_VERSION_RC 1) From aa1076f4600a94494da355d641aa0a5773a67863 Mon Sep 17 00:00:00 2001 From: Xavier Besseron Date: Mon, 3 Sep 2012 10:45:05 +0200 Subject: [PATCH 077/152] cmCTestSVN: Add the new SVNInfo structure It represents information of an SVN repository. It can be the base repository or an external one. --- Source/CTest/cmCTestSVN.cxx | 26 ++++++++++++++++++++++++++ Source/CTest/cmCTestSVN.h | 25 +++++++++++++++++++++++++ 2 files changed, 51 insertions(+) diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index fab9a8cba..7ca87e2ed 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -448,3 +448,29 @@ void cmCTestSVN::WriteXMLGlobal(std::ostream& xml) xml << "\t" << this->Base << "\n"; } + +//---------------------------------------------------------------------------- +std::string cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const +{ + std::string local_path; + + // Add local path prefix if not empty + if (!this->LocalPath.empty()) + { + local_path += this->LocalPath; + local_path += "/"; + } + + // Add path with base prefix removed + if(path.size() > this->Base.size() && + strncmp(path.c_str(), this->Base.c_str(), this->Base.size()) == 0) + { + local_path += (path.c_str() + this->Base.size()); + } + else + { + local_path += path; + } + + return local_path; +} diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index f72c58fb0..97eeaf57e 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -42,6 +42,31 @@ private: // Directory under repository root checked out in working tree. std::string Base; + // Information about an SVN repository (root repository or external) + struct SVNInfo { + + SVNInfo(const char* path) : LocalPath(path) {} + // Remove base from the filename + std::string BuildLocalPath(std::string const& path) const; + + // LocalPath relative to the main source directory. + std::string LocalPath; + + // URL of repository directory checked out in the working tree. + std::string URL; + + // URL of repository root directory. + std::string Root; + + // Directory under repository root checked out in working tree. + std::string Base; + + // Old and new repository revisions. + std::string OldRevision; + std::string NewRevision; + + }; + std::string LoadInfo(); void LoadModifications(); void LoadRevisions(); From c0f89e9c146ebb2cbb3c228f09c295875256d989 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 3 Sep 2012 11:11:45 -0400 Subject: [PATCH 078/152] magrathea: Tell cmELF about DT_RUNPATH (#13497) Our Linux release machine 'magrathea' has a very old Linux to help build portable binaries. It is so old that does not define the DT_RUNPATH constant. Define the correct value in the build flags to activate handling of ELF RUNPATH entries in the binary release. --- Utilities/Release/magrathea_release.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake index 1b2ae02c7..60c1a8860 100644 --- a/Utilities/Release/magrathea_release.cmake +++ b/Utilities/Release/magrathea_release.cmake @@ -3,6 +3,8 @@ set(HOST magrathea) set(MAKE_PROGRAM "make") set(CC gcc332s) set(CXX c++332s) +set(CFLAGS -DDT_RUNPATH=29) +set(CXXFLAGS -DDT_RUNPATH=29) set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CURSES_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libncurses.a From 508ed6940b447c2fb6b5fe4f036138ce57ab3c4c Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Tue, 4 Sep 2012 00:01:03 -0400 Subject: [PATCH 079/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index d038f2898..fa9b70846 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 9) -set(CMake_VERSION_TWEAK 20120903) +set(CMake_VERSION_TWEAK 20120904) #set(CMake_VERSION_RC 1) From 2f204bc176e418e810de7034903974e7edb46b14 Mon Sep 17 00:00:00 2001 From: Xavier Besseron Date: Fri, 24 Aug 2012 10:30:09 +0200 Subject: [PATCH 080/152] cmCTestSVN: Extend Revision struct with SVN repo information Also rename DoRevision to DoRevisionSVN since the signature changes. --- Source/CTest/cmCTestSVN.cxx | 11 ++++++++--- Source/CTest/cmCTestSVN.h | 7 +++++-- 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 7ca87e2ed..15d9487be 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -18,6 +18,11 @@ #include +struct cmCTestSVN::Revision: public cmCTestVC::Revision +{ + cmCTestSVN::SVNInfo* SVNInfo; +}; + //---------------------------------------------------------------------------- cmCTestSVN::cmCTestSVN(cmCTest* ct, std::ostream& log): cmCTestGlobalVC(ct, log) @@ -325,7 +330,7 @@ private: { if(strcmp(name, "logentry") == 0) { - this->SVN->DoRevision(this->Rev, this->Changes); + this->SVN->DoRevisionSVN(this->Rev, this->Changes); } else if(strcmp(name, "path") == 0 && !this->CData.empty()) { @@ -378,8 +383,8 @@ void cmCTestSVN::LoadRevisions() } //---------------------------------------------------------------------------- -void cmCTestSVN::DoRevision(Revision const& revision, - std::vector const& changes) +void cmCTestSVN::DoRevisionSVN(Revision const& revision, + std::vector const& changes) { // Guess the base checkout path from the changes if necessary. if(this->Base.empty() && !changes.empty()) diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index 97eeaf57e..12feba934 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -67,6 +67,9 @@ private: }; + // Extended revision structure to include info about external it refers to. + struct Revision; + std::string LoadInfo(); void LoadModifications(); void LoadRevisions(); @@ -74,8 +77,8 @@ private: void GuessBase(std::vector const& changes); const char* LocalPath(std::string const& path); - void DoRevision(Revision const& revision, - std::vector const& changes); + void DoRevisionSVN(Revision const& revision, + std::vector const& changes); void WriteXMLGlobal(std::ostream& xml); From 8d1e10296ae852afd80c789efa73492f87543034 Mon Sep 17 00:00:00 2001 From: Xavier Besseron Date: Fri, 24 Aug 2012 10:47:59 +0200 Subject: [PATCH 081/152] cmCTestSVN: Add the Repositories list and the RootInfo pointer The Repository list will contain the SVNInfo of all the repositories (root and external ones). The RootInfo pointer will point to the SVNInfo structure of the root repository. --- Source/CTest/cmCTestSVN.h | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index 12feba934..a084d40bc 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -70,6 +70,12 @@ private: // Extended revision structure to include info about external it refers to. struct Revision; + // Info of all the repositories (root, externals and nested ones). + std::list Repositories; + + // Pointer to the infos of the root repository. + SVNInfo* RootInfo; + std::string LoadInfo(); void LoadModifications(); void LoadRevisions(); From fb6d5136926fc142fa893f853b62c5ca8df04d6c Mon Sep 17 00:00:00 2001 From: Xavier Besseron Date: Fri, 24 Aug 2012 10:48:57 +0200 Subject: [PATCH 082/152] cmCTestSVN: Create the SVNInfo for the root repository --- Source/CTest/cmCTestSVN.cxx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 15d9487be..53dd20e3d 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -115,6 +115,9 @@ std::string cmCTestSVN::LoadInfo() //---------------------------------------------------------------------------- void cmCTestSVN::NoteOldRevision() { + // Info for root repository + this->Repositories.push_back( SVNInfo("") ); + this->RootInfo = &(this->Repositories.back()); this->OldRevision = this->LoadInfo(); this->Log << "Revision before update: " << this->OldRevision << "\n"; cmCTestLog(this->CTest, HANDLER_OUTPUT, " Old revision of repository is: " From 41f0f83542ce8d69e4d9a4512a6dc66327f20c8d Mon Sep 17 00:00:00 2001 From: Xavier Besseron Date: Mon, 3 Sep 2012 10:50:07 +0200 Subject: [PATCH 083/152] cmCTestSVN: Use the SVNInfo structure - Suppress the URL, Root, Base fields from the cmCTestSVN class - Update the code to use RootInfo instead - LoadInfo(), GuessBase(), and a new LoadRevision() functions work on a given SVNInfo - Use the implementation from the base class for LocalPath(), correct path is built by SVNInfo::BuildLocalPath() instead --- Source/CTest/cmCTestSVN.cxx | 150 +++++++++++++++++++++--------------- Source/CTest/cmCTestSVN.h | 15 +--- 2 files changed, 90 insertions(+), 75 deletions(-) diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 53dd20e3d..32b1ef97a 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -49,8 +49,11 @@ void cmCTestSVN::CleanupImpl() class cmCTestSVN::InfoParser: public cmCTestVC::LineParser { public: - InfoParser(cmCTestSVN* svn, const char* prefix, std::string& rev): - SVN(svn), Rev(rev) + InfoParser(cmCTestSVN* svn, + const char* prefix, + std::string& rev, + SVNInfo& svninfo): + Rev(rev), SVNRepo(svninfo) { this->SetLog(&svn->Log, prefix); this->RegexRev.compile("^Revision: ([0-9]+)"); @@ -58,8 +61,8 @@ public: this->RegexRoot.compile("^Repository Root: +([^ ]+) *$"); } private: - cmCTestSVN* SVN; std::string& Rev; + cmCTestSVN::SVNInfo& SVNRepo; cmsys::RegularExpression RegexRev; cmsys::RegularExpression RegexURL; cmsys::RegularExpression RegexRoot; @@ -71,11 +74,11 @@ private: } else if(this->RegexURL.find(this->Line)) { - this->SVN->URL = this->RegexURL.match(1); + this->SVNRepo.URL = this->RegexURL.match(1); } else if(this->RegexRoot.find(this->Line)) { - this->SVN->Root = this->RegexRoot.match(1); + this->SVNRepo.Root = this->RegexRoot.match(1); } return true; } @@ -100,13 +103,13 @@ static bool cmCTestSVNPathStarts(std::string const& p1, std::string const& p2) } //---------------------------------------------------------------------------- -std::string cmCTestSVN::LoadInfo() +std::string cmCTestSVN::LoadInfo(SVNInfo& svninfo) { // Run "svn info" to get the repository info from the work tree. const char* svn = this->CommandLineTool.c_str(); - const char* svn_info[] = {svn, "info", 0}; + const char* svn_info[] = {svn, "info", svninfo.LocalPath.c_str(), 0}; std::string rev; - InfoParser out(this, "info-out> ", rev); + InfoParser out(this, "info-out> ", rev, svninfo); OutputLogger err(this->Log, "info-err> "); this->RunChild(svn_info, &out, &err); return rev; @@ -118,55 +121,78 @@ void cmCTestSVN::NoteOldRevision() // Info for root repository this->Repositories.push_back( SVNInfo("") ); this->RootInfo = &(this->Repositories.back()); - this->OldRevision = this->LoadInfo(); - this->Log << "Revision before update: " << this->OldRevision << "\n"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " Old revision of repository is: " - << this->OldRevision << "\n"); + + // Get info for the root repositiry + SVNInfo& svninfo = *RootInfo; + svninfo.OldRevision = this->LoadInfo(svninfo); + this->Log << "Revision for repository '" << svninfo.LocalPath + << "' before update: " << svninfo.OldRevision << "\n"; + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " Old revision of external repository '" + << svninfo.LocalPath << "' is: " + << svninfo.OldRevision << "\n"); + + // Set the global old revision to the one of the root + this->OldRevision = this->RootInfo->OldRevision; this->PriorRev.Rev = this->OldRevision; } //---------------------------------------------------------------------------- void cmCTestSVN::NoteNewRevision() { - this->NewRevision = this->LoadInfo(); - this->Log << "Revision after update: " << this->NewRevision << "\n"; - cmCTestLog(this->CTest, HANDLER_OUTPUT, " New revision of repository is: " - << this->NewRevision << "\n"); + // Get info for the root repository + SVNInfo& svninfo = *RootInfo; + svninfo.NewRevision = this->LoadInfo(svninfo); + this->Log << "Revision for repository '" << svninfo.LocalPath + << "' after update: " << svninfo.NewRevision << "\n"; + cmCTestLog(this->CTest, HANDLER_OUTPUT, + " New revision of external repository '" + << svninfo.LocalPath << "' is: " + << svninfo.NewRevision << "\n"); - // this->Root = ""; // uncomment to test GuessBase - this->Log << "URL = " << this->URL << "\n"; - this->Log << "Root = " << this->Root << "\n"; + // svninfo.Root = ""; // uncomment to test GuessBase + this->Log << "Repository '" << svninfo.LocalPath + << "' URL = " << svninfo.URL << "\n"; + this->Log << "Repository '" << svninfo.LocalPath + << "' Root = " << svninfo.Root << "\n"; - // Compute the base path the working tree has checked out under - // the repository root. - if(!this->Root.empty() && cmCTestSVNPathStarts(this->URL, this->Root)) - { - this->Base = cmCTest::DecodeURL(this->URL.substr(this->Root.size())); - this->Base += "/"; - } - this->Log << "Base = " << this->Base << "\n"; + // Compute the base path the working tree has checked out under + // the repository root. + if(!svninfo.Root.empty() + && cmCTestSVNPathStarts(svninfo.URL, svninfo.Root)) + { + svninfo.Base = cmCTest::DecodeURL( + svninfo.URL.substr(svninfo.Root.size())); + svninfo.Base += "/"; + } + this->Log << "Repository '" << svninfo.LocalPath + << "' Base = " << svninfo.Base << "\n"; + + // Set the global new revision to the one of the root + this->NewRevision = this->RootInfo->NewRevision; } //---------------------------------------------------------------------------- -void cmCTestSVN::GuessBase(std::vector const& changes) +void cmCTestSVN::GuessBase(SVNInfo& svninfo, + std::vector const& changes) { // Subversion did not give us a good repository root so we need to // guess the base path from the URL and the paths in a revision with // changes under it. // Consider each possible URL suffix from longest to shortest. - for(std::string::size_type slash = this->URL.find('/'); - this->Base.empty() && slash != std::string::npos; - slash = this->URL.find('/', slash+1)) + for(std::string::size_type slash = svninfo.URL.find('/'); + svninfo.Base.empty() && slash != std::string::npos; + slash = svninfo.URL.find('/', slash+1)) { // If the URL suffix is a prefix of at least one path then it is the base. - std::string base = cmCTest::DecodeURL(this->URL.substr(slash)); + std::string base = cmCTest::DecodeURL(svninfo.URL.substr(slash)); for(std::vector::const_iterator ci = changes.begin(); - this->Base.empty() && ci != changes.end(); ++ci) + svninfo.Base.empty() && ci != changes.end(); ++ci) { if(cmCTestSVNPathStarts(ci->Path, base)) { - this->Base = base; + svninfo.Base = base; } } } @@ -175,25 +201,9 @@ void cmCTestSVN::GuessBase(std::vector const& changes) // base lie under its path. If no base was found then the working // tree must be a checkout of the entire repo and this will match // the leading slash in all paths. - this->Base += "/"; + svninfo.Base += "/"; - this->Log << "Guessed Base = " << this->Base << "\n"; -} - -//---------------------------------------------------------------------------- -const char* cmCTestSVN::LocalPath(std::string const& path) -{ - if(path.size() > this->Base.size() && - strncmp(path.c_str(), this->Base.c_str(), this->Base.size()) == 0) - { - // This path lies under the base, so return a relative path. - return path.c_str() + this->Base.size(); - } - else - { - // This path does not lie under the base, so ignore it. - return 0; - } + this->Log << "Guessed Base = " << svninfo.Base << "\n"; } //---------------------------------------------------------------------------- @@ -282,11 +292,13 @@ class cmCTestSVN::LogParser: public cmCTestVC::OutputLogger, private cmXMLParser { public: - LogParser(cmCTestSVN* svn, const char* prefix): - OutputLogger(svn->Log, prefix), SVN(svn) { this->InitializeParser(); } + LogParser(cmCTestSVN* svn, const char* prefix, SVNInfo& svninfo): + OutputLogger(svn->Log, prefix), SVN(svn), SVNRepo(svninfo) + { this->InitializeParser(); } ~LogParser() { this->CleanupParser(); } private: cmCTestSVN* SVN; + cmCTestSVN::SVNInfo& SVNRepo; typedef cmCTestSVN::Revision Revision; typedef cmCTestSVN::Change Change; @@ -308,6 +320,7 @@ private: if(strcmp(name, "logentry") == 0) { this->Rev = Revision(); + this->Rev.SVNInfo = &SVNRepo; if(const char* rev = this->FindAttribute(atts, "revision")) { this->Rev.Rev = rev; @@ -337,7 +350,9 @@ private: } else if(strcmp(name, "path") == 0 && !this->CData.empty()) { - this->CurChange.Path.assign(&this->CData[0], this->CData.size()); + std::string orig_path(&this->CData[0], this->CData.size()); + std::string new_path = SVNRepo.BuildLocalPath( orig_path ); + this->CurChange.Path.assign(new_path); this->Changes.push_back(this->CurChange); } else if(strcmp(name, "author") == 0 && !this->CData.empty()) @@ -363,23 +378,32 @@ private: //---------------------------------------------------------------------------- void cmCTestSVN::LoadRevisions() +{ + // Get revision of the root repository + SVNInfo& svninfo = *RootInfo; + LoadRevisions(svninfo); +} + +//---------------------------------------------------------------------------- +void cmCTestSVN::LoadRevisions(SVNInfo &svninfo) { // We are interested in every revision included in the update. std::string revs; - if(atoi(this->OldRevision.c_str()) < atoi(this->NewRevision.c_str())) + if(atoi(svninfo.OldRevision.c_str()) < atoi(svninfo.NewRevision.c_str())) { - revs = "-r" + this->OldRevision + ":" + this->NewRevision; + revs = "-r" + svninfo.OldRevision + ":" + svninfo.NewRevision; } else { - revs = "-r" + this->NewRevision; + revs = "-r" + svninfo.NewRevision; } // Run "svn log" to get all global revisions of interest. const char* svn = this->CommandLineTool.c_str(); - const char* svn_log[] = {svn, "log", "--xml", "-v", revs.c_str(), 0}; + const char* svn_log[] = {svn, "log", "--xml", "-v", revs.c_str(), + svninfo.LocalPath.c_str(), 0}; { - LogParser out(this, "log-out> "); + LogParser out(this, "log-out> ", svninfo); OutputLogger err(this->Log, "log-err> "); this->RunChild(svn_log, &out, &err); } @@ -390,9 +414,9 @@ void cmCTestSVN::DoRevisionSVN(Revision const& revision, std::vector const& changes) { // Guess the base checkout path from the changes if necessary. - if(this->Base.empty() && !changes.empty()) + if(this->RootInfo->Base.empty() && !changes.empty()) { - this->GuessBase(changes); + this->GuessBase(*this->RootInfo, changes); } this->cmCTestGlobalVC::DoRevision(revision, changes); } @@ -454,7 +478,7 @@ void cmCTestSVN::WriteXMLGlobal(std::ostream& xml) { this->cmCTestGlobalVC::WriteXMLGlobal(xml); - xml << "\t" << this->Base << "\n"; + xml << "\t" << this->RootInfo->Base << "\n"; } //---------------------------------------------------------------------------- diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index a084d40bc..4fb37a644 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -33,15 +33,6 @@ private: virtual void NoteNewRevision(); virtual bool UpdateImpl(); - // URL of repository directory checked out in the working tree. - std::string URL; - - // URL of repository root directory. - std::string Root; - - // Directory under repository root checked out in working tree. - std::string Base; - // Information about an SVN repository (root repository or external) struct SVNInfo { @@ -76,12 +67,12 @@ private: // Pointer to the infos of the root repository. SVNInfo* RootInfo; - std::string LoadInfo(); + std::string LoadInfo(SVNInfo& svninfo); void LoadModifications(); void LoadRevisions(); + void LoadRevisions(SVNInfo& svninfo); - void GuessBase(std::vector const& changes); - const char* LocalPath(std::string const& path); + void GuessBase(SVNInfo &svninfo, std::vector const& changes); void DoRevisionSVN(Revision const& revision, std::vector const& changes); From 3776690e62c631edd520f566b2ebcaffbad230b4 Mon Sep 17 00:00:00 2001 From: Xavier Besseron Date: Mon, 3 Sep 2012 11:03:43 +0200 Subject: [PATCH 084/152] cmCTestSVN: Add a LoadExternal() function and an ExternalParser class This call 'svn status' and parse the result to get the list of externals repositories. The external repositories found are added to the Repositories list. --- Source/CTest/cmCTestSVN.cxx | 50 +++++++++++++++++++++++++++++++++++++ Source/CTest/cmCTestSVN.h | 3 +++ 2 files changed, 53 insertions(+) diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index 32b1ef97a..b27c6338c 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -481,6 +481,56 @@ void cmCTestSVN::WriteXMLGlobal(std::ostream& xml) xml << "\t" << this->RootInfo->Base << "\n"; } +//---------------------------------------------------------------------------- +class cmCTestSVN::ExternalParser: public cmCTestVC::LineParser +{ +public: + ExternalParser(cmCTestSVN* svn, const char* prefix): SVN(svn) + { + this->SetLog(&svn->Log, prefix); + this->RegexExternal.compile("^X..... +(.+)$"); + } +private: + cmCTestSVN* SVN; + cmsys::RegularExpression RegexExternal; + bool ProcessLine() + { + if(this->RegexExternal.find(this->Line)) + { + this->DoPath(this->RegexExternal.match(1)); + } + return true; + } + + void DoPath(std::string const& path) + { + // Get local path relative to the source directory + std::string local_path; + if(path.size() > this->SVN->SourceDirectory.size() && + strncmp(path.c_str(), this->SVN->SourceDirectory.c_str(), + this->SVN->SourceDirectory.size()) == 0) + { + local_path = path.c_str() + this->SVN->SourceDirectory.size() + 1; + } + else + { + local_path = path; + } + this->SVN->Repositories.push_back( SVNInfo(local_path.c_str()) ); + } +}; + +//---------------------------------------------------------------------------- +void cmCTestSVN::LoadExternals() +{ + // Run "svn status" to get the list of external repositories + const char* svn = this->CommandLineTool.c_str(); + const char* svn_status[] = {svn, "status", 0}; + ExternalParser out(this, "external-out> "); + OutputLogger err(this->Log, "external-err> "); + this->RunChild(svn_status, &out, &err); +} + //---------------------------------------------------------------------------- std::string cmCTestSVN::SVNInfo::BuildLocalPath(std::string const& path) const { diff --git a/Source/CTest/cmCTestSVN.h b/Source/CTest/cmCTestSVN.h index 4fb37a644..56265d008 100644 --- a/Source/CTest/cmCTestSVN.h +++ b/Source/CTest/cmCTestSVN.h @@ -68,6 +68,7 @@ private: SVNInfo* RootInfo; std::string LoadInfo(SVNInfo& svninfo); + void LoadExternals(); void LoadModifications(); void LoadRevisions(); void LoadRevisions(SVNInfo& svninfo); @@ -84,10 +85,12 @@ private: class LogParser; class StatusParser; class UpdateParser; + class ExternalParser; friend class InfoParser; friend class LogParser; friend class StatusParser; friend class UpdateParser; + friend class ExternalParser; }; #endif From 57234dd10a091e676d9e3a9279029dadace757c3 Mon Sep 17 00:00:00 2001 From: Xavier Besseron Date: Mon, 3 Sep 2012 11:10:53 +0200 Subject: [PATCH 085/152] cmCTestSVN: Load and process information from externals Call LoadExternals() and perform operations on all elements of the Repositories list. --- Source/CTest/cmCTestSVN.cxx | 38 +++++++++++++++++++++++++++++++------ 1 file changed, 32 insertions(+), 6 deletions(-) diff --git a/Source/CTest/cmCTestSVN.cxx b/Source/CTest/cmCTestSVN.cxx index b27c6338c..49cea2e05 100644 --- a/Source/CTest/cmCTestSVN.cxx +++ b/Source/CTest/cmCTestSVN.cxx @@ -121,9 +121,15 @@ void cmCTestSVN::NoteOldRevision() // Info for root repository this->Repositories.push_back( SVNInfo("") ); this->RootInfo = &(this->Repositories.back()); + // Info for the external repositories + this->LoadExternals(); - // Get info for the root repositiry - SVNInfo& svninfo = *RootInfo; + // Get info for all the repositories + std::list::iterator itbeg = this->Repositories.begin(); + std::list::iterator itend = this->Repositories.end(); + for( ; itbeg != itend ; itbeg++) + { + SVNInfo& svninfo = *itbeg; svninfo.OldRevision = this->LoadInfo(svninfo); this->Log << "Revision for repository '" << svninfo.LocalPath << "' before update: " << svninfo.OldRevision << "\n"; @@ -131,6 +137,7 @@ void cmCTestSVN::NoteOldRevision() " Old revision of external repository '" << svninfo.LocalPath << "' is: " << svninfo.OldRevision << "\n"); + } // Set the global old revision to the one of the root this->OldRevision = this->RootInfo->OldRevision; @@ -140,8 +147,12 @@ void cmCTestSVN::NoteOldRevision() //---------------------------------------------------------------------------- void cmCTestSVN::NoteNewRevision() { - // Get info for the root repository - SVNInfo& svninfo = *RootInfo; + // Get info for the external repositories + std::list::iterator itbeg = this->Repositories.begin(); + std::list::iterator itend = this->Repositories.end(); + for( ; itbeg != itend ; itbeg++) + { + SVNInfo& svninfo = *itbeg; svninfo.NewRevision = this->LoadInfo(svninfo); this->Log << "Revision for repository '" << svninfo.LocalPath << "' after update: " << svninfo.NewRevision << "\n"; @@ -168,6 +179,8 @@ void cmCTestSVN::NoteNewRevision() this->Log << "Repository '" << svninfo.LocalPath << "' Base = " << svninfo.Base << "\n"; + } + // Set the global new revision to the one of the root this->NewRevision = this->RootInfo->NewRevision; } @@ -379,9 +392,14 @@ private: //---------------------------------------------------------------------------- void cmCTestSVN::LoadRevisions() { - // Get revision of the root repository - SVNInfo& svninfo = *RootInfo; + // Get revisions for all the external repositories + std::list::iterator itbeg = this->Repositories.begin(); + std::list::iterator itend = this->Repositories.end(); + for( ; itbeg != itend ; itbeg++) + { + SVNInfo& svninfo = *itbeg; LoadRevisions(svninfo); + } } //---------------------------------------------------------------------------- @@ -418,6 +436,14 @@ void cmCTestSVN::DoRevisionSVN(Revision const& revision, { this->GuessBase(*this->RootInfo, changes); } + + // Ignore changes in the old revision for external repositories + if(revision.Rev == revision.SVNInfo->OldRevision + && revision.SVNInfo->LocalPath != "") + { + return; + } + this->cmCTestGlobalVC::DoRevision(revision, changes); } From 52ec845fce84e327216819b7b89183dbbd452636 Mon Sep 17 00:00:00 2001 From: Clinton Stimpson Date: Tue, 4 Sep 2012 08:50:21 -0600 Subject: [PATCH 086/152] cmake-gui: Fix error status when interrupted. Sometimes it wasn't returning an error and one could continue with the generate generate as if no errors occurred, and even with an incomplete configure step. --- Source/cmSystemTools.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index 69673c938..0b2def216 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -92,7 +92,8 @@ public: static bool GetErrorOccuredFlag() { return cmSystemTools::s_ErrorOccured || - cmSystemTools::s_FatalErrorOccured; + cmSystemTools::s_FatalErrorOccured || + GetInterruptFlag(); } ///! If this is set to true, cmake stops processing commands. static void SetFatalErrorOccured() From 11a6dac1e3ab9f93fbf764ec0eb898b20152a762 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Tue, 4 Sep 2012 20:23:53 +0200 Subject: [PATCH 087/152] Ninja: don't suppress warning about compiler options Warnings about invalid compiler options are printed first by cl.exe, this line was suppressed when the source file name didn't contain back slashes. --- Source/cmcldeps.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/cmcldeps.cxx b/Source/cmcldeps.cxx index 69df88d2a..34350bf7a 100644 --- a/Source/cmcldeps.cxx +++ b/Source/cmcldeps.cxx @@ -238,7 +238,9 @@ int main() { // needed to suppress filename output of msvc tools std::string srcfilename; std::string::size_type pos = srcfile.rfind("\\"); - if (pos != std::string::npos) { + if (pos == std::string::npos) { + srcfilename = srcfile; + } else { srcfilename = srcfile.substr(pos + 1); } From 2da17ef7975b521abe2be4736569d19ef79dc3be Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Wed, 5 Sep 2012 00:01:04 -0400 Subject: [PATCH 088/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index fa9b70846..264dcc912 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 9) -set(CMake_VERSION_TWEAK 20120904) +set(CMake_VERSION_TWEAK 20120905) #set(CMake_VERSION_RC 1) From e7cb80556eddc33dfa81c8ba1070a448d8eea5f9 Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Wed, 5 Sep 2012 09:45:39 +0200 Subject: [PATCH 089/152] Add additional architectures to CMakePlatformId.h.in Detect the MIPS and SHx architecture for MSVC compiler. --- Modules/CMakePlatformId.h.in | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 4b360f776..c37341411 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -100,6 +100,12 @@ # elif defined(_M_ARM) # define ARCHITECTURE_ID "ARM" +# elif defined(_M_MIPS) +# define ARCHITECTURE_ID "MIPS" + +# elif defined(_M_SH) +# define ARCHITECTURE_ID "SHx" + # else /* unknown architecture */ # define ARCHITECTURE_ID "" # endif From 28d744c9ea332a10b9fc3061758d5f8031158727 Mon Sep 17 00:00:00 2001 From: Patrick Gansterer Date: Wed, 5 Sep 2012 10:08:58 +0200 Subject: [PATCH 090/152] Add WindowsCE platform information files This enables CMake to create Makefiles targeting Windows CE devices. CMake needs to be run within a cross compile command prompt and requires a toolchain file which sets CMAKE_SYSTEM_NAME to "WindowsCE" and optionally CMAKE_SYSTEM_VERSION. --- Modules/Platform/Windows-MSVC.cmake | 54 +++++++++++++++++++---- Modules/Platform/WindowsCE-MSVC-C.cmake | 1 + Modules/Platform/WindowsCE-MSVC-CXX.cmake | 1 + Modules/Platform/WindowsCE-MSVC.cmake | 1 + Modules/Platform/WindowsCE.cmake | 1 + 5 files changed, 49 insertions(+), 9 deletions(-) create mode 100644 Modules/Platform/WindowsCE-MSVC-C.cmake create mode 100644 Modules/Platform/WindowsCE-MSVC-CXX.cmake create mode 100644 Modules/Platform/WindowsCE-MSVC.cmake create mode 100644 Modules/Platform/WindowsCE.cmake diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 238aa2467..cc48cfe29 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -38,8 +38,13 @@ endif() set(WIN32 1) -set(CMAKE_CREATE_WIN32_EXE /subsystem:windows) -set(CMAKE_CREATE_CONSOLE_EXE /subsystem:console) +if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") + set(CMAKE_CREATE_WIN32_EXE "/subsystem:windowsce /entry:WinMainCRTStartup") + set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:windowsce /entry:mainACRTStartup") +else() + set(CMAKE_CREATE_WIN32_EXE "/subsystem:windows") + set(CMAKE_CREATE_CONSOLE_EXE "/subsystem:console") +endif() if(CMAKE_GENERATOR MATCHES "Visual Studio 6") set (CMAKE_NO_BUILD_TYPE 1) @@ -117,14 +122,38 @@ endif() # default to Debug builds set(CMAKE_BUILD_TYPE_INIT Debug) -if(MSVC_VERSION GREATER 1310) - set(_RTC1 "/RTC1") +if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") + string(TOUPPER "${MSVC_C_ARCHITECTURE_ID}" _MSVC_C_ARCHITECTURE_ID_UPPER) + string(TOUPPER "${MSVC_CXX_ARCHITECTURE_ID}" _MSVC_CXX_ARCHITECTURE_ID_UPPER) + + if("${CMAKE_SYSTEM_VERSION}" MATCHES "^([0-9]+)\\.([0-9]+)") + math(EXPR _CE_VERSION "${CMAKE_MATCH_1}*100 + ${CMAKE_MATCH_2}") + elseif("${CMAKE_SYSTEM_VERSION}" STREQUAL "") + set(_CE_VERSION "500") + else() + message(FATAL_ERROR "Invalid Windows CE version: ${CMAKE_SYSTEM_VERSION}") + endif() + + set(_PLATFORM_DEFINES "/D_WIN32_WCE=0x${_CE_VERSION} /DUNDER_CE") + set(_PLATFORM_DEFINES_C " /D${MSVC_C_ARCHITECTURE_ID} /D_${_MSVC_C_ARCHITECTURE_ID_UPPER}_") + set(_PLATFORM_DEFINES_CXX " /D${MSVC_CXX_ARCHITECTURE_ID} /D_${_MSVC_CXX_ARCHITECTURE_ID_UPPER}_") + + set(_RTC1 "") set(_FLAGS_CXX " /GR /EHsc") - set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "coredll.lib corelibc.lib ole32.lib oleaut32.lib uuid.lib commctrl.lib") + set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /NODEFAULTLIB:libc.lib /NODEFAULTLIB:oldnames.lib") else() - set(_RTC1 "/GZ") - set(_FLAGS_CXX " /GR /GX") - set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + set(_PLATFORM_DEFINES "/DWIN32") + + if(MSVC_VERSION GREATER 1310) + set(_RTC1 "/RTC1") + set(_FLAGS_CXX " /GR /EHsc") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib shell32.lib ole32.lib oleaut32.lib uuid.lib comdlg32.lib advapi32.lib") + else() + set(_RTC1 "/GZ") + set(_FLAGS_CXX " /GR /GX") + set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") + endif() endif() set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}") @@ -136,6 +165,13 @@ set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID}) if(NOT _MACHINE_ARCH_FLAG) set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID}) endif() +if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE") + if(_MACHINE_ARCH_FLAG MATCHES "ARM") + set(_MACHINE_ARCH_FLAG "THUMB") + elseif(_MACHINE_ARCH_FLAG MATCHES "SH") + set(_MACHINE_ARCH_FLAG "SH4") + endif() +endif() set (CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}") @@ -196,7 +232,7 @@ macro(__windows_compiler_msvc lang) set(CMAKE_${lang}_LINK_EXECUTABLE "${_CMAKE_VS_LINK_EXE} ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe /Fd -link /implib: /version:. ${CMAKE_END_TEMP_FILE}") - set(CMAKE_${lang}_FLAGS_INIT "/DWIN32 /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") + set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}") set(CMAKE_${lang}_FLAGS_DEBUG_INIT "/D_DEBUG /MDd /Zi /Ob0 /Od ${_RTC1}") set(CMAKE_${lang}_FLAGS_RELEASE_INIT "/MD /O2 /Ob2 /D NDEBUG") set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "/MD /Zi /O2 /Ob1 /D NDEBUG") diff --git a/Modules/Platform/WindowsCE-MSVC-C.cmake b/Modules/Platform/WindowsCE-MSVC-C.cmake new file mode 100644 index 000000000..ce8060bed --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC-C.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-C) diff --git a/Modules/Platform/WindowsCE-MSVC-CXX.cmake b/Modules/Platform/WindowsCE-MSVC-CXX.cmake new file mode 100644 index 000000000..281eadc10 --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC-CXX.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC-CXX) diff --git a/Modules/Platform/WindowsCE-MSVC.cmake b/Modules/Platform/WindowsCE-MSVC.cmake new file mode 100644 index 000000000..d28b4aba0 --- /dev/null +++ b/Modules/Platform/WindowsCE-MSVC.cmake @@ -0,0 +1 @@ +include(Platform/Windows-MSVC) diff --git a/Modules/Platform/WindowsCE.cmake b/Modules/Platform/WindowsCE.cmake new file mode 100644 index 000000000..65b2eaed4 --- /dev/null +++ b/Modules/Platform/WindowsCE.cmake @@ -0,0 +1 @@ +include(Platform/Windows) From 7b2bf28e183b5eacc22fe3030f0439853746f0bd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Peter=20K=C3=BCmmel?= Date: Wed, 5 Sep 2012 01:44:11 +0200 Subject: [PATCH 091/152] Ninja: suppress cmcldeps only for source file signature try_compiles --- Source/cmMakefile.cxx | 12 ++++++++++++ Source/cmMakefile.h | 2 ++ Source/cmNinjaTargetGenerator.cxx | 3 +-- 3 files changed, 15 insertions(+), 2 deletions(-) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 7b6c450f1..9a9c1c859 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -46,6 +46,7 @@ public: std::stack > VarStack; std::stack > VarInitStack; std::stack > VarUsageStack; + bool IsSourceFileTryCompile; }; // default is not to be building executables @@ -56,6 +57,7 @@ cmMakefile::cmMakefile(): Internal(new Internals) this->Internal->VarStack.push(defs); this->Internal->VarInitStack.push(globalKeys); this->Internal->VarUsageStack.push(globalKeys); + this->Internal->IsSourceFileTryCompile = false; // Initialize these first since AddDefaultDefinitions calls AddDefinition this->WarnUnused = false; @@ -2912,6 +2914,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, const std::vector *cmakeArgs, std::string *output) { + this->Internal->IsSourceFileTryCompile = fast; // does the binary directory exist ? If not create it... if (!cmSystemTools::FileIsDirectory(bindir)) { @@ -2937,6 +2940,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, "Internal CMake error, TryCompile bad GlobalGenerator"); // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return 1; } cm.SetGlobalGenerator(gg); @@ -3009,6 +3013,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, "Internal CMake error, TryCompile configure of cmake failed"); // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return 1; } @@ -3018,6 +3023,7 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, "Internal CMake error, TryCompile generation of cmake failed"); // return to the original directory cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return 1; } @@ -3031,9 +3037,15 @@ int cmMakefile::TryCompile(const char *srcdir, const char *bindir, this); cmSystemTools::ChangeDirectory(cwd.c_str()); + this->Internal->IsSourceFileTryCompile = false; return ret; } +bool cmMakefile::GetIsSourceFileTryCompile() const +{ + return this->Internal->IsSourceFileTryCompile; +} + cmake *cmMakefile::GetCMakeInstance() const { if ( this->LocalGenerator && this->LocalGenerator->GetGlobalGenerator() ) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 8a0088b1a..74c8039b3 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -128,6 +128,8 @@ public: const std::vector *cmakeArgs, std::string *output); + bool GetIsSourceFileTryCompile() const; + /** * Specify the makefile generator. This is platform/compiler * dependent, although the interface is through a generic diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 918f5827e..4cc23cacf 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -355,8 +355,7 @@ cmNinjaTargetGenerator if (lang == "C" || lang == "CXX" || lang == "RC") { clDepsBinary = mf->GetSafeDefinition("CMAKE_CMCLDEPS_EXECUTABLE"); - if (!clDepsBinary.empty() && - !this->GetGlobalGenerator()->GetCMakeInstance()->GetIsInTryCompile()) + if (!clDepsBinary.empty() && !mf->GetIsSourceFileTryCompile()) { clShowPrefix = mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDE_PREFIX"); clBinary = mf->GetDefinition("CMAKE_C_COMPILER") ? From 084c5af4e0c7f2aa4bea6f6db0fe00ebd4802b37 Mon Sep 17 00:00:00 2001 From: Brad King Date: Wed, 5 Sep 2012 12:03:34 -0400 Subject: [PATCH 092/152] Utilities/Release: Link AIX binary with large maxdata Raise the default "maxdata" linker setting on the 32-bit AIX release binaries. This allows the CMake binaries to process larger projects without encountering a "Segmentation fault in extend_brk". --- Utilities/Release/v20n250_aix_release.cmake | 1 + 1 file changed, 1 insertion(+) diff --git a/Utilities/Release/v20n250_aix_release.cmake b/Utilities/Release/v20n250_aix_release.cmake index 53c34d7ce..cc8cd058b 100644 --- a/Utilities/Release/v20n250_aix_release.cmake +++ b/Utilities/Release/v20n250_aix_release.cmake @@ -7,6 +7,7 @@ set(MAKE_PROGRAM "make") set(CC "xlc_r") set(CXX "xlC_r") set(FC "xlf") +set(LDFLAGS "-Wl,-bmaxdata:0x80000000") # Push "Segmentation fault in extend_brk" over horizon set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE From 8797df41b285e7f17fdf1302e3b872ba94e110af Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Thu, 6 Sep 2012 00:01:02 -0400 Subject: [PATCH 093/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 264dcc912..86f82827d 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 9) -set(CMake_VERSION_TWEAK 20120905) +set(CMake_VERSION_TWEAK 20120906) #set(CMake_VERSION_RC 1) From 9d91fc65fa955d6ba878a4f72a93a004b02af2a5 Mon Sep 17 00:00:00 2001 From: Sergei Nikulov Date: Fri, 31 Aug 2012 12:24:37 +0400 Subject: [PATCH 094/152] fix for discovering ft2build.h using FREETYPE_DIR environment var (#13502) --- Modules/FindFreetype.cmake | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index c7cf0eb6b..cdb46beff 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -46,9 +46,10 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h HINTS ENV FREETYPE_DIR PATHS - /usr/local/X11R6/include - /usr/local/X11/include - /usr/freeware/include + /usr/local/X11R6 + /usr/local/X11 + /usr/freeware + PATH_SUFFIXES include/freetype2 include ) find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h From 5c25df10acea6ca2948392d680e6cae26b3127df Mon Sep 17 00:00:00 2001 From: David Cole Date: Thu, 6 Sep 2012 15:11:54 -0400 Subject: [PATCH 095/152] FindQt4: Avoid "finding" non-existent library in a .framework ...if the library file does not exist inside the .framework then do not allow a library variable to be set to the path to the framework. Force set it to NOTFOUND instead. --- Modules/FindQt4.cmake | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index 95fb8a4be..a84074b53 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -885,6 +885,18 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION) NAMES ${QT_MODULE}${QT_LIBINFIX}_debug ${QT_MODULE}${QT_LIBINFIX}d ${QT_MODULE}${QT_LIBINFIX}d4 PATHS ${QT_LIBRARY_DIR} NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH ) + if(QT_${_upper_qt_module}_LIBRARY_RELEASE MATCHES "/${QT_MODULE}\\.framework$") + if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_RELEASE}/${QT_MODULE}") + # Release framework library file does not exist... Force to NOTFOUND: + set(QT_${_upper_qt_module}_LIBRARY_RELEASE "QT_${_upper_qt_module}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE) + endif() + endif() + if(QT_${_upper_qt_module}_LIBRARY_DEBUG MATCHES "/${QT_MODULE}\\.framework$") + if(NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_DEBUG}/${QT_MODULE}") + # Debug framework library file does not exist... Force to NOTFOUND: + set(QT_${_upper_qt_module}_LIBRARY_DEBUG "QT_${_upper_qt_module}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE) + endif() + endif() endforeach() # QtUiTools is sometimes not in the same directory as the other found libraries From 308564e35caecd6cf04137609963cd3d93e578c0 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Fri, 7 Sep 2012 00:01:03 -0400 Subject: [PATCH 096/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 86f82827d..40969ca43 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 9) -set(CMake_VERSION_TWEAK 20120906) +set(CMake_VERSION_TWEAK 20120907) #set(CMake_VERSION_RC 1) From 2f520d304a5cf874b22d978e9402e6d9316eb42e Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 6 Sep 2012 12:31:47 +0200 Subject: [PATCH 097/152] Simplify CMake.HTML documentation test command line Drop the "cmake -E chdir" wrapper and instead pass the DTD directory to xmllint's --path option using url encoding. While at it, move the XHTML1 DTD to "Utilities/xml/xhtml1" to make room for additional DTDs. --- Utilities/CMakeLists.txt | 16 ++++++++-------- Utilities/xml/{ => xhtml1}/xhtml-lat1.ent | 0 Utilities/xml/{ => xhtml1}/xhtml-special.ent | 0 Utilities/xml/{ => xhtml1}/xhtml-symbol.ent | 0 Utilities/xml/{ => xhtml1}/xhtml1-strict.dtd | 0 5 files changed, 8 insertions(+), 8 deletions(-) rename Utilities/xml/{ => xhtml1}/xhtml-lat1.ent (100%) rename Utilities/xml/{ => xhtml1}/xhtml-special.ent (100%) rename Utilities/xml/{ => xhtml1}/xhtml-symbol.ent (100%) rename Utilities/xml/{ => xhtml1}/xhtml1-strict.dtd (100%) diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index 233d5e23a..cb50eca21 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -141,15 +141,15 @@ if(BUILD_TESTING) execute_process(COMMAND ${LIBXML2_XMLLINT_EXECUTABLE} --help OUTPUT_VARIABLE _help ERROR_VARIABLE _err) if("${_help}" MATCHES "--path" AND "${_help}" MATCHES "--nonet") - # We provide the XHTML DTD and its dependencies in the 'xml' - # directory so that xmllint can run without network access. - # However, it's --path option accepts a space-separated list of - # paths so it cannot handle spaces in the path to the source tree. - # Therefore we run the tool with the current work directory set to - # the 'xml' directory and use '.' as the path. + # We provide DTDs in the 'xml' directory so that xmllint can run without + # network access. Note that xmllints's --path option accepts a + # space-separated list of url-encoded paths. + set(_dtd_dir "${CMAKE_CURRENT_SOURCE_DIR}/xml") + string(REPLACE " " "%20" _dtd_dir "${_dtd_dir}") + string(REPLACE ":" "%3A" _dtd_dir "${_dtd_dir}") add_test(CMake.HTML - ${CMAKE_CMAKE_COMMAND} -E chdir ${CMAKE_CURRENT_SOURCE_DIR}/xml - ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet --path . + ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet + --path ${_dtd_dir}/xhtml1 ${HTML_FILES} ) endif() diff --git a/Utilities/xml/xhtml-lat1.ent b/Utilities/xml/xhtml1/xhtml-lat1.ent similarity index 100% rename from Utilities/xml/xhtml-lat1.ent rename to Utilities/xml/xhtml1/xhtml-lat1.ent diff --git a/Utilities/xml/xhtml-special.ent b/Utilities/xml/xhtml1/xhtml-special.ent similarity index 100% rename from Utilities/xml/xhtml-special.ent rename to Utilities/xml/xhtml1/xhtml-special.ent diff --git a/Utilities/xml/xhtml-symbol.ent b/Utilities/xml/xhtml1/xhtml-symbol.ent similarity index 100% rename from Utilities/xml/xhtml-symbol.ent rename to Utilities/xml/xhtml1/xhtml-symbol.ent diff --git a/Utilities/xml/xhtml1-strict.dtd b/Utilities/xml/xhtml1/xhtml1-strict.dtd similarity index 100% rename from Utilities/xml/xhtml1-strict.dtd rename to Utilities/xml/xhtml1/xhtml1-strict.dtd From 2b2e86feaabc47baaefd442f0553ffd5e07d8100 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 6 Sep 2012 08:56:49 -0400 Subject: [PATCH 098/152] Utilities/xml: Add .gitattributes to disable whitespace checks This directory holds upstream DTD files. We do not want to modify them, so tell Git to skip whitespace enforcement. --- Utilities/xml/.gitattributes | 1 + 1 file changed, 1 insertion(+) create mode 100644 Utilities/xml/.gitattributes diff --git a/Utilities/xml/.gitattributes b/Utilities/xml/.gitattributes new file mode 100644 index 000000000..562b12e16 --- /dev/null +++ b/Utilities/xml/.gitattributes @@ -0,0 +1 @@ +* -whitespace From ac25bc0135c3d13ce2de4a77675c3464b1bc7f11 Mon Sep 17 00:00:00 2001 From: Brad King Date: Thu, 6 Sep 2012 09:05:52 -0400 Subject: [PATCH 099/152] Utilities/xml: Add docbook-4.5 DTD (#13508) Run the shell code below to put the DTD in Utilities/xml/docbook-4.5: v=4.5 && sha1=b9124233b50668fb508773aa2b3ebc631d7c1620 && mkdir Utilities/xml/docbook-$v && cd Utilities/xml/docbook-$v && wget -c http://www.oasis-open.org/docbook/xml/$v/docbook-xml-$v.zip && sha1sum docbook-xml-$v.zip |grep $sha1 && unzip docbook-xml-$v.zip && rm docbook-xml-$v.zip --- Utilities/xml/docbook-4.5/ChangeLog | 106 + Utilities/xml/docbook-4.5/README | 8 + Utilities/xml/docbook-4.5/calstblx.dtd | 215 + Utilities/xml/docbook-4.5/catalog.xml | 124 + Utilities/xml/docbook-4.5/dbcentx.mod | 384 + Utilities/xml/docbook-4.5/dbgenent.mod | 41 + Utilities/xml/docbook-4.5/dbhierx.mod | 2193 ++++++ Utilities/xml/docbook-4.5/dbnotnx.mod | 101 + Utilities/xml/docbook-4.5/dbpoolx.mod | 8701 +++++++++++++++++++++ Utilities/xml/docbook-4.5/docbook.cat | 113 + Utilities/xml/docbook-4.5/docbookx.dtd | 170 + Utilities/xml/docbook-4.5/ent/README | 14 + Utilities/xml/docbook-4.5/ent/isoamsa.ent | 97 + Utilities/xml/docbook-4.5/ent/isoamsb.ent | 83 + Utilities/xml/docbook-4.5/ent/isoamsc.ent | 51 + Utilities/xml/docbook-4.5/ent/isoamsn.ent | 103 + Utilities/xml/docbook-4.5/ent/isoamso.ent | 59 + Utilities/xml/docbook-4.5/ent/isoamsr.ent | 125 + Utilities/xml/docbook-4.5/ent/isobox.ent | 81 + Utilities/xml/docbook-4.5/ent/isocyr1.ent | 108 + Utilities/xml/docbook-4.5/ent/isocyr2.ent | 67 + Utilities/xml/docbook-4.5/ent/isodia.ent | 55 + Utilities/xml/docbook-4.5/ent/isogrk1.ent | 90 + Utilities/xml/docbook-4.5/ent/isogrk2.ent | 61 + Utilities/xml/docbook-4.5/ent/isogrk3.ent | 84 + Utilities/xml/docbook-4.5/ent/isogrk4.ent | 84 + Utilities/xml/docbook-4.5/ent/isolat1.ent | 103 + Utilities/xml/docbook-4.5/ent/isolat2.ent | 162 + Utilities/xml/docbook-4.5/ent/isonum.ent | 117 + Utilities/xml/docbook-4.5/ent/isopub.ent | 125 + Utilities/xml/docbook-4.5/ent/isotech.ent | 103 + Utilities/xml/docbook-4.5/htmltblx.mod | 245 + Utilities/xml/docbook-4.5/soextblx.dtd | 321 + 33 files changed, 14494 insertions(+) create mode 100644 Utilities/xml/docbook-4.5/ChangeLog create mode 100644 Utilities/xml/docbook-4.5/README create mode 100644 Utilities/xml/docbook-4.5/calstblx.dtd create mode 100644 Utilities/xml/docbook-4.5/catalog.xml create mode 100644 Utilities/xml/docbook-4.5/dbcentx.mod create mode 100644 Utilities/xml/docbook-4.5/dbgenent.mod create mode 100644 Utilities/xml/docbook-4.5/dbhierx.mod create mode 100644 Utilities/xml/docbook-4.5/dbnotnx.mod create mode 100644 Utilities/xml/docbook-4.5/dbpoolx.mod create mode 100644 Utilities/xml/docbook-4.5/docbook.cat create mode 100644 Utilities/xml/docbook-4.5/docbookx.dtd create mode 100644 Utilities/xml/docbook-4.5/ent/README create mode 100644 Utilities/xml/docbook-4.5/ent/isoamsa.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isoamsb.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isoamsc.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isoamsn.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isoamso.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isoamsr.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isobox.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isocyr1.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isocyr2.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isodia.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isogrk1.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isogrk2.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isogrk3.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isogrk4.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isolat1.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isolat2.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isonum.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isopub.ent create mode 100644 Utilities/xml/docbook-4.5/ent/isotech.ent create mode 100644 Utilities/xml/docbook-4.5/htmltblx.mod create mode 100644 Utilities/xml/docbook-4.5/soextblx.dtd diff --git a/Utilities/xml/docbook-4.5/ChangeLog b/Utilities/xml/docbook-4.5/ChangeLog new file mode 100644 index 000000000..06f59ce5c --- /dev/null +++ b/Utilities/xml/docbook-4.5/ChangeLog @@ -0,0 +1,106 @@ +2006-10-03 13:23 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, trunk/docbook/sgml/docbook.dtd, + calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, htmltblx.mod: DocBook V4.5 released + +2006-06-02 11:28 nwalsh + + * calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, freshmeat.xsl, htmltblx.mod: Changed copyright + dates and version numbers + +2006-05-30 20:58 nwalsh + + * htmltblx.mod: Supply tag omission markers in SGML; suppress + xml:lang in SGML + +2006-03-07 13:11 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, trunk/docbook/sgml/docbook.dtd, + calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, freshmeat.xsl, htmltblx.mod: Change version + numbers to 4.5CR2 + +2006-03-07 13:03 nwalsh + + * dbpoolx.mod: Allow citebiblioid anywhere the other citation + elements are allowed + +2006-02-16 21:12 nwalsh + + * calstblx.dtd, catalog.xml, dbcentx.mod, dbgenent.mod, + dbhierx.mod, dbnotnx.mod, dbpoolx.mod, docbook.cat, + docbookx.dtd, freshmeat.xsl, htmltblx.mod: DocBook V4.5 released + +2005-06-29 10:59 nwalsh + + * trunk/docbook/sgml/docbook.dtd, docbookx.dtd: DocBook V4.5CR1 + Released + +2005-06-29 10:58 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, calstblx.dtd, catalog.xml, + dbcentx.mod, dbgenent.mod, dbhierx.mod, dbnotnx.mod, + dbpoolx.mod, docbook.cat, htmltblx.mod: Updated version number + +2005-06-29 10:53 nwalsh + + * freshmeat.xsl: Tweaked freshmeat changes + +2005-06-24 21:09 nwalsh + + * calstblx.dtd, dbhierx.mod, dbpoolx.mod, htmltblx.mod, + soextblx.dtd: Added doc: structured comments + +2005-05-05 11:41 nwalsh + + * trunk/docbook/sgml/docbook.dtd, docbookx.dtd: DocBook V4.5b1 + Released + +2005-05-05 11:40 nwalsh + + * trunk/docbook/sgml/catalog.xml, trunk/docbook/sgml/docbook.cat, + trunk/docbook/sgml/docbook.dcl, calstblx.dtd, catalog.xml, + dbcentx.mod, dbgenent.mod, dbhierx.mod, dbnotnx.mod, + dbpoolx.mod, docbook.cat, htmltblx.mod: Updated version number + +2005-05-05 11:37 nwalsh + + * freshmeat.xsl: Prepare for 4.5b1 + +2005-05-05 10:59 nwalsh + + * dbpoolx.mod: RFE 1055480: Make revnumber optional + +2005-05-05 10:54 nwalsh + + * dbpoolx.mod, htmltblx.mod: Allow common attributes on HTML table + elements + +2005-05-05 10:48 nwalsh + + * dbpoolx.mod: Added termdef + +2005-05-05 10:39 nwalsh + + * dbpoolx.mod: Added mathphrase + +2005-05-05 10:33 nwalsh + + * dbhierx.mod: RFE 1070458: Allow colophon in article + +2005-05-05 10:32 nwalsh + + * dbpoolx.mod: RFE 1070770: Allow procedure in example + +2005-05-05 10:21 nwalsh + + * dbpoolx.mod: Add isrn to list of biblioid class attribute values + diff --git a/Utilities/xml/docbook-4.5/README b/Utilities/xml/docbook-4.5/README new file mode 100644 index 000000000..6fc60c4bf --- /dev/null +++ b/Utilities/xml/docbook-4.5/README @@ -0,0 +1,8 @@ +README for the DocBook XML DTD + +For more information about DocBook, please see + + http://www.oasis-open.org/docbook/ + +Please send all questions, comments, concerns, and bug reports to the +DocBook mailing list: docbook@lists.oasis-open.org diff --git a/Utilities/xml/docbook-4.5/calstblx.dtd b/Utilities/xml/docbook-4.5/calstblx.dtd new file mode 100644 index 000000000..fac58d77e --- /dev/null +++ b/Utilities/xml/docbook-4.5/calstblx.dtd @@ -0,0 +1,215 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/catalog.xml b/Utilities/xml/docbook-4.5/catalog.xml new file mode 100644 index 000000000..f75c1d764 --- /dev/null +++ b/Utilities/xml/docbook-4.5/catalog.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbcentx.mod b/Utilities/xml/docbook-4.5/dbcentx.mod new file mode 100644 index 000000000..60de99f86 --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbcentx.mod @@ -0,0 +1,384 @@ + + + + + + + + + + + + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbgenent.mod b/Utilities/xml/docbook-4.5/dbgenent.mod new file mode 100644 index 000000000..ff5ba90d1 --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbgenent.mod @@ -0,0 +1,41 @@ + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbhierx.mod b/Utilities/xml/docbook-4.5/dbhierx.mod new file mode 100644 index 000000000..5f839f567 --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbhierx.mod @@ -0,0 +1,2193 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbhier2; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + +]]> + + + +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> + + + + +]]> + + + + + +]]> + + + + +]]> + + + + + +]]> + +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + diff --git a/Utilities/xml/docbook-4.5/dbnotnx.mod b/Utilities/xml/docbook-4.5/dbnotnx.mod new file mode 100644 index 000000000..2416049bf --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbnotnx.mod @@ -0,0 +1,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/dbpoolx.mod b/Utilities/xml/docbook-4.5/dbpoolx.mod new file mode 100644 index 000000000..53b07044a --- /dev/null +++ b/Utilities/xml/docbook-4.5/dbpoolx.mod @@ -0,0 +1,8701 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +%rdbpool; +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +%htmltbl; +]]> + + + + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + +]]> + +%tablemodel; + +]]> + + + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> + + +]]> + + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + ]]> + + + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> + + + + + + + + +]]> + + + +]]> + ]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + ]]> + + +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + +]]> + + + + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + +]]> + + + +]]> +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + +]]> +]]> + + + + + + + + + + +]]> + + + + + + + +]]> +]]> + + + + + + + + +]]> + + + + + + +]]> +]]> + + + + + + + + + + + +]]> + + + + + + + + + + +]]> +]]> + + + + + + + + + +]]> + + + + +]]> + + + + + +]]> + + + + +]]> + + + + + +]]> + + + + +]]> + +]]> + + + + + + + + +]]> + + + +]]> + + + + +]]> + + + +]]> +]]> +]]> + + + diff --git a/Utilities/xml/docbook-4.5/docbook.cat b/Utilities/xml/docbook-4.5/docbook.cat new file mode 100644 index 000000000..25ac4dff0 --- /dev/null +++ b/Utilities/xml/docbook-4.5/docbook.cat @@ -0,0 +1,113 @@ + -- ...................................................................... -- + -- Catalog data for DocBook XML V4.5 .................................... -- + -- File docbook.cat ..................................................... -- + + -- Please direct all questions, bug reports, or suggestions for + changes to the docbook@lists.oasis-open.org mailing list. For more + information, see http://www.oasis-open.org/. + -- + + -- This is the catalog data file for DocBook XML V4.5. It is provided as + a convenience in building your own catalog files. You need not use + the filenames listed here, and need not use the filename method of + identifying storage objects at all. See the documentation for + detailed information on the files associated with the DocBook DTD. + See SGML Open Technical Resolution 9401 for detailed information + on supplying and using catalog data. + -- + + -- ...................................................................... -- + -- DocBook driver file .................................................. -- + +PUBLIC "-//OASIS//DTD DocBook XML V4.5//EN" + "docbookx.dtd" + + -- ...................................................................... -- + -- DocBook modules ...................................................... -- + +PUBLIC "-//OASIS//DTD DocBook CALS Table Model V4.5//EN" + "calstblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook XML HTML Tables V4.5//EN" + "htmltblx.mod" + +PUBLIC "-//OASIS//DTD XML Exchange Table Model 19990315//EN" + "soextblx.dtd" + +PUBLIC "-//OASIS//ELEMENTS DocBook Information Pool V4.5//EN" + "dbpoolx.mod" + +PUBLIC "-//OASIS//ELEMENTS DocBook Document Hierarchy V4.5//EN" + "dbhierx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Additional General Entities V4.5//EN" + "dbgenent.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Notations V4.5//EN" + "dbnotnx.mod" + +PUBLIC "-//OASIS//ENTITIES DocBook Character Entities V4.5//EN" + "dbcentx.mod" + + -- ...................................................................... -- + -- ISO entity sets ...................................................... -- + +PUBLIC "ISO 8879:1986//ENTITIES Diacritical Marks//EN//XML" + "ent/isodia.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Numeric and Special Graphic//EN//XML" + "ent/isonum.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Publishing//EN//XML" + "ent/isopub.ent" + +PUBLIC "ISO 8879:1986//ENTITIES General Technical//EN//XML" + "ent/isotech.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 1//EN//XML" + "ent/isolat1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Latin 2//EN//XML" + "ent/isolat2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Letters//EN//XML" + "ent/isogrk1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Monotoniko Greek//EN//XML" + "ent/isogrk2.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Greek Symbols//EN//XML" + "ent/isogrk3.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Alternative Greek Symbols//EN//XML" + "ent/isogrk4.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Arrow Relations//EN//XML" + "ent/isoamsa.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Binary Operators//EN//XML" + "ent/isoamsb.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Delimiters//EN//XML" + "ent/isoamsc.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Negated Relations//EN//XML" + "ent/isoamsn.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Ordinary//EN//XML" + "ent/isoamso.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Added Math Symbols: Relations//EN//XML" + "ent/isoamsr.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Box and Line Drawing//EN//XML" + "ent/isobox.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Russian Cyrillic//EN//XML" + "ent/isocyr1.ent" + +PUBLIC "ISO 8879:1986//ENTITIES Non-Russian Cyrillic//EN//XML" + "ent/isocyr2.ent" + + -- End of catalog data for DocBook XML V4.5 ............................. -- + -- ...................................................................... -- diff --git a/Utilities/xml/docbook-4.5/docbookx.dtd b/Utilities/xml/docbook-4.5/docbookx.dtd new file mode 100644 index 000000000..8b43c59b6 --- /dev/null +++ b/Utilities/xml/docbook-4.5/docbookx.dtd @@ -0,0 +1,170 @@ + + + + + + + + + + + + + + + +]]> + + + + + + + + + +]]> +]]> + + + +]]> + + + +]]> + + + + + + +%dbnotn; +]]> + + + + + + + +]]> + +]]> +]]> + + +%dbcent; +]]> + + + + + + + + +%dbpool; +]]> + + + + + + +%rdbmods; +]]> + + + + + +%dbhier; +]]> + + + + + + +%dbgenent; +]]> + + + diff --git a/Utilities/xml/docbook-4.5/ent/README b/Utilities/xml/docbook-4.5/ent/README new file mode 100644 index 000000000..c0da542a6 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/README @@ -0,0 +1,14 @@ +XML Entity Declarations for Characters + +The character entity sets distributed with DocBook XML are direct +copies of the official entities located at + + http://www.w3.org/2003/entities/ + +They are distributed for historical compatibility and user convenience. +The DocBook Technical Committee no longer attempts to maintain these +definitions and will periodically update them from the W3C site if and +as they are updated there. + +Please direct all questions or comments about the entities to the +individuals or working groups who maintain the official sets. diff --git a/Utilities/xml/docbook-4.5/ent/isoamsa.ent b/Utilities/xml/docbook-4.5/ent/isoamsa.ent new file mode 100644 index 000000000..dac3e6242 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsa.ent @@ -0,0 +1,97 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsb.ent b/Utilities/xml/docbook-4.5/ent/isoamsb.ent new file mode 100644 index 000000000..4065b66c4 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsb.ent @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsc.ent b/Utilities/xml/docbook-4.5/ent/isoamsc.ent new file mode 100644 index 000000000..2fad41752 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsc.ent @@ -0,0 +1,51 @@ + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsn.ent b/Utilities/xml/docbook-4.5/ent/isoamsn.ent new file mode 100644 index 000000000..ddca8d14c --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsn.ent @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamso.ent b/Utilities/xml/docbook-4.5/ent/isoamso.ent new file mode 100644 index 000000000..278e4b409 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamso.ent @@ -0,0 +1,59 @@ + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isoamsr.ent b/Utilities/xml/docbook-4.5/ent/isoamsr.ent new file mode 100644 index 000000000..18e64bffd --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isoamsr.ent @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isobox.ent b/Utilities/xml/docbook-4.5/ent/isobox.ent new file mode 100644 index 000000000..9ae27d4fa --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isobox.ent @@ -0,0 +1,81 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isocyr1.ent b/Utilities/xml/docbook-4.5/ent/isocyr1.ent new file mode 100644 index 000000000..364b6d841 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isocyr1.ent @@ -0,0 +1,108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isocyr2.ent b/Utilities/xml/docbook-4.5/ent/isocyr2.ent new file mode 100644 index 000000000..6432d74c4 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isocyr2.ent @@ -0,0 +1,67 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isodia.ent b/Utilities/xml/docbook-4.5/ent/isodia.ent new file mode 100644 index 000000000..b49c30947 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isodia.ent @@ -0,0 +1,55 @@ + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk1.ent b/Utilities/xml/docbook-4.5/ent/isogrk1.ent new file mode 100644 index 000000000..7826f8109 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk1.ent @@ -0,0 +1,90 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk2.ent b/Utilities/xml/docbook-4.5/ent/isogrk2.ent new file mode 100644 index 000000000..726b7dd70 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk2.ent @@ -0,0 +1,61 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk3.ent b/Utilities/xml/docbook-4.5/ent/isogrk3.ent new file mode 100644 index 000000000..28b5c2766 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk3.ent @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isogrk4.ent b/Utilities/xml/docbook-4.5/ent/isogrk4.ent new file mode 100644 index 000000000..27c6a514f --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isogrk4.ent @@ -0,0 +1,84 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isolat1.ent b/Utilities/xml/docbook-4.5/ent/isolat1.ent new file mode 100644 index 000000000..381bd0900 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isolat1.ent @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isolat2.ent b/Utilities/xml/docbook-4.5/ent/isolat2.ent new file mode 100644 index 000000000..e91ffdbee --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isolat2.ent @@ -0,0 +1,162 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isonum.ent b/Utilities/xml/docbook-4.5/ent/isonum.ent new file mode 100644 index 000000000..884c0c4d0 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isonum.ent @@ -0,0 +1,117 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isopub.ent b/Utilities/xml/docbook-4.5/ent/isopub.ent new file mode 100644 index 000000000..a11787828 --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isopub.ent @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/ent/isotech.ent b/Utilities/xml/docbook-4.5/ent/isotech.ent new file mode 100644 index 000000000..07e81008d --- /dev/null +++ b/Utilities/xml/docbook-4.5/ent/isotech.ent @@ -0,0 +1,103 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/htmltblx.mod b/Utilities/xml/docbook-4.5/htmltblx.mod new file mode 100644 index 000000000..cdaefed41 --- /dev/null +++ b/Utilities/xml/docbook-4.5/htmltblx.mod @@ -0,0 +1,245 @@ + + + + + + + + + + + + + + + + +]]> + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Utilities/xml/docbook-4.5/soextblx.dtd b/Utilities/xml/docbook-4.5/soextblx.dtd new file mode 100644 index 000000000..4a92e1162 --- /dev/null +++ b/Utilities/xml/docbook-4.5/soextblx.dtd @@ -0,0 +1,321 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From cffa899a47e83599bbe081c9f8070b7e35de1d58 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 7 Sep 2012 10:34:34 +0200 Subject: [PATCH 100/152] docbook: Remove table of contents When DocBook is transformed (eg. to PDF, HTML, ...), a TOC is generated from the document's layout. The TOC-like list that the docbook formatter used to generate was both redundant and invalid. --- Source/cmDocumentationFormatterDocbook.cxx | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index eabdbc128..af32d381b 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -129,24 +129,6 @@ void cmDocumentationFormatterDocbook const std::vector &entries = section.GetEntries(); - if (!entries.empty()) - { - os << "\n"; - for(std::vector::const_iterator op - = entries.begin(); op != entries.end(); ++ op ) - { - if(op->Name.size()) - { - os << " Name.c_str()); - os << "\">"; - cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); - os << "\n"; - } - } - os << "\n" ; - } - for(std::vector::const_iterator op = entries.begin(); op != entries.end();) { From dbfe335099bd80e38830846c401d5651c64d15e5 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 7 Sep 2012 10:35:08 +0200 Subject: [PATCH 101/152] docbook: Factor out code to write valid DocBook IDs Attributes in XML may contain alphanumeric characters, underscores, colons and dots. When DocBook is chunked, the dot is often used as a path separator. To generate a valid ID, we take the title of the section, transform all non-alphanumeric characters to underscores and then add a prefix separated with dots. We also add the document name as a prefix, in order to 'xinclude' eg. cmake.docbook and ctest.docbook in the same document. IDs are written in multiple places, so the code is factored to a function. --- Source/cmDocumentationFormatterDocbook.cxx | 71 +++++++++++----------- Source/cmDocumentationFormatterDocbook.h | 2 + 2 files changed, 36 insertions(+), 37 deletions(-) diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index af32d381b..a109c53ec 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -11,6 +11,8 @@ ============================================================================*/ #include "cmDocumentationFormatterDocbook.h" #include "cmDocumentationSection.h" +#include +#include // for isalnum //---------------------------------------------------------------------------- // this function is a copy of the one in the HTML formatter @@ -107,21 +109,9 @@ void cmDocumentationFormatterDocbook { if(name) { - std::string id = "section_"; - id += name; - if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end()) - { - this->EmittedLinkIds.insert(id); - os << "\n" - "\n" << name << "\n"; - } - else - { - static unsigned int i=0; - i++; - os << "\n" - "\n" << name << "\n"; - } + os << "PrintId(os, 0, name); + os << "\">\n" << name << "\n"; } std::string prefix = this->ComputeSectionLinkPrefix(name); @@ -138,28 +128,8 @@ void cmDocumentationFormatterDocbook { if(op->Name.size()) { - os << " Name.c_str()); - - // make sure that each id exists only once. Since it seems - // not easily possible to determine which link refers to which id, - // we have at least to make sure that the duplicated id's get a - // different name (by appending an increasing number), Alex - std::string id = prefix; - id += "_"; - id += op->Name; - if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end()) - { - this->EmittedLinkIds.insert(id); - } - else - { - static unsigned int i=0; - i++; - os << i; - } - // continue as normal... - + os << " PrintId(os, prefix.c_str(), op->Name); os << "\">"; cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); os << " "; @@ -213,6 +183,8 @@ void cmDocumentationFormatterDocbook::PrintHeader(const char* docname, const char* appname, std::ostream& os) { + this->docname = docname; + // this one is used to ensure that we don't create multiple link targets // with the same name. We can clear it here since we are at the // start of a document here. @@ -235,3 +207,28 @@ void cmDocumentationFormatterDocbook::PrintFooter(std::ostream& os) os << "\n"; } +//---------------------------------------------------------------------------- +void cmDocumentationFormatterDocbook +::PrintId(std::ostream& os, const char* prefix, std::string id) +{ + std::replace_if(id.begin(), id.end(), std::not1(std::ptr_fun(isalnum)), '_'); + if(prefix) + { + id = std::string(prefix) + "." + id; + } + os << this->docname << '.' << id; + + // make sure that each id exists only once. Since it seems + // not easily possible to determine which link refers to which id, + // we have at least to make sure that the duplicated id's get a + // different name (by appending an increasing number), Alex + if (this->EmittedLinkIds.find(id) == this->EmittedLinkIds.end()) + { + this->EmittedLinkIds.insert(id); + } + else + { + static unsigned int i=0; + os << i++; + } +} diff --git a/Source/cmDocumentationFormatterDocbook.h b/Source/cmDocumentationFormatterDocbook.h index 213948dcc..6c969002f 100644 --- a/Source/cmDocumentationFormatterDocbook.h +++ b/Source/cmDocumentationFormatterDocbook.h @@ -35,7 +35,9 @@ public: virtual void PrintPreformatted(std::ostream& os, const char* text); virtual void PrintParagraph(std::ostream& os, const char* text); private: + void PrintId(std::ostream& os, const char* prefix, std::string id); std::set EmittedLinkIds; + std::string docname; }; #endif From 55146ed0f04732c076c5caece8d8fb762fa24545 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 7 Sep 2012 10:35:55 +0200 Subject: [PATCH 102/152] docbook: Fix the DocBook section output The DocBook formatter used to generate something like: TitleSome Text Which was completely wrong. In DocBook, a section should look like this: TitleSome Text --- Source/cmDocumentationFormatterDocbook.cxx | 39 +++++++++------------- 1 file changed, 15 insertions(+), 24 deletions(-) diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index a109c53ec..47ea5120d 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -120,40 +120,31 @@ void cmDocumentationFormatterDocbook section.GetEntries(); for(std::vector::const_iterator op = entries.begin(); - op != entries.end();) + op != entries.end(); ++op) { if(op->Name.size()) { - for(;op != entries.end() && op->Name.size(); ++op) + os << "PrintId(os, prefix.c_str(), op->Name); + os << "\">\n"; + cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); + os << "\n"; + if(op->Full.size()) { - if(op->Name.size()) - { - os << " PrintId(os, prefix.c_str(), op->Name); - os << "\">"; - cmDocumentationPrintDocbookEscapes(os, op->Name.c_str()); - os << " "; - } + os << "\n"; cmDocumentationPrintDocbookEscapes(os, op->Brief.c_str()); - if(op->Name.size()) - { - os << "\n"; - } - - if(op->Full.size()) - { - // a line break seems to be simply a line break with docbook - os << "\n "; - this->PrintFormatted(os, op->Full.c_str()); - } - os << "\n"; + os << "\n\n"; + this->PrintFormatted(os, op->Full.c_str()); } + else + { + this->PrintFormatted(os, op->Brief.c_str()); + } + os << "\n"; } else { this->PrintFormatted(os, op->Brief.c_str()); - os << "\n"; - ++op; } } if(name) From 67e7d49cb8e226221b46ce9182d9620fa3efcb63 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 7 Sep 2012 10:41:49 +0200 Subject: [PATCH 103/152] docbook: Cleanup formatter and generated DocBook Comment and whitespace changes, changed docbook version to 4.5, changed to (the latter implies a fixed-size font). --- Source/cmDocumentationFormatterDocbook.cxx | 64 +++++++++++----------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index 47ea5120d..51b93ae9d 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -96,28 +96,24 @@ void cmDocumentationPrintDocbookEscapes(std::ostream& os, const char* text) } } - +//---------------------------------------------------------------------------- cmDocumentationFormatterDocbook::cmDocumentationFormatterDocbook() :cmDocumentationFormatter() { } +//---------------------------------------------------------------------------- void cmDocumentationFormatterDocbook ::PrintSection(std::ostream& os, const cmDocumentationSection §ion, const char* name) { - if(name) - { - os << "PrintId(os, 0, name); - os << "\">\n" << name << "\n"; - } + os << "PrintId(os, 0, name); + os << "\">\n" << name << "\n"; std::string prefix = this->ComputeSectionLinkPrefix(name); - - const std::vector &entries = - section.GetEntries(); + const std::vector &entries = section.GetEntries(); for(std::vector::const_iterator op = entries.begin(); op != entries.end(); ++op) @@ -147,32 +143,36 @@ void cmDocumentationFormatterDocbook this->PrintFormatted(os, op->Brief.c_str()); } } - if(name) + + // empty sections are not allowed in docbook. + if(entries.empty()) { - os << "\n"; + os << "\n"; } -} -void cmDocumentationFormatterDocbook::PrintPreformatted(std::ostream& os, - const char* text) -{ - os << ""; - cmDocumentationPrintDocbookEscapes(os, text); - os << "\n "; -} - -void cmDocumentationFormatterDocbook::PrintParagraph(std::ostream& os, - const char* text) -{ - os << ""; - cmDocumentationPrintDocbookEscapes(os, text); - os << ""; + os << "\n"; } //---------------------------------------------------------------------------- -void cmDocumentationFormatterDocbook::PrintHeader(const char* docname, - const char* appname, - std::ostream& os) +void cmDocumentationFormatterDocbook +::PrintPreformatted(std::ostream& os, const char* text) +{ + os << ""; + cmDocumentationPrintDocbookEscapes(os, text); + os << "\n"; +} + +void cmDocumentationFormatterDocbook +::PrintParagraph(std::ostream& os, const char* text) +{ + os << ""; + cmDocumentationPrintDocbookEscapes(os, text); + os << "\n"; +} + +//---------------------------------------------------------------------------- +void cmDocumentationFormatterDocbook +::PrintHeader(const char* docname, const char* appname, std::ostream& os) { this->docname = docname; @@ -182,8 +182,8 @@ void cmDocumentationFormatterDocbook::PrintHeader(const char* docname, this->EmittedLinkIds.clear(); os << "\n" - "\n" " ]>\n" "
\n" From c2f47590ef4fb937a5baa4d4b9e0f364e812d407 Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Wed, 5 Sep 2012 17:25:44 -0400 Subject: [PATCH 104/152] curl: Use find_package(OpenSSL) Change the code to use the standard CMake FindOpenSSL instead of the handcrafted attempt that was there before. --- Utilities/cmcurl/CMakeLists.txt | 16 ++++------------ Utilities/cmcurl/config.h.in | 3 --- 2 files changed, 4 insertions(+), 15 deletions(-) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index caa44f1d6..7eb16d317 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -169,22 +169,14 @@ IF(NOT CURL_SPECIAL_LIBZ) CHECK_LIBRARY_EXISTS_CONCAT("z" inflateEnd HAVE_LIBZ) ENDIF(NOT CURL_SPECIAL_LIBZ) -OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code." OFF) +OPTION(CMAKE_USE_OPENSSL "Use OpenSSL code with curl." OFF) MARK_AS_ADVANCED(CMAKE_USE_OPENSSL) IF(CMAKE_USE_OPENSSL) SET(USE_SSLEAY TRUE) SET(USE_OPENSSL TRUE) - IF(WIN32) - FIND_PATH(SSLINCLUDE openssl/crypto.h - PATHS c:/hoffman/Tools/openssl_w32vc6-0.9.8g/inc32) - INCLUDE_DIRECTORIES(${SSLINCLUDE}) - FIND_LIBRARY(LIBEAY NAMES libeay32) - FIND_LIBRARY(SSLEAY NAMES ssleay32) - SET(CURL_LIBS ${CURL_LIBS} ${LIBEAY} ${SSLEAY} ) - ELSE(WIN32) - CHECK_LIBRARY_EXISTS_CONCAT("crypto" CRYPTO_lock HAVE_LIBCRYPTO) - CHECK_LIBRARY_EXISTS_CONCAT("ssl" SSL_connect HAVE_LIBSSL) - ENDIF(WIN32) + FIND_PACKAGE(OpenSSL REQUIRED) + INCLUDE_DIRECTORIES(${OPENSSL_INCLUDE_DIR}) + SET(CURL_LIBS ${CURL_LIBS} ${OPENSSL_LIBRARIES}) SET(CURL_CA_BUNDLE "" CACHE FILEPATH "Path to SSL CA Certificate Bundle") MARK_AS_ADVANCED(CURL_CA_BUNDLE) IF(CURL_CA_BUNDLE) diff --git a/Utilities/cmcurl/config.h.in b/Utilities/cmcurl/config.h.in index 6e74935a3..e18af8ffe 100644 --- a/Utilities/cmcurl/config.h.in +++ b/Utilities/cmcurl/config.h.in @@ -255,9 +255,6 @@ /* Define to 1 if you have the header file. */ #cmakedefine HAVE_LIBSSH2_H ${HAVE_LIBSSH2_H} -/* Define to 1 if you have the `ssl' library (-lssl). */ -#cmakedefine HAVE_LIBSSL ${HAVE_LIBSSL} - /* if zlib is available */ #cmakedefine HAVE_LIBZ ${HAVE_LIBZ} From bc0e8c28ece1d681449b9b4b43b16fb5b331534e Mon Sep 17 00:00:00 2001 From: Bill Hoffman Date: Thu, 6 Sep 2012 15:37:00 -0400 Subject: [PATCH 105/152] curl: Make OpenSSL DLLs available to CMake on Windows Find the OpenSSL runtime DLLs and place them next to the CMake executables in the build tree and the install tree. --- Utilities/cmcurl/CMakeLists.txt | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 7eb16d317..ef000a16a 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -182,6 +182,29 @@ IF(CMAKE_USE_OPENSSL) IF(CURL_CA_BUNDLE) ADD_DEFINITIONS(-DCURL_CA_BUNDLE="${CURL_CA_BUNDLE}") ENDIF(CURL_CA_BUNDLE) + # for windows we want to install OPENSSL_LIBRARIES dlls + # and also copy them into the build tree so that testing + # can find them. + IF(WIN32) + FIND_FILE(CMAKE_EAY_DLL NAME libeay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..) + FIND_FILE(CMAKE_SSL_DLL NAME ssleay32.dll HINTS ${OPENSSL_INCLUDE_DIR}/..) + MARK_AS_ADVANCED(CMAKE_EAY_DLL CMAKE_SSL_DLL) + IF(CMAKE_SSL_DLL AND CMAKE_EAY_DLL) + SET(CMAKE_CURL_SSL_DLLS ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll) + ADD_CUSTOM_COMMAND(OUTPUT + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll + DEPENDS ${CMAKE_EAY_DLL} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_EAY_DLL} + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/libeay32.dll) + ADD_CUSTOM_COMMAND(OUTPUT + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll + DEPENDS ${CMAKE_SSL_DLL} + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SSL_DLL} + ${CMake_BIN_DIR}/${CMAKE_CFG_INTDIR}/ssleay32.dll) + INSTALL(PROGRAMS ${CMAKE_EAY_DLL} ${CMAKE_SSL_DLL} DESTINATION bin) + ENDIF() + ENDIF() ENDIF(CMAKE_USE_OPENSSL) # Check for idn @@ -690,8 +713,7 @@ ENDFOREACH() CONFIGURE_FILE(${LIBCURL_SOURCE_DIR}/config.h.in ${LIBCURL_BINARY_DIR}/config.h) - -ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS}) +ADD_LIBRARY(cmcurl ${LIBRARY_TYPE} ${libCurl_SRCS} ${CMAKE_CURL_SSL_DLLS}) TARGET_LINK_LIBRARIES(cmcurl ${CURL_LIBS}) IF(CMAKE_BUILD_CURL_SHARED) SET_TARGET_PROPERTIES(cmcurl PROPERTIES DEFINE_SYMBOL BUILDING_LIBCURL From 8b51762426ff6e3efbe61ee49f99755c24b4772c Mon Sep 17 00:00:00 2001 From: Brad King Date: Fri, 7 Sep 2012 13:23:45 -0400 Subject: [PATCH 106/152] curl: Honor OPENSSL_NO_SSL2 Some OpenSSL distributions have dropped support for the ancient SSLv2 protocol completely. Port changes from upstream curl to recognize this case and avoid using it. --- Utilities/cmcurl/curl/curl.h | 2 +- Utilities/cmcurl/ssluse.c | 5 +++++ Utilities/cmcurl/strerror.c | 5 ++++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Utilities/cmcurl/curl/curl.h b/Utilities/cmcurl/curl/curl.h index 157c634a4..e586c4a8c 100644 --- a/Utilities/cmcurl/curl/curl.h +++ b/Utilities/cmcurl/curl/curl.h @@ -312,7 +312,7 @@ typedef enum { CURLE_UNSUPPORTED_PROTOCOL, /* 1 */ CURLE_FAILED_INIT, /* 2 */ CURLE_URL_MALFORMAT, /* 3 */ - CURLE_URL_MALFORMAT_USER, /* 4 - NOT USED */ + CURLE_NOT_BUILT_IN, /* 4 */ CURLE_COULDNT_RESOLVE_PROXY, /* 5 */ CURLE_COULDNT_RESOLVE_HOST, /* 6 */ CURLE_COULDNT_CONNECT, /* 7 */ diff --git a/Utilities/cmcurl/ssluse.c b/Utilities/cmcurl/ssluse.c index 55afb2446..14d05ac65 100644 --- a/Utilities/cmcurl/ssluse.c +++ b/Utilities/cmcurl/ssluse.c @@ -1285,8 +1285,13 @@ Curl_ossl_connect_step1(struct connectdata *conn, req_method = TLSv1_client_method(); break; case CURL_SSLVERSION_SSLv2: +#ifdef OPENSSL_NO_SSL2 + failf(data, "OpenSSL was built without SSLv2 support"); + return CURLE_NOT_BUILT_IN; +#else req_method = SSLv2_client_method(); break; +#endif case CURL_SSLVERSION_SSLv3: req_method = SSLv3_client_method(); break; diff --git a/Utilities/cmcurl/strerror.c b/Utilities/cmcurl/strerror.c index 6304fe89d..74c345779 100644 --- a/Utilities/cmcurl/strerror.c +++ b/Utilities/cmcurl/strerror.c @@ -69,6 +69,10 @@ curl_easy_strerror(CURLcode error) case CURLE_URL_MALFORMAT: return "URL using bad/illegal format or missing URL"; + case CURLE_NOT_BUILT_IN: + return "A requested feature, protocol or option was not found built-in in" + " this libcurl due to a build-time decision."; + case CURLE_COULDNT_RESOLVE_PROXY: return "couldn't resolve proxy name"; @@ -287,7 +291,6 @@ curl_easy_strerror(CURLcode error) return "Error in the SSH layer"; /* error codes not used by current libcurl */ - case CURLE_URL_MALFORMAT_USER: case CURLE_FTP_USER_PASSWORD_INCORRECT: case CURLE_MALFORMAT_USER: case CURLE_BAD_CALLING_ORDER: From d35f552614014525b1de543dfe36be5e337a11d1 Mon Sep 17 00:00:00 2001 From: Kitware Robot Date: Sat, 8 Sep 2012 00:01:01 -0400 Subject: [PATCH 107/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 40969ca43..18e2126b5 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 9) -set(CMake_VERSION_TWEAK 20120907) +set(CMake_VERSION_TWEAK 20120908) #set(CMake_VERSION_RC 1) From 3a9e373a69345afbdafef9357eced5857a569f81 Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Fri, 7 Sep 2012 10:55:58 +0200 Subject: [PATCH 108/152] docbook: Add support for at section level 1 If a section has subsections (ie. subelemens with a title), all elements before the first title are written inside an . Also wrap in , to allow preformatted output in abstracts. --- Source/cmDocumentationFormatterDocbook.cxx | 26 ++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index 51b93ae9d..9ff784701 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -115,11 +115,28 @@ void cmDocumentationFormatterDocbook std::string prefix = this->ComputeSectionLinkPrefix(name); const std::vector &entries = section.GetEntries(); + bool hasSubSections = false; for(std::vector::const_iterator op = entries.begin(); op != entries.end(); ++op) { if(op->Name.size()) { + hasSubSections = true; + break; + } + } + + bool inAbstract = false; + for(std::vector::const_iterator op = entries.begin(); + op != entries.end(); ++op) + { + if(op->Name.size()) + { + if(inAbstract) + { + os << "\n"; + inAbstract = false; + } os << "PrintId(os, prefix.c_str(), op->Name); os << "\">\n"; @@ -140,6 +157,11 @@ void cmDocumentationFormatterDocbook } else { + if(hasSubSections && op == entries.begin()) + { + os << "<abstract>\n"; + inAbstract = true; + } this->PrintFormatted(os, op->Brief.c_str()); } } @@ -157,9 +179,9 @@ void cmDocumentationFormatterDocbook void cmDocumentationFormatterDocbook ::PrintPreformatted(std::ostream& os, const char* text) { - os << "<programlisting>"; + os << "<para>\n<programlisting>"; cmDocumentationPrintDocbookEscapes(os, text); - os << "</programlisting>\n"; + os << "</programlisting>\n</para>\n"; } void cmDocumentationFormatterDocbook From 9468b41daf3ac3da79f1be7fcbd5b6f747ea752f Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer <daniel@pfeifer-mail.de> Date: Fri, 7 Sep 2012 12:51:59 +0200 Subject: [PATCH 109/152] docbook: Add CMake.DocBook test to validate xml (#13508) The DocBook DTD is provided in "Utilities/xml/docbook-4.5". --- Utilities/CMakeLists.txt | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/Utilities/CMakeLists.txt b/Utilities/CMakeLists.txt index cb50eca21..b8f6b3cb6 100644 --- a/Utilities/CMakeLists.txt +++ b/Utilities/CMakeLists.txt @@ -27,7 +27,6 @@ set(MAN_FILES ) set(TEXT_FILES ${CMake_BINARY_DIR}/Docs/cmake.txt - ${CMake_BINARY_DIR}/Docs/cmake.docbook ${CMake_BINARY_DIR}/Docs/cmake-policies.txt ${CMake_BINARY_DIR}/Docs/cmake-properties.txt ${CMake_BINARY_DIR}/Docs/cmake-variables.txt @@ -44,6 +43,9 @@ set(HTML_FILES ${CMake_BINARY_DIR}/Docs/cmake-commands.html ${CMake_BINARY_DIR}/Docs/cmake-compatcommands.html ) +set(DOCBOOK_FILES + ${CMake_BINARY_DIR}/Docs/cmake.docbook + ) macro(ADD_DOCS target dependency) # Generate documentation for "ctest" executable. @@ -63,11 +65,9 @@ macro(ADD_DOCS target dependency) ) set(DOC_FILES ${DOC_FILES} ${CMake_BINARY_DIR}/Docs/${target}.txt) list(APPEND MAN_FILES ${CMake_BINARY_DIR}/Docs/${target}.1) - list(APPEND TEXT_FILES - ${CMake_BINARY_DIR}/Docs/${target}.txt - ${CMake_BINARY_DIR}/Docs/${target}.docbook - ) + list(APPEND TEXT_FILES ${CMake_BINARY_DIR}/Docs/${target}.txt) list(APPEND HTML_FILES ${CMake_BINARY_DIR}/Docs/${target}.html) + list(APPEND DOCBOOK_FILES ${CMake_BINARY_DIR}/Docs/${target}.docbook) endif() endmacro() @@ -124,7 +124,11 @@ add_custom_command( ) install_files(${CMAKE_MAN_DIR}/man1 FILES ${MAN_FILES}) -install_files(${CMAKE_DOC_DIR} FILES ${HTML_FILES} ${TEXT_FILES}) +install_files(${CMAKE_DOC_DIR} FILES + ${TEXT_FILES} + ${HTML_FILES} + ${DOCBOOK_FILES} + ) install(FILES cmake.m4 DESTINATION share/aclocal) # Drive documentation generation. @@ -152,6 +156,11 @@ if(BUILD_TESTING) --path ${_dtd_dir}/xhtml1 ${HTML_FILES} ) + add_test(CMake.DocBook + ${LIBXML2_XMLLINT_EXECUTABLE} --valid --noout --nonet + --path ${_dtd_dir}/docbook-4.5 + ${DOCBOOK_FILES} + ) endif() endif() endif() From 9ad85dbb25c0c9098f7fac276b5d27a636f1924f Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer <daniel@pfeifer-mail.de> Date: Fri, 7 Sep 2012 13:00:31 +0200 Subject: [PATCH 110/152] docbook: Remove redundant docs that cause invalid DocBook If a subsection with a title is added, all subsequent subsections need a title too. The "helpful links" just repeat preceding subsections anyway. --- Source/cmDocumentation.cxx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/Source/cmDocumentation.cxx b/Source/cmDocumentation.cxx index 1b042ae6f..c1360efca 100644 --- a/Source/cmDocumentation.cxx +++ b/Source/cmDocumentation.cxx @@ -148,13 +148,6 @@ static const char *cmDocumentationStandardSeeAlso[][3] = "The list is member-post-only but one may sign up on the CMake web page. " "Please first read the full documentation at " "http://www.cmake.org before posting questions to the list."}, - {0, - "Summary of helpful links:\n" - " Home: http://www.cmake.org\n" - " Docs: http://www.cmake.org/HTML/Documentation.html\n" - " Mail: http://www.cmake.org/HTML/MailingLists.html\n" - " FAQ: http://www.cmake.org/Wiki/CMake_FAQ\n" - , 0}, {0,0,0} }; From 656ab19b5cbe0f563f72f8219c5670df2351c153 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer <eike@sf-mail.de> Date: Sat, 8 Sep 2012 19:06:44 +0200 Subject: [PATCH 111/152] FindGettext: remove code duplicating FPHSA checks --- Modules/FindGettext.cmake | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index c4774d94b..31bcc6186 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -210,11 +210,4 @@ function(GETTEXT_PROCESS_PO_FILES _lang) endfunction() -if (GETTEXT_MSGMERGE_EXECUTABLE AND GETTEXT_MSGFMT_EXECUTABLE ) - set(GETTEXT_FOUND TRUE) -else () - set(GETTEXT_FOUND FALSE) - if (GetText_REQUIRED) - message(FATAL_ERROR "GetText not found") - endif () -endif () +set(GETTEXT_FOUND ${Gettext_FOUND}) From ff0d1a8d84754dd083d3a175696a3ad0c10ebe27 Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer <eike@sf-mail.de> Date: Sat, 8 Sep 2012 19:03:26 +0200 Subject: [PATCH 112/152] include FPHSA from current directory in all modules --- Modules/FindArmadillo.cmake | 2 +- Modules/FindGettext.cmake | 4 ++-- Modules/FindLibLZMA.cmake | 4 ++-- Modules/FindPostgreSQL.cmake | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Modules/FindArmadillo.cmake b/Modules/FindArmadillo.cmake index bc0357e98..4758534d7 100644 --- a/Modules/FindArmadillo.cmake +++ b/Modules/FindArmadillo.cmake @@ -76,7 +76,7 @@ endif () # Checks 'REQUIRED', 'QUIET' and versions. -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(Armadillo REQUIRED_VARS ARMADILLO_LIBRARY ARMADILLO_INCLUDE_DIR VERSION_VAR ARMADILLO_VERSION_STRING) diff --git a/Modules/FindGettext.cmake b/Modules/FindGettext.cmake index c4774d94b..cdb02cf88 100644 --- a/Modules/FindGettext.cmake +++ b/Modules/FindGettext.cmake @@ -54,12 +54,12 @@ if(GETTEXT_MSGMERGE_EXECUTABLE) unset(gettext_version) endif() -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(Gettext REQUIRED_VARS GETTEXT_MSGMERGE_EXECUTABLE GETTEXT_MSGFMT_EXECUTABLE VERSION_VAR GETTEXT_VERSION_STRING) -include(CMakeParseArguments) +include(${CMAKE_CURRENT_LIST_DIR}/CMakeParseArguments.cmake) function(_GETTEXT_GET_UNIQUE_TARGET_NAME _name _unique_name) set(propertyName "_GETTEXT_UNIQUE_COUNTER_${_name}") diff --git a/Modules/FindLibLZMA.cmake b/Modules/FindLibLZMA.cmake index f8ea18bce..837e63324 100644 --- a/Modules/FindLibLZMA.cmake +++ b/Modules/FindLibLZMA.cmake @@ -47,13 +47,13 @@ endif() # it can be found in http://tukaani.org/xz/ # Avoid using old codebase if (LIBLZMA_LIBRARY) - include(CheckLibraryExists) + include(${CMAKE_CURRENT_LIST_DIR}/CheckLibraryExists.cmake) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_auto_decoder "" LIBLZMA_HAS_AUTO_DECODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_easy_encoder "" LIBLZMA_HAS_EASY_ENCODER) CHECK_LIBRARY_EXISTS(${LIBLZMA_LIBRARY} lzma_lzma_preset "" LIBLZMA_HAS_LZMA_PRESET) endif () -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibLZMA REQUIRED_VARS LIBLZMA_INCLUDE_DIR LIBLZMA_LIBRARY LIBLZMA_HAS_AUTO_DECODER diff --git a/Modules/FindPostgreSQL.cmake b/Modules/FindPostgreSQL.cmake index b9440a8f3..6a1d349fa 100644 --- a/Modules/FindPostgreSQL.cmake +++ b/Modules/FindPostgreSQL.cmake @@ -146,7 +146,7 @@ if (PostgreSQL_INCLUDE_DIR AND EXISTS "${PostgreSQL_INCLUDE_DIR}/pg_config.h") endif() # Did we find anything? -include(FindPackageHandleStandardArgs) +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) find_package_handle_standard_args(PostgreSQL REQUIRED_VARS PostgreSQL_LIBRARY PostgreSQL_INCLUDE_DIR PostgreSQL_TYPE_INCLUDE_DIR VERSION_VAR PostgreSQL_VERSION_STRING) From c19daefcec890dbcfc334c240ed2ec7b7597af2a Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Sun, 9 Sep 2012 00:01:04 -0400 Subject: [PATCH 113/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 18e2126b5..eceb78a81 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 9) -set(CMake_VERSION_TWEAK 20120908) +set(CMake_VERSION_TWEAK 20120909) #set(CMake_VERSION_RC 1) From 4e62784bf6c00bc01fd21dc08cac84b260ec9c11 Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Sun, 9 Sep 2012 10:55:22 -0400 Subject: [PATCH 114/152] docbook: Fix formatter naming convention to avoid shadow Some compilers complain: cmDocumentationFormatterDocbook.cxx: In member function virtual void cmDocumentationFormatterDocbook::PrintHeader(const char*, const char*, std::ostream&): cmDocumentationFormatterDocbook.cxx:197:73: warning: declaration of docname shadows a member of 'this' [-Wshadow] Fix the name of the member variable. --- Source/cmDocumentationFormatterDocbook.cxx | 4 ++-- Source/cmDocumentationFormatterDocbook.h | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index 9ff784701..a2ae20b15 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -196,7 +196,7 @@ void cmDocumentationFormatterDocbook void cmDocumentationFormatterDocbook ::PrintHeader(const char* docname, const char* appname, std::ostream& os) { - this->docname = docname; + this->Docname = docname; // this one is used to ensure that we don't create multiple link targets // with the same name. We can clear it here since we are at the @@ -229,7 +229,7 @@ void cmDocumentationFormatterDocbook { id = std::string(prefix) + "." + id; } - os << this->docname << '.' << id; + os << this->Docname << '.' << id; // make sure that each id exists only once. Since it seems // not easily possible to determine which link refers to which id, diff --git a/Source/cmDocumentationFormatterDocbook.h b/Source/cmDocumentationFormatterDocbook.h index 6c969002f..0352d342a 100644 --- a/Source/cmDocumentationFormatterDocbook.h +++ b/Source/cmDocumentationFormatterDocbook.h @@ -37,7 +37,7 @@ public: private: void PrintId(std::ostream& os, const char* prefix, std::string id); std::set<std::string> EmittedLinkIds; - std::string docname; + std::string Docname; }; #endif From 4e20ca7726269e2403fa9e18c316fb6c65391b44 Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Mon, 10 Sep 2012 00:01:05 -0400 Subject: [PATCH 115/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index eceb78a81..ff4fea712 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 9) -set(CMake_VERSION_TWEAK 20120909) +set(CMake_VERSION_TWEAK 20120910) #set(CMake_VERSION_RC 1) From d0c863f60f55d618f6b1c5dcdae0b8b3acff1f35 Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Mon, 10 Sep 2012 08:33:41 -0400 Subject: [PATCH 116/152] docbook: Fix Sun CC warning on ptr_fun(isalnum) The Sun compiler complains: cmDocumentationFormatterDocbook.cxx", line 230: Warning (Anachronism), badargtype2w: Formal argument x of type int(*)(int) in call to std::ptr_fun<int, int>(int(*)(int)) is being passed extern "C" int(*)(int). Add an intermediate C++ function to forward to the C function. --- Source/cmDocumentationFormatterDocbook.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/cmDocumentationFormatterDocbook.cxx b/Source/cmDocumentationFormatterDocbook.cxx index a2ae20b15..706ce0a02 100644 --- a/Source/cmDocumentationFormatterDocbook.cxx +++ b/Source/cmDocumentationFormatterDocbook.cxx @@ -13,6 +13,12 @@ #include "cmDocumentationSection.h" #include <algorithm> #include <ctype.h> // for isalnum + +static int cmIsAlnum(int c) +{ + return isalnum(c); +} + //---------------------------------------------------------------------------- // this function is a copy of the one in the HTML formatter @@ -224,7 +230,8 @@ void cmDocumentationFormatterDocbook::PrintFooter(std::ostream& os) void cmDocumentationFormatterDocbook ::PrintId(std::ostream& os, const char* prefix, std::string id) { - std::replace_if(id.begin(), id.end(), std::not1(std::ptr_fun(isalnum)), '_'); + std::replace_if(id.begin(), id.end(), + std::not1(std::ptr_fun(cmIsAlnum)), '_'); if(prefix) { id = std::string(prefix) + "." + id; From d8a1dd5865a86a719420ef80797732dfefff0258 Mon Sep 17 00:00:00 2001 From: Eric NOULARD <eric.noulard@gmail.com> Date: Tue, 14 Aug 2012 19:39:49 +0200 Subject: [PATCH 117/152] Handles %attr(nnn,-,-) /path/to/file in CPACK_RPM_USER_FILELIST properly. This triggered an unknown secondary bug when there is no ABSOLUTE INSTALL file. This is fixed as well. This is based on a fix of bug #0013468 from Viktor Dubrovsky. --- Modules/CPackRPM.cmake | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index b5826ef2f..0cec8973a 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -728,18 +728,24 @@ if(CPACK_RPM_USER_FILELIST_INTERNAL) set(CPACK_RPM_USER_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_USER_FILELIST_INTERNAL) - string(REGEX REPLACE "%[A-Za-z\(\)]* " "" F_PATH ${F}) - string(REGEX MATCH "%[A-Za-z\(\)]*" F_PREFIX ${F}) + string(REGEX REPLACE "%[A-Za-z0-9\(\),-]* " "" F_PATH ${F}) + string(REGEX MATCH "%[A-Za-z0-9\(\),-]*" F_PREFIX ${F}) + if(CPACK_RPM_PACKAGE_DEBUG) + message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") + endif() if(F_PREFIX) - set(F_PREFIX "${F_PREFIX} ") + set(F_PREFIX "${F_PREFIX} ") endif() # Rebuild the user list file set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n") # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH}) - list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) + # ABSOLUTE destination files list may not exists at all + if (CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) + list(REMOVE_ITEM CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL ${F_PATH}) + endif() endforeach() From 1db6dfeb237d7fa8edf45aa9bf82e4c628f3c79a Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Tue, 11 Sep 2012 00:01:02 -0400 Subject: [PATCH 118/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index ff4fea712..73d9d528b 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 9) -set(CMake_VERSION_TWEAK 20120910) +set(CMake_VERSION_TWEAK 20120911) #set(CMake_VERSION_RC 1) From 34567dfc0db6ba3748270a33d1c24e55c25edbfe Mon Sep 17 00:00:00 2001 From: Bill Hoffman <bill.hoffman@kitware.com> Date: Tue, 21 Aug 2012 18:41:24 -0400 Subject: [PATCH 119/152] file(DOWNLOAD): Generalize EXPECTED_MD5 to EXPECTED_HASH Add support for SHA algorithms. --- Source/cmFileCommand.cxx | 89 +++++++++++++--------- Source/cmFileCommand.h | 8 +- Tests/CMakeTests/FileDownloadTest.cmake.in | 53 +++++++++++++ 3 files changed, 111 insertions(+), 39 deletions(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 5103d395c..b0c107071 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -10,6 +10,7 @@ See the License for more information. ============================================================================*/ #include "cmFileCommand.h" +#include "cmCryptoHash.h" #include "cmake.h" #include "cmHexFileConverter.h" #include "cmInstallType.h" @@ -2666,7 +2667,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) long inactivity_timeout = 0; std::string verboseLog; std::string statusVar; - std::string expectedMD5sum; + std::string expectedHash; + std::string hashMatchMSG; + cmsys::auto_ptr<cmCryptoHash> hash; bool showProgress = false; while(i != args.end()) @@ -2725,48 +2728,67 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) this->SetError("DOWNLOAD missing sum value for EXPECTED_MD5."); return false; } - expectedMD5sum = cmSystemTools::LowerCase(*i); + hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New("MD5")); + hashMatchMSG = "MD5 sum"; + expectedHash = cmSystemTools::LowerCase(*i); } else if(*i == "SHOW_PROGRESS") { showProgress = true; } + else if(*i == "EXPECTED_HASH") + { + ++i; + if(i != args.end()) + { + hash = cmsys::auto_ptr<cmCryptoHash>(cmCryptoHash::New(i->c_str())); + if(!hash.get()) + { + std::string err = "DOWNLOAD bad SHA type: "; + err += *i; + this->SetError(err.c_str()); + return false; + } + hashMatchMSG = *i; + hashMatchMSG += " hash"; + + ++i; + } + if(i != args.end()) + { + expectedHash = cmSystemTools::LowerCase(*i); + } + else + { + this->SetError("DOWNLOAD missing time for EXPECTED_HASH."); + return false; + } + } ++i; } - - // If file exists already, and caller specified an expected md5 sum, - // and the existing file already has the expected md5 sum, then simply + // If file exists already, and caller specified an expected md5 or sha, + // and the existing file already has the expected hash, then simply // return. // - if(cmSystemTools::FileExists(file.c_str()) && - !expectedMD5sum.empty()) + if(cmSystemTools::FileExists(file.c_str()) && hash.get()) { - char computedMD5[32]; - - if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) - { - this->SetError("DOWNLOAD cannot compute MD5 sum on pre-existing file"); - return false; - } - - std::string actualMD5sum = cmSystemTools::LowerCase( - std::string(computedMD5, 32)); - - if (expectedMD5sum == actualMD5sum) + std::string msg; + std::string actualHash = hash->HashFile(file.c_str()); + if(actualHash == expectedHash) { + msg = "returning early; file already exists with expected "; + msg += hashMatchMSG; + msg += "\""; if(statusVar.size()) { cmOStringStream result; - result << (int)0 << ";\"" - "returning early: file already exists with expected MD5 sum\""; + result << (int)0 << ";\"" << msg; this->Makefile->AddDefinition(statusVar.c_str(), result.str().c_str()); } - return true; } } - // Make sure parent directory exists so we can write to the file // as we receive downloaded bits from curl... // @@ -2798,7 +2820,6 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) } cURLEasyGuard g_curl(curl); - ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); check_curl_result(res, "DOWNLOAD cannot set url: "); @@ -2888,26 +2909,22 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) // Verify MD5 sum if requested: // - if (!expectedMD5sum.empty()) + if (hash.get()) { - char computedMD5[32]; - - if (!cmSystemTools::ComputeFileMD5(file.c_str(), computedMD5)) + std::string actualHash = hash->HashFile(file.c_str()); + if (actualHash.size() == 0) { - this->SetError("DOWNLOAD cannot compute MD5 sum on downloaded file"); + this->SetError("DOWNLOAD cannot compute hash on downloaded file"); return false; } - std::string actualMD5sum = cmSystemTools::LowerCase( - std::string(computedMD5, 32)); - - if (expectedMD5sum != actualMD5sum) + if (expectedHash != actualHash) { cmOStringStream oss; - oss << "DOWNLOAD MD5 mismatch" << std::endl + oss << "DOWNLOAD HASH mismatch" << std::endl << " for file: [" << file << "]" << std::endl - << " expected MD5 sum: [" << expectedMD5sum << "]" << std::endl - << " actual MD5 sum: [" << actualMD5sum << "]" << std::endl + << " expected hash: [" << expectedHash << "]" << std::endl + << " actual hash: [" << actualHash << "]" << std::endl ; this->SetError(oss.str().c_str()); return false; diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index ced26c49b..ca2bdfda6 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -83,6 +83,7 @@ public: " file(TO_NATIVE_PATH path result)\n" " file(DOWNLOAD url file [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS]\n" + " [EXPECTED_HASH MD5|SHA1|SHA224|SHA256|SHA384|SHA512 hash]\n" " [EXPECTED_MD5 sum])\n" " file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n" @@ -168,11 +169,12 @@ public: "timeout after time seconds, time should be specified as an integer. " "The INACTIVITY_TIMEOUT specifies an integer number of seconds of " "inactivity after which the operation should terminate. " - "If EXPECTED_MD5 sum is specified, the operation will verify that the " - "downloaded file's actual md5 sum matches the expected value. If it " + "If EXPECTED_HASH is specified, the operation will verify that the " + "downloaded file's actual hash matches the expected value. If it " "does not match, the operation fails with an error. " + "(EXPECTED_MD5 is short-hand for EXPECTED_HASH MD5.) " "If SHOW_PROGRESS is specified, progress information will be printed " - "as status messages until the operation is complete." + "as status messages until the operation is complete. " "\n" "UPLOAD will upload the given file to the given URL. " "If LOG var is specified a log of the upload will be put in var. " diff --git a/Tests/CMakeTests/FileDownloadTest.cmake.in b/Tests/CMakeTests/FileDownloadTest.cmake.in index 9dc2ebb27..3f0ab5075 100644 --- a/Tests/CMakeTests/FileDownloadTest.cmake.in +++ b/Tests/CMakeTests/FileDownloadTest.cmake.in @@ -33,6 +33,59 @@ file(DOWNLOAD ) message(STATUS "FileDownload:4") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA1 50c614fc28b39c1281d0517bb6d5858b4359c9b7 + ) + +message(STATUS "FileDownload:5") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA224 73cd5f442b04e8320e4f907f8e1b21d4befff98b5bd77bc32526ea68 + ) + +message(STATUS "FileDownload:6") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA256 2e067f6c09cbc7cd619c8fbcc44eb64cd6b45a95e4cddb3a585eee1f731c4da9 + ) + +message(STATUS "FileDownload:7") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA384 398bf41902a7251c30e522b307e3e41e3fb617c765b3feaa99b2f7d063894708ad399267ccc25d877437a10e5e890d35 + ) + +message(STATUS "FileDownload:8") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH SHA512 c51854d21052713968b849c2b4263cf54be03bc3a7e9847a6c71c6c8d1d13cd805fe1b9fa95f9ba1d0a5631513974f6fae21e34ab5b171d94bad48df5f073e48 + ) +message(STATUS "FileDownload:9") +file(DOWNLOAD + ${url} + ${dir}/file3.png + TIMEOUT 2 + STATUS status + EXPECTED_HASH MD5 d16778650db435bda3a8c3435c3ff5d1 + ) + +message(STATUS "FileDownload:10") file(DOWNLOAD ${url} ${dir}/file3.png From 7924aacbfa193232465794fed4a1081c0424ef87 Mon Sep 17 00:00:00 2001 From: Alex Neundorf <neundorf@kde.org> Date: Tue, 4 Sep 2012 21:10:02 +0200 Subject: [PATCH 120/152] CMakeDetermineFortranCompiler: add support for cross-compiling (#13379) This adds the same support code for cross compiling to CMakeDetermineFortranCompiler as there is already in the C and CXX versions of this file. Alex --- Modules/CMakeDetermineFortranCompiler.cmake | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 051f8321a..f861e3954 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -189,6 +189,32 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) endif() endif() +if (NOT _CMAKE_TOOLCHAIN_LOCATION) + get_filename_component(_CMAKE_TOOLCHAIN_LOCATION "${CMAKE_Fortran_COMPILER}" PATH) +endif () + +# if we have a fortran cross compiler, they have usually some prefix, like +# e.g. powerpc-linux-gfortran, arm-elf-gfortran or i586-mingw32msvc-gfortran , optionally +# with a 3-component version number at the end (e.g. arm-eabi-gcc-4.5.2). +# The other tools of the toolchain usually have the same prefix +# NAME_WE cannot be used since then this test will fail for names lile +# "arm-unknown-nto-qnx6.3.0-gcc.exe", where BASENAME would be +# "arm-unknown-nto-qnx6" instead of the correct "arm-unknown-nto-qnx6.3.0-" +if (CMAKE_CROSSCOMPILING + AND "${CMAKE_Fortran_COMPILER_ID}" MATCHES "GNU" + AND NOT _CMAKE_TOOLCHAIN_PREFIX) + get_filename_component(COMPILER_BASENAME "${CMAKE_Fortran_COMPILER}" NAME) + if (COMPILER_BASENAME MATCHES "^(.+-)g?fortran(-[0-9]+\\.[0-9]+\\.[0-9]+)?(\\.exe)?$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () + + # if "llvm-" is part of the prefix, remove it, since llvm doesn't have its own binutils + # but uses the regular ar, objcopy, etc. (instead of llvm-objcopy etc.) + if ("${_CMAKE_TOOLCHAIN_PREFIX}" MATCHES "(.+-)?llvm-$") + set(_CMAKE_TOOLCHAIN_PREFIX ${CMAKE_MATCH_1}) + endif () +endif () + include(CMakeFindBinUtils) if(MSVC_Fortran_ARCHITECTURE_ID) From e1c89f08bb78127e20383bffb3d28dfccbe816a0 Mon Sep 17 00:00:00 2001 From: Bill Hoffman <bill.hoffman@kitware.com> Date: Tue, 21 Aug 2012 18:41:24 -0400 Subject: [PATCH 121/152] file(DOWNLOAD): Add options for SSL Add the ability to request that downloads disable or enable Certificate Authority checking with https ssl downloads. When the option to verify the servers CA is disabled, one may verify download contents with SHA hashes. --- Source/cmFileCommand.cxx | 67 ++++++++++++++++++++++++++++++++++++++++ Source/cmFileCommand.h | 11 ++++++- 2 files changed, 77 insertions(+), 1 deletion(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index b0c107071..bb129804e 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2667,6 +2667,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) long inactivity_timeout = 0; std::string verboseLog; std::string statusVar; + std::string caFile; + bool checkSSL = false; + bool verifySSL = false; std::string expectedHash; std::string hashMatchMSG; cmsys::auto_ptr<cmCryptoHash> hash; @@ -2720,6 +2723,33 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) } statusVar = *i; } + else if(*i == "SSL_VERIFY") + { + ++i; + if(i != args.end()) + { + verifySSL = cmSystemTools::IsOn(i->c_str()); + checkSSL = true; + } + else + { + this->SetError("SSL_VERIFY missing bool value."); + return false; + } + } + else if(*i == "SSL_CAINFO_FILE") + { + ++i; + if(i != args.end()) + { + caFile = *i; + } + else + { + this->SetError("SSL_CAFILE missing file value."); + return false; + } + } else if(*i == "EXPECTED_MD5") { ++i; @@ -2835,6 +2865,43 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) cmFileCommandCurlDebugCallback); check_curl_result(res, "DOWNLOAD cannot set debug function: "); + // check to see if SSL verification is requested + const char* verifyValue = + this->Makefile->GetDefinition("CMAKE_CURLOPT_SSL_VERIFYPEER"); + // if there is a cmake variable or if the command has SSL_VERIFY requested + if(verifyValue || checkSSL) + { + // the args to the command come first + bool verify = verifySSL; + if(!verify && verifyValue) + { + verify = cmSystemTools::IsOn(verifyValue); + } + if(verify) + { + res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1); + check_curl_result(res, "Unable to set SSL Verify on: "); + } + else + { + res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + check_curl_result(res, "Unable to set SSL Verify off: "); + } + } + // check to see if a CAINFO file has been specified + const char* cainfo = + this->Makefile->GetDefinition("CMAKE_CURLOPT_CAINFO_FILE"); + // command arg comes first + if(caFile.size()) + { + cainfo = caFile.c_str(); + } + if(cainfo) + { + res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cainfo); + check_curl_result(res, "Unable to set SSL Verify CAINFO: "); + } + cmFileCommandVectorOfChar chunkDebug; res = ::curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&fout); diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index ca2bdfda6..413e2f4e2 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -84,7 +84,8 @@ public: " file(DOWNLOAD url file [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS]\n" " [EXPECTED_HASH MD5|SHA1|SHA224|SHA256|SHA384|SHA512 hash]\n" - " [EXPECTED_MD5 sum])\n" + " [EXPECTED_MD5 sum]\n" + " [SSL_VERIFY on|off] [SSL_CAINFO_FILE file])\n" " file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n" "WRITE will write a message into a file called 'filename'. It " @@ -175,6 +176,14 @@ public: "(EXPECTED_MD5 is short-hand for EXPECTED_HASH MD5.) " "If SHOW_PROGRESS is specified, progress information will be printed " "as status messages until the operation is complete. " + "For https URLs CMake must be built with OpenSSL. " + "SSL certificates are not checked by default. " + "Set SSL_VERIFY to ON to check certificates and/or use " + "EXPECTED_HASH to verify downloaded content. " + "Set SSL_CAINFO_FILE to specify a custom Certificate Authority file. " + "If either SSL option is not given CMake will check variables " + "CMAKE_CURLOPT_SSL_VERIFYPEER and CMAKE_CURLOPT_CAINFO_FILE, " + "respectively." "\n" "UPLOAD will upload the given file to the given URL. " "If LOG var is specified a log of the upload will be put in var. " From 4bcd84e65ad2f792c549989b9d773191ad75e5eb Mon Sep 17 00:00:00 2001 From: Bill Hoffman <bill.hoffman@kitware.com> Date: Fri, 7 Sep 2012 15:30:19 -0400 Subject: [PATCH 122/152] Utilities/Release: Enable CMAKE_USE_OPENSSL in nightly binaries --- Utilities/Release/dash2win64_release.cmake | 1 + Utilities/Release/dashmacmini2_release.cmake | 4 ++++ Utilities/Release/dashmacmini5_release.cmake | 4 ++++ Utilities/Release/magrathea_release.cmake | 4 ++++ 4 files changed, 13 insertions(+) diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake index fb82de0d0..6d1ac767e 100644 --- a/Utilities/Release/dash2win64_release.cmake +++ b/Utilities/Release/dash2win64_release.cmake @@ -8,6 +8,7 @@ set(CPACK_SOURCE_GENERATORS "ZIP") set(MAKE_PROGRAM "make") set(MAKE "${MAKE_PROGRAM} -j8") set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release +CMAKE_USE_OPENSSL:BOOL=ON CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CMAKE_Fortran_COMPILER:FILEPATH=FALSE CMAKE_GENERATOR:INTERNAL=Unix Makefiles diff --git a/Utilities/Release/dashmacmini2_release.cmake b/Utilities/Release/dashmacmini2_release.cmake index 3e6b04973..5e57a70b2 100644 --- a/Utilities/Release/dashmacmini2_release.cmake +++ b/Utilities/Release/dashmacmini2_release.cmake @@ -9,6 +9,10 @@ set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ") set(INITIAL_CACHE " CMAKE_BUILD_TYPE:STRING=Release CMAKE_OSX_ARCHITECTURES:STRING=ppc;i386 +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/Users/kitware/openssl-1.0.1c-install/include +OPENSSL_SSL_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libssl.a CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE CPACK_SYSTEM_NAME:STRING=Darwin-universal BUILD_QtDialog:BOOL=TRUE diff --git a/Utilities/Release/dashmacmini5_release.cmake b/Utilities/Release/dashmacmini5_release.cmake index bd93a8733..36b095287 100644 --- a/Utilities/Release/dashmacmini5_release.cmake +++ b/Utilities/Release/dashmacmini5_release.cmake @@ -8,6 +8,10 @@ set(MAKE "${MAKE_PROGRAM} -j5") set(CPACK_BINARY_GENERATORS "PackageMaker TGZ TZ") set(CPACK_SOURCE_GENERATORS "TGZ TZ") set(INITIAL_CACHE " +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/Users/kitware/openssl-1.0.1c-install/include +OPENSSL_SSL_LIBRARY:FILEPATH=/Users/kitware/openssl-1.0.1c-install/lib/libssl.a CMAKE_BUILD_TYPE:STRING=Release CMAKE_OSX_ARCHITECTURES:STRING=x86_64;i386 CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.5 diff --git a/Utilities/Release/magrathea_release.cmake b/Utilities/Release/magrathea_release.cmake index 60c1a8860..4783fdad3 100644 --- a/Utilities/Release/magrathea_release.cmake +++ b/Utilities/Release/magrathea_release.cmake @@ -10,6 +10,10 @@ CMAKE_BUILD_TYPE:STRING=Release CURSES_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libncurses.a CURSES_INCLUDE_PATH:PATH=/usr/i686-gcc-332s/include/ncurses FORM_LIBRARY:FILEPATH=/usr/i686-gcc-332s/lib/libform.a +CMAKE_USE_OPENSSL:BOOL=ON +OPENSSL_CRYPTO_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1c-install/lib/libcrypto.a +OPENSSL_INCLUDE_DIR:PATH=/home/kitware/openssl-1.0.1c-install/include +OPENSSL_SSL_LIBRARY:FILEPATH=/home/kitware/openssl-1.0.1c-install/lib/libssl.a CPACK_SYSTEM_NAME:STRING=Linux-i386 BUILD_QtDialog:BOOL:=TRUE QT_QMAKE_EXECUTABLE:FILEPATH=/home/kitware/qt-4.43-install/bin/qmake From dfa0ebd646203e4cecc150ff7589392d899e13d4 Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Tue, 11 Sep 2012 15:52:21 -0400 Subject: [PATCH 123/152] if: Compare up to 8 components in VERSION tests Extend the number of components tested by if(... VERSION_LESS ...) if(... VERSION_EQUAL ...) if(... VERSION_GREATER ...) from 4 to 8. The latter is a more extreme maximum. --- Source/cmIfCommand.cxx | 16 ++++++++++------ Tests/CMakeTests/VersionTest.cmake.in | 7 +++++++ 2 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx index ffc0f35b8..56d717031 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -409,14 +409,18 @@ namespace enum Op { OpLess, OpEqual, OpGreater }; bool HandleVersionCompare(Op op, const char* lhs_str, const char* rhs_str) { - // Parse out up to 4 components. - unsigned int lhs[4] = {0,0,0,0}; - unsigned int rhs[4] = {0,0,0,0}; - sscanf(lhs_str, "%u.%u.%u.%u", &lhs[0], &lhs[1], &lhs[2], &lhs[3]); - sscanf(rhs_str, "%u.%u.%u.%u", &rhs[0], &rhs[1], &rhs[2], &rhs[3]); + // Parse out up to 8 components. + unsigned int lhs[8] = {0,0,0,0,0,0,0,0}; + unsigned int rhs[8] = {0,0,0,0,0,0,0,0}; + sscanf(lhs_str, "%u.%u.%u.%u.%u.%u.%u.%u", + &lhs[0], &lhs[1], &lhs[2], &lhs[3], + &lhs[4], &lhs[5], &lhs[6], &lhs[7]); + sscanf(rhs_str, "%u.%u.%u.%u.%u.%u.%u.%u", + &rhs[0], &rhs[1], &rhs[2], &rhs[3], + &rhs[4], &rhs[5], &rhs[6], &rhs[7]); // Do component-wise comparison. - for(unsigned int i=0; i < 4; ++i) + for(unsigned int i=0; i < 8; ++i) { if(lhs[i] < rhs[i]) { diff --git a/Tests/CMakeTests/VersionTest.cmake.in b/Tests/CMakeTests/VersionTest.cmake.in index 215bb2b96..9e31cb431 100644 --- a/Tests/CMakeTests/VersionTest.cmake.in +++ b/Tests/CMakeTests/VersionTest.cmake.in @@ -7,3 +7,10 @@ if("${CMAKE_VERSION}" VERSION_LESS "${min_ver}") else() message("CMAKE_VERSION=[${CMAKE_VERSION}] is not less than [${min_ver}]") endif() + +set(v 1.2.3.4.5.6.7) +if("${v}.8" VERSION_LESS "${v}.9") + message(STATUS "${v}.8 is less than ${v}.9") +else() + message(FATAL_ERROR "${v}.8 is not less than ${v}.9?") +endif() From beb8a8309bc0ce08e4884a59329607ac09c322ac Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Tue, 11 Sep 2012 10:53:17 -0400 Subject: [PATCH 124/152] ExternalProject: Generalize URL_MD5 option to URL_HASH Add support for SHA algorithms. --- Modules/ExternalProject.cmake | 96 ++++++++++++++-------------- Tests/ExternalProject/CMakeLists.txt | 2 +- 2 files changed, 48 insertions(+), 50 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index cd77ba4e2..c61e8f75b 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -24,7 +24,8 @@ # [HG_REPOSITORY url] # URL of mercurial repo # [HG_TAG tag] # Mercurial branch name, commit id or tag # [URL /.../src.tgz] # Full path or URL of source -# [URL_MD5 md5] # MD5 checksum of file at URL +# [URL_HASH ALGO=value] # Hash of file at URL +# [URL_MD5 md5] # Equivalent to URL_HASH MD5=md5 # [TIMEOUT seconds] # Time allowed for file download operations # #--Update/Patch step---------- # [UPDATE_COMMAND cmd...] # Source work-tree update command @@ -184,6 +185,9 @@ if(_ep_func) set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") endif() +# Save regex matching supported hash algorithm names. +set(_ep_hash_algos "MD5|SHA1|SHA224|SHA256|SHA384|SHA512") +set(_ep_hash_regex "^(${_ep_hash_algos})=([0-9A-Fa-f]+)$") function(_ep_parse_arguments f name ns args) # Transfer the arguments to this function into target properties for the @@ -395,7 +399,7 @@ endif() endfunction() -function(_ep_write_downloadfile_script script_filename remote local timeout md5) +function(_ep_write_downloadfile_script script_filename remote local timeout hash) if(timeout) set(timeout_args TIMEOUT ${timeout}) set(timeout_msg "${timeout} seconds") @@ -404,10 +408,10 @@ function(_ep_write_downloadfile_script script_filename remote local timeout md5) set(timeout_msg "none") endif() - if(md5) - set(md5_args EXPECTED_MD5 ${md5}) + if("${hash}" MATCHES "${_ep_hash_regex}") + set(hash_args EXPECTED_HASH ${CMAKE_MATCH_1} ${CMAKE_MATCH_2}) else() - set(md5_args "# no EXPECTED_MD5") + set(hash_args "# no EXPECTED_HASH") endif() file(WRITE ${script_filename} @@ -420,7 +424,7 @@ file(DOWNLOAD \"${remote}\" \"${local}\" SHOW_PROGRESS - ${md5_args} + ${hash_args} ${timeout_args} STATUS status LOG log) @@ -443,48 +447,30 @@ message(STATUS \"downloading... done\") endfunction() -function(_ep_write_verifyfile_script script_filename local md5) - file(WRITE ${script_filename} -"message(STATUS \"verifying file... - file='${local}'\") - -set(verified 0) - -# If an expected md5 checksum exists, compare against it: -# -if(NOT \"${md5}\" STREQUAL \"\") - execute_process(COMMAND \${CMAKE_COMMAND} -E md5sum \"${local}\" - OUTPUT_VARIABLE ov - OUTPUT_STRIP_TRAILING_WHITESPACE - RESULT_VARIABLE rv) - - if(NOT rv EQUAL 0) - message(FATAL_ERROR \"error: computing md5sum of '${local}' failed\") - endif() - - string(REGEX MATCH \"^([0-9A-Fa-f]+)\" md5_actual \"\${ov}\") - - string(TOLOWER \"\${md5_actual}\" md5_actual) - string(TOLOWER \"${md5}\" md5) - - if(NOT \"\${md5}\" STREQUAL \"\${md5_actual}\") - message(FATAL_ERROR \"error: md5sum of '${local}' does not match expected value - md5_expected: \${md5} - md5_actual: \${md5_actual} -\") - endif() - - set(verified 1) -endif() - -if(verified) +function(_ep_write_verifyfile_script script_filename local hash) + if("${hash}" MATCHES "${_ep_hash_regex}") + set(algo "${CMAKE_MATCH_1}") + string(TOLOWER "${CMAKE_MATCH_2}" expect_value) + set(script_content "set(expect_value \"${expect_value}\") +file(${algo} \"\${file}\" actual_value) +if(\"\${actual_value}\" STREQUAL \"\${expect_value}\") message(STATUS \"verifying file... done\") else() - message(STATUS \"verifying file... warning: did not verify file - no URL_MD5 checksum argument? corrupt file?\") -endif() -" -) - + message(FATAL_ERROR \"error: ${algo} hash of + \${file} +does not match expected value + expected: \${expect_value} + actual: \${actual_value} +\") +endif()") + else() + set(script_content "message(STATUS \"verifying file... warning: did not verify file - no URL_HASH specified?\")") + endif() + file(WRITE ${script_filename} "set(file \"${local}\") +message(STATUS \"verifying file... + file='\${file}'\") +${script_content} +") endfunction() @@ -1254,10 +1240,22 @@ function(_ep_add_download_command name) list(APPEND depends ${stamp_dir}/${name}-hginfo.txt) elseif(url) get_filename_component(work_dir "${source_dir}" PATH) + get_property(hash TARGET ${name} PROPERTY _EP_URL_HASH) + if(hash AND NOT "${hash}" MATCHES "${_ep_hash_regex}") + message(FATAL_ERROR "URL_HASH is set to\n ${hash}\n" + "but must be ALGO=value where ALGO is\n ${_ep_hash_algos}\n" + "and value is a hex string.") + endif() get_property(md5 TARGET ${name} PROPERTY _EP_URL_MD5) + if(md5 AND NOT "MD5=${md5}" MATCHES "${_ep_hash_regex}") + message(FATAL_ERROR "URL_MD5 is set to\n ${md5}\nbut must be a hex string.") + endif() + if(md5 AND NOT hash) + set(hash "MD5=${md5}") + endif() set(repository "external project URL") set(module "${url}") - set(tag "${md5}") + set(tag "${hash}") configure_file( "${CMAKE_ROOT}/Modules/RepositoryInfo.txt.in" "${stamp_dir}/${name}-urlinfo.txt" @@ -1283,7 +1281,7 @@ function(_ep_add_download_command name) string(REPLACE ";" "-" fname "${fname}") set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) - _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${md5}") + _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${hash}") set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake COMMAND) set(comment "Performing download step (download, verify and extract) for '${name}'") @@ -1291,7 +1289,7 @@ function(_ep_add_download_command name) set(file "${url}") set(comment "Performing download step (verify and extract) for '${name}'") endif() - _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${md5}") + _ep_write_verifyfile_script("${stamp_dir}/verify-${name}.cmake" "${file}" "${hash}") list(APPEND cmd ${CMAKE_COMMAND} -P ${stamp_dir}/verify-${name}.cmake COMMAND) _ep_write_extractfile_script("${stamp_dir}/extract-${name}.cmake" "${name}" "${file}" "${source_dir}") diff --git a/Tests/ExternalProject/CMakeLists.txt b/Tests/ExternalProject/CMakeLists.txt index 33ffe2ede..3f8e8273d 100644 --- a/Tests/ExternalProject/CMakeLists.txt +++ b/Tests/ExternalProject/CMakeLists.txt @@ -189,7 +189,7 @@ set_property(TARGET ${proj} PROPERTY FOLDER "Local/TGZ") set(proj TutorialStep1-LocalNoDirTGZ) ExternalProject_Add(${proj} URL "${CMAKE_CURRENT_SOURCE_DIR}/Step1NoDir.tgz" - URL_MD5 0b8182edcecdf40bf1c9d71d7d259f78 + URL_HASH SHA256=496229e2a5ed620a37c385ad9406004a18026beab8b55dd2c4565d4b7f1d5383 CMAKE_GENERATOR "${CMAKE_GENERATOR}" CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR> INSTALL_COMMAND "" From 442c07ea0a0f49550e1ff5d115b0974d7e066e2c Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Wed, 12 Sep 2012 00:01:05 -0400 Subject: [PATCH 125/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 73d9d528b..0d2d69df6 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 9) -set(CMake_VERSION_TWEAK 20120911) +set(CMake_VERSION_TWEAK 20120912) #set(CMake_VERSION_RC 1) From 248db6c03470adceeb5f92a97031b857472e34bc Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer <eike@sf-mail.de> Date: Sun, 19 Aug 2012 21:06:28 +0200 Subject: [PATCH 126/152] FindOpenSceneGraph: simplify by using more features of FPHSA --- Modules/FindOpenSceneGraph.cmake | 82 +++++--------------------------- 1 file changed, 12 insertions(+), 70 deletions(-) diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 1f30fe3f1..4a5aaba41 100644 --- a/Modules/FindOpenSceneGraph.cmake +++ b/Modules/FindOpenSceneGraph.cmake @@ -145,23 +145,6 @@ if(OSG_INCLUDE_DIR) endif() endif() -# -# Version checking -# -if(OpenSceneGraph_FIND_VERSION AND OPENSCENEGRAPH_VERSION) - if(OpenSceneGraph_FIND_VERSION_EXACT) - if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION}) - set(_osg_version_not_exact TRUE) - endif() - else() - # version is too low - if(NOT OPENSCENEGRAPH_VERSION VERSION_EQUAL ${OpenSceneGraph_FIND_VERSION} AND - NOT OPENSCENEGRAPH_VERSION VERSION_GREATER ${OpenSceneGraph_FIND_VERSION}) - set(_osg_version_not_high_enough TRUE) - endif() - endif() -endif() - set(_osg_quiet) if(OpenSceneGraph_FIND_QUIETLY) set(_osg_quiet "QUIET") @@ -190,63 +173,22 @@ if(OPENSCENEGRAPH_INCLUDE_DIR) endif() # -# Inform the users with an error message based on -# what version they have vs. what version was -# required. +# Check each module to see if it's found # +set(_osg_component_founds) if(OpenSceneGraph_FIND_REQUIRED) - set(_osg_version_output_type FATAL_ERROR) -else() - set(_osg_version_output_type STATUS) -endif() -if(_osg_version_not_high_enough) - set(_osg_EPIC_FAIL TRUE) - if(NOT OpenSceneGraph_FIND_QUIETLY) - message(${_osg_version_output_type} - "ERROR: Version ${OpenSceneGraph_FIND_VERSION} or higher of the OSG " - "is required. Version ${OPENSCENEGRAPH_VERSION} was found.") - endif() -elseif(_osg_version_not_exact) - set(_osg_EPIC_FAIL TRUE) - if(NOT OpenSceneGraph_FIND_QUIETLY) - message(${_osg_version_output_type} - "ERROR: Version ${OpenSceneGraph_FIND_VERSION} of the OSG is required " - "(exactly), version ${OPENSCENEGRAPH_VERSION} was found.") - endif() -else() - - # - # Check each module to see if it's found - # - if(OpenSceneGraph_FIND_REQUIRED) - set(_osg_missing_message) - foreach(_osg_module ${_osg_modules_to_process}) - string(TOUPPER ${_osg_module} _osg_module_UC) - if(NOT ${_osg_module_UC}_FOUND) - set(_osg_missing_nodekit_fail true) - set(_osg_missing_message "${_osg_missing_message} ${_osg_module}") - endif() - endforeach() - - if(_osg_missing_nodekit_fail) - message(FATAL_ERROR "ERROR: Missing the following osg " - "libraries: ${_osg_missing_message}.\n" - "Consider using CMAKE_PREFIX_PATH or the OSG_DIR " - "environment variable. See the " - "${CMAKE_CURRENT_LIST_FILE} for more details.") - endif() - endif() - - include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) - FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph DEFAULT_MSG OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR) + foreach(_osg_module ${_osg_modules_to_process}) + string(TOUPPER ${_osg_module} _osg_module_UC) + list(APPEND _osg_component_founds ${_osg_module_UC}_FOUND) + endforeach() endif() -if(_osg_EPIC_FAIL) - # Zero out everything, we didn't meet version requirements - set(OPENSCENEGRAPH_FOUND FALSE) - set(OPENSCENEGRAPH_LIBRARIES) - set(OPENSCENEGRAPH_INCLUDE_DIR) -endif() +include(${CMAKE_CURRENT_LIST_DIR}/FindPackageHandleStandardArgs.cmake) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(OpenSceneGraph + REQUIRED_VARS OPENSCENEGRAPH_LIBRARIES OPENSCENEGRAPH_INCLUDE_DIR ${_osg_component_founds} + VERSION_VAR OPENSCENEGRAPH_VERSION) + +unset(_osg_component_founds) set(OPENSCENEGRAPH_INCLUDE_DIRS ${OPENSCENEGRAPH_INCLUDE_DIR}) From c2664610845199f90f7f71664bfaf2d1c1a60ea9 Mon Sep 17 00:00:00 2001 From: Bill Hoffman <bill.hoffman@kitware.com> Date: Wed, 12 Sep 2012 18:31:52 -0400 Subject: [PATCH 127/152] Add SSL_VERIFYPEER and CAINFO file options to ExternalProject_Add. This commit adds the ability to turn on and off ssl certificate authority checking. It also adds the ability to specify a certificate authority information file. This can be done by setting global cmake variables CMAKE_CURLOPT_CAINFO_FILE and or CMAKE_CURLOPT_SSL_VERIFYPEER in the project calling ExternalProject_Add, or by passing those options to individual ExternalProject_Add calls. --- Modules/ExternalProject.cmake | 33 +++++++++++++++++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index c61e8f75b..d2e00a885 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -26,6 +26,8 @@ # [URL /.../src.tgz] # Full path or URL of source # [URL_HASH ALGO=value] # Hash of file at URL # [URL_MD5 md5] # Equivalent to URL_HASH MD5=md5 +# [SSL_VERIFYPEER bool] # Should certificate for https be checked +# [CAINFO_FILE file] # Path to a certificate authority file # [TIMEOUT seconds] # Time allowed for file download operations # #--Update/Patch step---------- # [UPDATE_COMMAND cmd...] # Source work-tree update command @@ -399,7 +401,7 @@ endif() endfunction() -function(_ep_write_downloadfile_script script_filename remote local timeout hash) +function(_ep_write_downloadfile_script script_filename remote local timeout hash ssl_verify cainfo_file) if(timeout) set(timeout_args TIMEOUT ${timeout}) set(timeout_msg "${timeout} seconds") @@ -413,6 +415,27 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash else() set(hash_args "# no EXPECTED_HASH") endif() + # check for curl globals in the project + if(DEFINED CMAKE_CURLOPT_SSL_VERIFYPEER) + set(ssl_verify "set(CMAKE_CURLOPT_SSL_VERIFYPEER ${CMAKE_CURLOPT_SSL_VERIFYPEER})") + endif() + if(DEFINED CMAKE_CURLOPT_CAINFO_FILE) + set(ssl_cainfo "set(CMAKE_CURLOPT_CAINFO_FILE \"${CMAKE_CURLOPT_CAINFO_FILE}\")") + endif() + + # now check for curl locals so that the local values + # will override the globals + + # check for ssl_verify argument + string(LENGTH "${ssl_verify}" ssl_verify_len) + if(ssl_verify_len GREATER 0) + set(ssl_verify "set(CMAKE_CURLOPT_SSL_VERIFYPEER ${ssl_verify})") + endif() + # check for cainfo_file argument + string(LENGTH "${cainfo_file}" cainfo_file_len) + if(cainfo_file_len GREATER 0) + set(ssl_cainfo "set(CMAKE_CURLOPT_CAINFO_FILE \"${cainfo_file}\")") + endif() file(WRITE ${script_filename} "message(STATUS \"downloading... @@ -420,6 +443,9 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash dst='${local}' timeout='${timeout_msg}'\") +${ssl_verify} +${ssl_cainfo} + file(DOWNLOAD \"${remote}\" \"${local}\" @@ -1281,7 +1307,10 @@ function(_ep_add_download_command name) string(REPLACE ";" "-" fname "${fname}") set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) - _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" "${url}" "${file}" "${timeout}" "${hash}") + get_property(ssl_verify TARGET ${name} PROPERTY _EP_SSL_VERIFYPEER) + get_property(cainfo_file TARGET ${name} PROPERTY _EP_CAINFO_FILE) + _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" + "${url}" "${file}" "${timeout}" "${hash}" "${ssl_verify}" "${cainfo_file}") set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake COMMAND) set(comment "Performing download step (download, verify and extract) for '${name}'") From f155e9ae2ea4ce970ac93d03b0b6b421333d83a8 Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Thu, 13 Sep 2012 00:01:03 -0400 Subject: [PATCH 128/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 0d2d69df6..9f3ce591a 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 9) -set(CMake_VERSION_TWEAK 20120912) +set(CMake_VERSION_TWEAK 20120913) #set(CMake_VERSION_RC 1) From c5f36de99ede2d53fe785f96bc3dc0f73bca9c64 Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Fri, 14 Sep 2012 00:01:01 -0400 Subject: [PATCH 129/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 9f3ce591a..a34cf6f0d 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 9) -set(CMake_VERSION_TWEAK 20120913) +set(CMake_VERSION_TWEAK 20120914) #set(CMake_VERSION_RC 1) From f34321a02d157a5d613874fc4dfd70b3df3d14b3 Mon Sep 17 00:00:00 2001 From: Patrick Gansterer <paroga@paroga.com> Date: Fri, 14 Sep 2012 11:16:43 +0200 Subject: [PATCH 130/152] VS: Remove duplicated implementations of CreateLocalGenerator() The IA64 and Win64 versions of the VS8 and VS9 generators contain the same code for this function as in the base class. --- Source/cmGlobalVisualStudio8Win64Generator.cxx | 11 ----------- Source/cmGlobalVisualStudio8Win64Generator.h | 3 --- Source/cmGlobalVisualStudio9IA64Generator.cxx | 11 ----------- Source/cmGlobalVisualStudio9IA64Generator.h | 3 --- Source/cmGlobalVisualStudio9Win64Generator.cxx | 11 ----------- Source/cmGlobalVisualStudio9Win64Generator.h | 3 --- 6 files changed, 42 deletions(-) diff --git a/Source/cmGlobalVisualStudio8Win64Generator.cxx b/Source/cmGlobalVisualStudio8Win64Generator.cxx index 60e45b840..164d11636 100644 --- a/Source/cmGlobalVisualStudio8Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio8Win64Generator.cxx @@ -22,17 +22,6 @@ cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator() this->ArchitectureId = "x64"; } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio8Win64Generator::CreateLocalGenerator() -{ - cmLocalVisualStudio7Generator *lg - = new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS8); - lg->SetPlatformName(this->GetPlatformName()); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio8Win64Generator ::GetDocumentation(cmDocumentationEntry& entry) const diff --git a/Source/cmGlobalVisualStudio8Win64Generator.h b/Source/cmGlobalVisualStudio8Win64Generator.h index 136cdb8b4..12f80125a 100644 --- a/Source/cmGlobalVisualStudio8Win64Generator.h +++ b/Source/cmGlobalVisualStudio8Win64Generator.h @@ -38,9 +38,6 @@ public: /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); - /** * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalVisualStudio9IA64Generator.cxx b/Source/cmGlobalVisualStudio9IA64Generator.cxx index 993340ae8..38dbfacc4 100644 --- a/Source/cmGlobalVisualStudio9IA64Generator.cxx +++ b/Source/cmGlobalVisualStudio9IA64Generator.cxx @@ -19,17 +19,6 @@ cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator() this->ArchitectureId = "Itanium"; } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio9IA64Generator::CreateLocalGenerator() -{ - cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); - lg->SetPlatformName(this->GetPlatformName()); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio9IA64Generator ::GetDocumentation(cmDocumentationEntry& entry) const diff --git a/Source/cmGlobalVisualStudio9IA64Generator.h b/Source/cmGlobalVisualStudio9IA64Generator.h index e33ee1550..989b0d1af 100644 --- a/Source/cmGlobalVisualStudio9IA64Generator.h +++ b/Source/cmGlobalVisualStudio9IA64Generator.h @@ -38,9 +38,6 @@ public: /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); - /** * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. diff --git a/Source/cmGlobalVisualStudio9Win64Generator.cxx b/Source/cmGlobalVisualStudio9Win64Generator.cxx index 08f537d1a..4d8a6463b 100644 --- a/Source/cmGlobalVisualStudio9Win64Generator.cxx +++ b/Source/cmGlobalVisualStudio9Win64Generator.cxx @@ -19,17 +19,6 @@ cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator() this->ArchitectureId = "x64"; } -///! Create a local generator appropriate to this Global Generator -cmLocalGenerator *cmGlobalVisualStudio9Win64Generator::CreateLocalGenerator() -{ - cmLocalVisualStudio7Generator *lg = - new cmLocalVisualStudio7Generator(cmLocalVisualStudioGenerator::VS9); - lg->SetPlatformName(this->GetPlatformName()); - lg->SetExtraFlagTable(this->GetExtraFlagTableVS8()); - lg->SetGlobalGenerator(this); - return lg; -} - //---------------------------------------------------------------------------- void cmGlobalVisualStudio9Win64Generator ::GetDocumentation(cmDocumentationEntry& entry) const diff --git a/Source/cmGlobalVisualStudio9Win64Generator.h b/Source/cmGlobalVisualStudio9Win64Generator.h index 0ce1afe3d..7c20cf4e2 100644 --- a/Source/cmGlobalVisualStudio9Win64Generator.h +++ b/Source/cmGlobalVisualStudio9Win64Generator.h @@ -38,9 +38,6 @@ public: /** Get the documentation entry for this generator. */ virtual void GetDocumentation(cmDocumentationEntry& entry) const; - ///! create the correct local generator - virtual cmLocalGenerator *CreateLocalGenerator(); - /** * Try to determine system infomation such as shared library * extension, pthreads, byte order etc. From 131d91a1f91116e85281d11d175290fdb211f664 Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Fri, 14 Sep 2012 15:40:09 -0400 Subject: [PATCH 131/152] Rename SSL terminology to TLS TLS has superseded SSL so rename the recently added file(DOWNLOAD) and ExternalProject options using the newer terminology. Drop "CURLOPT" from names because curl is an implementation detail. --- Modules/ExternalProject.cmake | 40 +++++++++++++++++------------------ Source/cmFileCommand.cxx | 34 ++++++++++++++--------------- Source/cmFileCommand.h | 12 +++++------ 3 files changed, 43 insertions(+), 43 deletions(-) diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index d2e00a885..39236859b 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -26,8 +26,8 @@ # [URL /.../src.tgz] # Full path or URL of source # [URL_HASH ALGO=value] # Hash of file at URL # [URL_MD5 md5] # Equivalent to URL_HASH MD5=md5 -# [SSL_VERIFYPEER bool] # Should certificate for https be checked -# [CAINFO_FILE file] # Path to a certificate authority file +# [TLS_VERIFY bool] # Should certificate for https be checked +# [TLS_CAINFO file] # Path to a certificate authority file # [TIMEOUT seconds] # Time allowed for file download operations # #--Update/Patch step---------- # [UPDATE_COMMAND cmd...] # Source work-tree update command @@ -401,7 +401,7 @@ endif() endfunction() -function(_ep_write_downloadfile_script script_filename remote local timeout hash ssl_verify cainfo_file) +function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo) if(timeout) set(timeout_args TIMEOUT ${timeout}) set(timeout_msg "${timeout} seconds") @@ -416,25 +416,25 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash set(hash_args "# no EXPECTED_HASH") endif() # check for curl globals in the project - if(DEFINED CMAKE_CURLOPT_SSL_VERIFYPEER) - set(ssl_verify "set(CMAKE_CURLOPT_SSL_VERIFYPEER ${CMAKE_CURLOPT_SSL_VERIFYPEER})") + if(DEFINED CMAKE_TLS_VERIFY) + set(tls_verify "set(CMAKE_TLS_VERIFY ${CMAKE_TLS_VERIFY})") endif() - if(DEFINED CMAKE_CURLOPT_CAINFO_FILE) - set(ssl_cainfo "set(CMAKE_CURLOPT_CAINFO_FILE \"${CMAKE_CURLOPT_CAINFO_FILE}\")") + if(DEFINED CMAKE_TLS_CAINFO) + set(tls_cainfo "set(CMAKE_TLS_CAINFO \"${CMAKE_TLS_CAINFO}\")") endif() # now check for curl locals so that the local values # will override the globals - # check for ssl_verify argument - string(LENGTH "${ssl_verify}" ssl_verify_len) - if(ssl_verify_len GREATER 0) - set(ssl_verify "set(CMAKE_CURLOPT_SSL_VERIFYPEER ${ssl_verify})") + # check for tls_verify argument + string(LENGTH "${tls_verify}" tls_verify_len) + if(tls_verify_len GREATER 0) + set(tls_verify "set(CMAKE_TLS_VERIFY ${tls_verify})") endif() - # check for cainfo_file argument - string(LENGTH "${cainfo_file}" cainfo_file_len) - if(cainfo_file_len GREATER 0) - set(ssl_cainfo "set(CMAKE_CURLOPT_CAINFO_FILE \"${cainfo_file}\")") + # check for tls_cainfo argument + string(LENGTH "${tls_cainfo}" tls_cainfo_len) + if(tls_cainfo_len GREATER 0) + set(tls_cainfo "set(CMAKE_TLS_CAINFO \"${tls_cainfo}\")") endif() file(WRITE ${script_filename} @@ -443,8 +443,8 @@ function(_ep_write_downloadfile_script script_filename remote local timeout hash dst='${local}' timeout='${timeout_msg}'\") -${ssl_verify} -${ssl_cainfo} +${tls_verify} +${tls_cainfo} file(DOWNLOAD \"${remote}\" @@ -1307,10 +1307,10 @@ function(_ep_add_download_command name) string(REPLACE ";" "-" fname "${fname}") set(file ${download_dir}/${fname}) get_property(timeout TARGET ${name} PROPERTY _EP_TIMEOUT) - get_property(ssl_verify TARGET ${name} PROPERTY _EP_SSL_VERIFYPEER) - get_property(cainfo_file TARGET ${name} PROPERTY _EP_CAINFO_FILE) + get_property(tls_verify TARGET ${name} PROPERTY _EP_TLS_VERIFY) + get_property(tls_cainfo TARGET ${name} PROPERTY _EP_TLS_CAINFO) _ep_write_downloadfile_script("${stamp_dir}/download-${name}.cmake" - "${url}" "${file}" "${timeout}" "${hash}" "${ssl_verify}" "${cainfo_file}") + "${url}" "${file}" "${timeout}" "${hash}" "${tls_verify}" "${tls_cainfo}") set(cmd ${CMAKE_COMMAND} -P ${stamp_dir}/download-${name}.cmake COMMAND) set(comment "Performing download step (download, verify and extract) for '${name}'") diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index bb129804e..1cb2ece6c 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2668,8 +2668,8 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) std::string verboseLog; std::string statusVar; std::string caFile; - bool checkSSL = false; - bool verifySSL = false; + bool checkTLS = false; + bool verifyTLS = false; std::string expectedHash; std::string hashMatchMSG; cmsys::auto_ptr<cmCryptoHash> hash; @@ -2723,21 +2723,21 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) } statusVar = *i; } - else if(*i == "SSL_VERIFY") + else if(*i == "TLS_VERIFY") { ++i; if(i != args.end()) { - verifySSL = cmSystemTools::IsOn(i->c_str()); - checkSSL = true; + verifyTLS = cmSystemTools::IsOn(i->c_str()); + checkTLS = true; } else { - this->SetError("SSL_VERIFY missing bool value."); + this->SetError("TLS_VERIFY missing bool value."); return false; } } - else if(*i == "SSL_CAINFO_FILE") + else if(*i == "TLS_CAINFO") { ++i; if(i != args.end()) @@ -2746,7 +2746,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) } else { - this->SetError("SSL_CAFILE missing file value."); + this->SetError("TLS_CAFILE missing file value."); return false; } } @@ -2865,14 +2865,14 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) cmFileCommandCurlDebugCallback); check_curl_result(res, "DOWNLOAD cannot set debug function: "); - // check to see if SSL verification is requested + // check to see if TLS verification is requested const char* verifyValue = - this->Makefile->GetDefinition("CMAKE_CURLOPT_SSL_VERIFYPEER"); - // if there is a cmake variable or if the command has SSL_VERIFY requested - if(verifyValue || checkSSL) + this->Makefile->GetDefinition("CMAKE_TLS_VERIFY"); + // if there is a cmake variable or if the command has TLS_VERIFY requested + if(verifyValue || checkTLS) { // the args to the command come first - bool verify = verifySSL; + bool verify = verifyTLS; if(!verify && verifyValue) { verify = cmSystemTools::IsOn(verifyValue); @@ -2880,17 +2880,17 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) if(verify) { res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1); - check_curl_result(res, "Unable to set SSL Verify on: "); + check_curl_result(res, "Unable to set TLS/SSL Verify on: "); } else { res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); - check_curl_result(res, "Unable to set SSL Verify off: "); + check_curl_result(res, "Unable to set TLS/SSL Verify off: "); } } // check to see if a CAINFO file has been specified const char* cainfo = - this->Makefile->GetDefinition("CMAKE_CURLOPT_CAINFO_FILE"); + this->Makefile->GetDefinition("CMAKE_TLS_CAINFO"); // command arg comes first if(caFile.size()) { @@ -2899,7 +2899,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) if(cainfo) { res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cainfo); - check_curl_result(res, "Unable to set SSL Verify CAINFO: "); + check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); } cmFileCommandVectorOfChar chunkDebug; diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h index 413e2f4e2..bd6f612f1 100644 --- a/Source/cmFileCommand.h +++ b/Source/cmFileCommand.h @@ -85,7 +85,7 @@ public: " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS]\n" " [EXPECTED_HASH MD5|SHA1|SHA224|SHA256|SHA384|SHA512 hash]\n" " [EXPECTED_MD5 sum]\n" - " [SSL_VERIFY on|off] [SSL_CAINFO_FILE file])\n" + " [TLS_VERIFY on|off] [TLS_CAINFO file])\n" " file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n" " [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n" "WRITE will write a message into a file called 'filename'. It " @@ -177,12 +177,12 @@ public: "If SHOW_PROGRESS is specified, progress information will be printed " "as status messages until the operation is complete. " "For https URLs CMake must be built with OpenSSL. " - "SSL certificates are not checked by default. " - "Set SSL_VERIFY to ON to check certificates and/or use " + "TLS/SSL certificates are not checked by default. " + "Set TLS_VERIFY to ON to check certificates and/or use " "EXPECTED_HASH to verify downloaded content. " - "Set SSL_CAINFO_FILE to specify a custom Certificate Authority file. " - "If either SSL option is not given CMake will check variables " - "CMAKE_CURLOPT_SSL_VERIFYPEER and CMAKE_CURLOPT_CAINFO_FILE, " + "Set TLS_CAINFO to specify a custom Certificate Authority file. " + "If either TLS option is not given CMake will check variables " + "CMAKE_TLS_VERIFY and CMAKE_TLS_CAINFO, " "respectively." "\n" "UPLOAD will upload the given file to the given URL. " From 875f3a4231766d9534304b3bb74a321c1bcd15d1 Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Sat, 15 Sep 2012 00:01:04 -0400 Subject: [PATCH 132/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a34cf6f0d..83a41d5f4 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 9) -set(CMake_VERSION_TWEAK 20120914) +set(CMake_VERSION_TWEAK 20120915) #set(CMake_VERSION_RC 1) From 4824633642bbaacf6c5b7b36e131e2463d7c2f68 Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Sun, 16 Sep 2012 00:01:03 -0400 Subject: [PATCH 133/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 83a41d5f4..a88a2d4a6 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 9) -set(CMake_VERSION_TWEAK 20120915) +set(CMake_VERSION_TWEAK 20120916) #set(CMake_VERSION_RC 1) From 70169ec1bfa5adc4bc99c1777f44c6f8446bba04 Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Mon, 17 Sep 2012 00:01:07 -0400 Subject: [PATCH 134/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index a88a2d4a6..4f372806f 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 9) -set(CMake_VERSION_TWEAK 20120916) +set(CMake_VERSION_TWEAK 20120917) #set(CMake_VERSION_RC 1) From 7369a8faee40574e7f87eeaa5e7718d0da407ffe Mon Sep 17 00:00:00 2001 From: Brad King <brad.king@kitware.com> Date: Fri, 14 Sep 2012 15:57:18 -0400 Subject: [PATCH 135/152] file(DOWNLOAD): Make TLS options behave as documented The logic added in commit e1c89f08 (file(DOWNLOAD): Add options for SSL, 2012-08-21) did not actually provide the documented behavior. Simplify the implementation to read the variable values first and then replace them with the explicit argument values if encountered. Always set the curl option CURLOPT_SSL_VERIFYPEER to either on or off explicitly instead of depending on the curl default behavior. --- Source/cmFileCommand.cxx | 46 ++++++++++++---------------------------- 1 file changed, 13 insertions(+), 33 deletions(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 1cb2ece6c..4d9eb7972 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -2667,9 +2667,8 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) long inactivity_timeout = 0; std::string verboseLog; std::string statusVar; - std::string caFile; - bool checkTLS = false; - bool verifyTLS = false; + bool tls_verify = this->Makefile->IsOn("CMAKE_TLS_VERIFY"); + const char* cainfo = this->Makefile->GetDefinition("CMAKE_TLS_CAINFO"); std::string expectedHash; std::string hashMatchMSG; cmsys::auto_ptr<cmCryptoHash> hash; @@ -2728,8 +2727,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) ++i; if(i != args.end()) { - verifyTLS = cmSystemTools::IsOn(i->c_str()); - checkTLS = true; + tls_verify = cmSystemTools::IsOn(i->c_str()); } else { @@ -2742,7 +2740,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) ++i; if(i != args.end()) { - caFile = *i; + cainfo = i->c_str(); } else { @@ -2866,37 +2864,19 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string> const& args) check_curl_result(res, "DOWNLOAD cannot set debug function: "); // check to see if TLS verification is requested - const char* verifyValue = - this->Makefile->GetDefinition("CMAKE_TLS_VERIFY"); - // if there is a cmake variable or if the command has TLS_VERIFY requested - if(verifyValue || checkTLS) + if(tls_verify) { - // the args to the command come first - bool verify = verifyTLS; - if(!verify && verifyValue) - { - verify = cmSystemTools::IsOn(verifyValue); - } - if(verify) - { - res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1); - check_curl_result(res, "Unable to set TLS/SSL Verify on: "); - } - else - { - res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); - check_curl_result(res, "Unable to set TLS/SSL Verify off: "); - } + res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 1); + check_curl_result(res, "Unable to set TLS/SSL Verify on: "); + } + else + { + res = ::curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0); + check_curl_result(res, "Unable to set TLS/SSL Verify off: "); } // check to see if a CAINFO file has been specified - const char* cainfo = - this->Makefile->GetDefinition("CMAKE_TLS_CAINFO"); // command arg comes first - if(caFile.size()) - { - cainfo = caFile.c_str(); - } - if(cainfo) + if(cainfo && *cainfo) { res = ::curl_easy_setopt(curl, CURLOPT_CAINFO, cainfo); check_curl_result(res, "Unable to set TLS/SSL Verify CAINFO: "); From adf705863c0ccfe0b688aa615c306836caa9687f Mon Sep 17 00:00:00 2001 From: Rolf Eike Beer <eike@sf-mail.de> Date: Sun, 9 Sep 2012 16:08:45 +0200 Subject: [PATCH 136/152] FindSDL: add SDLMAIN_LIBRARY only once (#13262) --- Modules/FindSDL.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Modules/FindSDL.cmake b/Modules/FindSDL.cmake index 487c5d346..adaec95a2 100644 --- a/Modules/FindSDL.cmake +++ b/Modules/FindSDL.cmake @@ -133,10 +133,12 @@ endif() if(SDL_LIBRARY_TEMP) # For SDLmain - if(NOT SDL_BUILDING_LIBRARY) - if(SDLMAIN_LIBRARY) - set(SDL_LIBRARY_TEMP ${SDLMAIN_LIBRARY} ${SDL_LIBRARY_TEMP}) + if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY) + list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX) + if(_SDL_MAIN_INDEX EQUAL -1) + list(APPEND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}") endif() + unset(_SDL_MAIN_INDEX) endif() # For OS X, SDL uses Cocoa as a backend so it must link to Cocoa. From 21f5fc12ee4ca043838264962fc7608a97b8f35f Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Tue, 18 Sep 2012 00:01:05 -0400 Subject: [PATCH 137/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 4f372806f..5bf171aac 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 9) -set(CMake_VERSION_TWEAK 20120917) +set(CMake_VERSION_TWEAK 20120918) #set(CMake_VERSION_RC 1) From f1eacf0e07759b57d100dbf5d83c70e4028bcb54 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Tue, 11 Sep 2012 19:53:38 +0200 Subject: [PATCH 138/152] cmGeneratorExpression: Re-write for multi-stage evaluation The expressions may be parsed and then cached and evaluated multiple times. They are evaluated lazily so that literals such as ',' can be treated as universal parameter separators, and can be processed from results without appearing literally, and without interfering with the parsing/evaluation of the entire expression. --- Source/CMakeLists.txt | 6 + Source/cmGeneratorExpression.cxx | 248 ++------ Source/cmGeneratorExpression.h | 21 +- Source/cmGeneratorExpressionEvaluator.cxx | 568 ++++++++++++++++++ Source/cmGeneratorExpressionEvaluator.h | 118 ++++ Source/cmGeneratorExpressionLexer.cxx | 85 +++ Source/cmGeneratorExpressionLexer.h | 58 ++ Source/cmGeneratorExpressionParser.cxx | 235 ++++++++ Source/cmGeneratorExpressionParser.h | 45 ++ .../GeneratorExpression/BadAND-stderr.txt | 31 +- .../RunCMake/GeneratorExpression/BadAND.cmake | 3 + .../GeneratorExpression/BadCONFIG-stderr.txt | 36 ++ .../GeneratorExpression/BadCONFIG.cmake | 4 + .../GeneratorExpression/BadNOT-stderr.txt | 32 +- .../RunCMake/GeneratorExpression/BadNOT.cmake | 3 + .../GeneratorExpression/BadOR-stderr.txt | 31 +- .../RunCMake/GeneratorExpression/BadOR.cmake | 3 + bootstrap | 3 + 18 files changed, 1325 insertions(+), 205 deletions(-) create mode 100644 Source/cmGeneratorExpressionEvaluator.cxx create mode 100644 Source/cmGeneratorExpressionEvaluator.h create mode 100644 Source/cmGeneratorExpressionLexer.cxx create mode 100644 Source/cmGeneratorExpressionLexer.h create mode 100644 Source/cmGeneratorExpressionParser.cxx create mode 100644 Source/cmGeneratorExpressionParser.h diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index e79689b08..ba71c8aeb 100644 --- a/Source/CMakeLists.txt +++ b/Source/CMakeLists.txt @@ -183,6 +183,12 @@ set(SRCS cmFileTimeComparison.cxx cmFileTimeComparison.h cmGeneratedFileStream.cxx + cmGeneratorExpressionEvaluator.cxx + cmGeneratorExpressionEvaluator.h + cmGeneratorExpressionLexer.cxx + cmGeneratorExpressionLexer.h + cmGeneratorExpressionParser.cxx + cmGeneratorExpressionParser.h cmGeneratorExpression.cxx cmGeneratorExpression.h cmGeneratorTarget.cxx diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 92bbf1d82..198b43a1f 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -16,18 +16,17 @@ #include <cmsys/String.h> +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionLexer.h" +#include "cmGeneratorExpressionParser.h" + //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( cmMakefile* mf, const char* config, cmListFileBacktrace const& backtrace, bool quiet): - Makefile(mf), Config(config), Backtrace(backtrace), Quiet(quiet) + Makefile(mf), Config(config), Backtrace(backtrace), Quiet(quiet), + NeedsParsing(true) { - this->TargetInfo.compile("^\\$<TARGET" - "(|_SONAME|_LINKER)" // File with what purpose? - "_FILE(|_NAME|_DIR):" // Filename component. - "([A-Za-z0-9_.-]+)" // Target name. - ">$"); - this->TestConfig.compile("^\\$<CONFIG:([A-Za-z0-9_]*)>$"); } //---------------------------------------------------------------------------- @@ -39,210 +38,77 @@ const char* cmGeneratorExpression::Process(std::string const& input) //---------------------------------------------------------------------------- const char* cmGeneratorExpression::Process(const char* input) { - this->Data.clear(); - - // We construct and evaluate expressions directly in the output - // buffer. Each expression is replaced by its own output value - // after evaluation. A stack of barriers records the starting - // indices of open (pending) expressions. - for(const char* c = input; *c; ++c) - { - if(c[0] == '$' && c[1] == '<') - { - this->Barriers.push(this->Data.size()); - this->Data.push_back('$'); - this->Data.push_back('<'); - c += 1; - } - else if(c[0] == '>' && !this->Barriers.empty()) - { - this->Data.push_back('>'); - if(!this->Evaluate()) { break; } - this->Barriers.pop(); - } - else - { - this->Data.push_back(c[0]); - } - } - - // Return a null-terminated output value. - this->Data.push_back('\0'); - return &*this->Data.begin(); + this->Parse(input); + return this->Evaluate(this->Makefile, this->Config, this->Quiet); } //---------------------------------------------------------------------------- -bool cmGeneratorExpression::Evaluate() +void cmGeneratorExpression::Parse(const char* input) { - // The top-most barrier points at the beginning of the expression. - size_t barrier = this->Barriers.top(); + this->Evaluators.clear(); - // Construct a null-terminated representation of the expression. - this->Data.push_back('\0'); - const char* expr = &*(this->Data.begin()+barrier); + this->Input = input; + cmGeneratorExpressionLexer l; + std::vector<cmGeneratorExpressionToken> tokens = l.Tokenize(this->Input); + this->NeedsParsing = l.GetSawGeneratorExpression(); - // Evaluate the expression. - std::string result; - if(this->Evaluate(expr, result)) + if (!this->NeedsParsing) { - // Success. Replace the expression with its evaluation result. - this->Data.erase(this->Data.begin()+barrier, this->Data.end()); - this->Data.insert(this->Data.end(), result.begin(), result.end()); - return true; + return; } - else if(!this->Quiet) - { - // Failure. Report the error message. - cmOStringStream e; - e << "Error evaluating generator expression:\n" - << " " << expr << "\n" - << result; - this->Makefile->GetCMakeInstance() - ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), - this->Backtrace); - return false; - } - return true; + + cmGeneratorExpressionParser p(tokens); + p.Parse(this->Evaluators); } //---------------------------------------------------------------------------- -static bool cmGeneratorExpressionBool(const char* c, std::string& result, - const char* name, - const char* a, const char* b) +const char *cmGeneratorExpression::Evaluate( + cmMakefile* mf, const char* config, bool quiet) { - result = a; - while((c[0] == '0' || c[0] == '1') && (c[1] == ',' || c[1] == '>')) + if (!this->NeedsParsing) { - if(c[0] == b[0]) { result = b; } - c += 2; + return this->Input; } - if(c[0]) + + this->Output = ""; + + std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it + = this->Evaluators.begin(); + const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end + = this->Evaluators.end(); + + cmGeneratorExpressionContext context; + context.Makefile = mf; + context.Config = config; + context.Quiet = quiet; + context.HadError = false; + context.Backtrace = this->Backtrace; + + for ( ; it != end; ++it) { - result = name; - result += " requires one or more comma-separated '0' or '1' values."; - return false; + this->Output += (*it)->Evaluate(&context); + if (context.HadError) + { + this->Output = ""; + break; + } } - return true; + + this->Targets = context.Targets; + // TODO: Return a std::string from here instead? + return this->Output.c_str(); } //---------------------------------------------------------------------------- -bool cmGeneratorExpression::Evaluate(const char* expr, std::string& result) +cmGeneratorExpression::~cmGeneratorExpression() { - if(this->TargetInfo.find(expr)) + std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it + = this->Evaluators.begin(); + const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end + = this->Evaluators.end(); + + for ( ; it != end; ++it) { - if(!this->EvaluateTargetInfo(result)) - { - return false; - } + delete *it; } - else if(strcmp(expr, "$<CONFIGURATION>") == 0) - { - result = this->Config? this->Config : ""; - } - else if(strncmp(expr, "$<0:",4) == 0) - { - result = ""; - } - else if(strncmp(expr, "$<1:",4) == 0) - { - result = std::string(expr+4, strlen(expr)-5); - } - else if(strncmp(expr, "$<NOT:",6) == 0) - { - const char* c = expr+6; - if((c[0] != '0' && c[0] != '1') || c[1] != '>' || c[2]) - { - result = "NOT requires exactly one '0' or '1' value."; - return false; - } - result = c[0] == '1'? "0" : "1"; - } - else if(strncmp(expr, "$<AND:",6) == 0) - { - return cmGeneratorExpressionBool(expr+6, result, "AND", "1", "0"); - } - else if(strncmp(expr, "$<OR:",5) == 0) - { - return cmGeneratorExpressionBool(expr+5, result, "OR", "0", "1"); - } - else if(this->TestConfig.find(expr)) - { - result = cmsysString_strcasecmp(this->TestConfig.match(1).c_str(), - this->Config? this->Config:"") == 0 - ? "1":"0"; - } - else - { - result = "Expression syntax not recognized."; - return false; - } - return true; -} - -//---------------------------------------------------------------------------- -bool cmGeneratorExpression::EvaluateTargetInfo(std::string& result) -{ - // Lookup the referenced target. - std::string name = this->TargetInfo.match(3); - cmTarget* target = this->Makefile->FindTargetToUse(name.c_str()); - if(!target) - { - result = "No target \"" + name + "\""; - return false; - } - if(target->GetType() >= cmTarget::UTILITY && - target->GetType() != cmTarget::UNKNOWN_LIBRARY) - { - result = "Target \"" + name + "\" is not an executable or library."; - return false; - } - this->Targets.insert(target); - - // Lookup the target file with the given purpose. - std::string purpose = this->TargetInfo.match(1); - if(purpose == "") - { - // The target implementation file (.so.1.2, .dll, .exe, .a). - result = target->GetFullPath(this->Config, false, true); - } - else if(purpose == "_LINKER") - { - // The file used to link to the target (.so, .lib, .a). - if(!target->IsLinkable()) - { - result = ("TARGET_LINKER_FILE is allowed only for libraries and " - "executables with ENABLE_EXPORTS."); - return false; - } - result = target->GetFullPath(this->Config, target->HasImportLibrary()); - } - else if(purpose == "_SONAME") - { - // The target soname file (.so.1). - if(target->IsDLLPlatform()) - { - result = "TARGET_SONAME_FILE is not allowed for DLL target platforms."; - return false; - } - if(target->GetType() != cmTarget::SHARED_LIBRARY) - { - result = "TARGET_SONAME_FILE is allowed only for SHARED libraries."; - return false; - } - result = target->GetDirectory(this->Config); - result += "/"; - result += target->GetSOName(this->Config); - } - - // Extract the requested portion of the full path. - std::string part = this->TargetInfo.match(2); - if(part == "_NAME") - { - result = cmSystemTools::GetFilenameName(result); - } - else if(part == "_DIR") - { - result = cmSystemTools::GetFilenamePath(result); - } - return true; } diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index a023eb0c9..00e6907ef 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -19,6 +19,8 @@ class cmTarget; class cmMakefile; class cmListFileBacktrace; +struct cmGeneratorExpressionEvaluator; + /** \class cmGeneratorExpression * \brief Evaluate generate-time query expression syntax. * @@ -36,24 +38,29 @@ public: cmListFileBacktrace const& backtrace, bool quiet = false); + ~cmGeneratorExpression(); + /** Evaluate generator expressions in a string. */ const char* Process(std::string const& input); const char* Process(const char* input); + void Parse(const char* input); + const char* Evaluate(cmMakefile* mf, const char* config, + bool quiet = false); + /** Get set of targets found during evaluations. */ std::set<cmTarget*> const& GetTargets() const { return this->Targets; } private: + std::vector<cmGeneratorExpressionEvaluator*> Evaluators; cmMakefile* Makefile; const char* Config; cmListFileBacktrace const& Backtrace; bool Quiet; - std::vector<char> Data; - std::stack<size_t> Barriers; - cmsys::RegularExpression TargetInfo; - cmsys::RegularExpression TestConfig; + std::set<cmTarget*> Targets; - bool Evaluate(); - bool Evaluate(const char* expr, std::string& result); - bool EvaluateTargetInfo(std::string& result); + const char* Input; + bool NeedsParsing; + + std::string Output; }; diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx new file mode 100644 index 000000000..acc844a39 --- /dev/null +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -0,0 +1,568 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly <steveire@gmail.com> + + 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 "cmMakefile.h" + +#include "cmGeneratorExpressionEvaluator.h" +#include "cmGeneratorExpressionParser.h" + +//---------------------------------------------------------------------------- +static void reportError(cmGeneratorExpressionContext *context, + const std::string &expr, const std::string &result) +{ + context->HadError = true; + if (context->Quiet) + { + return; + } + + cmOStringStream e; + e << "Error evaluating generator expression:\n" + << " " << expr << "\n" + << result; + context->Makefile->GetCMakeInstance() + ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(), + context->Backtrace); +} + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionNode +{ + virtual ~cmGeneratorExpressionNode() {} + + virtual bool GeneratesContent() const { return true; } + + virtual bool AcceptsSingleArbitraryContentParameter() const + { return false; } + + virtual int NumExpectedParameters() const { return 1; } + + virtual std::string Evaluate(const std::vector<std::string> ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content + ) const = 0; +}; + +//---------------------------------------------------------------------------- +static const struct ZeroNode : public cmGeneratorExpressionNode +{ + ZeroNode() {} + + virtual bool GeneratesContent() const { return false; } + + std::string Evaluate(const std::vector<std::string> &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *) const + { + // Unreachable + return std::string(); + } +} zeroNode; + +//---------------------------------------------------------------------------- +static const struct OneNode : public cmGeneratorExpressionNode +{ + OneNode() {} + + virtual bool AcceptsSingleArbitraryContentParameter() const { return true; } + + std::string Evaluate(const std::vector<std::string> &, + cmGeneratorExpressionContext *, + const GeneratorExpressionContent *) const + { + // Unreachable + return std::string(); + } +} oneNode; + +//---------------------------------------------------------------------------- +#define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \ +static const struct OP ## Node : public cmGeneratorExpressionNode \ +{ \ + OP ## Node () {} \ +/* We let -1 carry the meaning 'at least one' */ \ + virtual int NumExpectedParameters() const { return -1; } \ + \ + std::string Evaluate(const std::vector<std::string> ¶meters, \ + cmGeneratorExpressionContext *context, \ + const GeneratorExpressionContent *content) const \ + { \ + std::vector<std::string>::const_iterator it = parameters.begin(); \ + const std::vector<std::string>::const_iterator end = parameters.end(); \ + for ( ; it != end; ++it) \ + { \ + if (*it == #FAILURE_VALUE) \ + { \ + return #FAILURE_VALUE; \ + } \ + else if (*it != #SUCCESS_VALUE) \ + { \ + reportError(context, content->GetOriginalExpression(), \ + "Parameters to $<" #OP "> must resolve to either '0' or '1'."); \ + return std::string(); \ + } \ + } \ + return #SUCCESS_VALUE; \ + } \ +} OPNAME; + +BOOLEAN_OP_NODE(andNode, AND, 1, 0) +BOOLEAN_OP_NODE(orNode, OR, 0, 1) + +#undef BOOLEAN_OP_NODE + +//---------------------------------------------------------------------------- +static const struct NotNode : public cmGeneratorExpressionNode +{ + NotNode() {} + std::string Evaluate(const std::vector<std::string> ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) const + { + if (*parameters.begin() != "0" && *parameters.begin() != "1") + { + reportError(context, content->GetOriginalExpression(), + "$<NOT> parameter must resolve to exactly one '0' or '1' value."); + return std::string(); + } + return *parameters.begin() == "0" ? "1" : "0"; + } +} notNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationNode : public cmGeneratorExpressionNode +{ + ConfigurationNode() {} + virtual int NumExpectedParameters() const { return 0; } + + std::string Evaluate(const std::vector<std::string> &, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *) const + { + return context->Config ? context->Config : ""; + } +} configurationNode; + +//---------------------------------------------------------------------------- +static const struct ConfigurationTestNode : public cmGeneratorExpressionNode +{ + ConfigurationTestNode() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector<std::string> ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) const + { + if (!context->Config) + { + return std::string(); + } + + cmsys::RegularExpression configValidator; + configValidator.compile("^[A-Za-z0-9_]*$"); + if (!configValidator.find(parameters.begin()->c_str())) + { + reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + return *parameters.begin() == context->Config ? "1" : "0"; + } +} configurationTestNode; + +//---------------------------------------------------------------------------- +template<bool linker, bool soname> +struct TargetFilesystemArtifactResultCreator +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator<false, true> +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The target soname file (.so.1). + if(target->IsDLLPlatform()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is not allowed " + "for DLL target platforms."); + return std::string(); + } + if(target->GetType() != cmTarget::SHARED_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_SONAME_FILE is allowed only for " + "SHARED libraries."); + return std::string(); + } + std::string result = target->GetDirectory(context->Config); + result += "/"; + result += target->GetSOName(context->Config); + return result; + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator<true, false> +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) + { + // The file used to link to the target (.so, .lib, .a). + if(!target->IsLinkable()) + { + ::reportError(context, content->GetOriginalExpression(), + "TARGET_LINKER_FILE is allowed only for libraries and " + "executables with ENABLE_EXPORTS."); + return std::string(); + } + return target->GetFullPath(context->Config, + target->HasImportLibrary()); + } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultCreator<false, false> +{ + static std::string Create(cmTarget* target, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *) + { + return target->GetFullPath(context->Config, false, true); + } +}; + + +//---------------------------------------------------------------------------- +template<bool dirQual, bool nameQual> +struct TargetFilesystemArtifactResultGetter +{ + static std::string Get(const std::string &result); +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter<false, true> +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenameName(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter<true, false> +{ + static std::string Get(const std::string &result) + { return cmSystemTools::GetFilenamePath(result); } +}; + +//---------------------------------------------------------------------------- +template<> +struct TargetFilesystemArtifactResultGetter<false, false> +{ + static std::string Get(const std::string &result) + { return result; } +}; + +//---------------------------------------------------------------------------- +template<bool linker, bool soname, bool dirQual, bool nameQual> +struct TargetFilesystemArtifact : public cmGeneratorExpressionNode +{ + TargetFilesystemArtifact() {} + + virtual int NumExpectedParameters() const { return 1; } + + std::string Evaluate(const std::vector<std::string> ¶meters, + cmGeneratorExpressionContext *context, + const GeneratorExpressionContent *content) const + { + // Lookup the referenced target. + std::string name = *parameters.begin(); + + cmsys::RegularExpression targetValidator; + targetValidator.compile("^[A-Za-z0-9_]+$"); + if (!targetValidator.find(name.c_str())) + { + ::reportError(context, content->GetOriginalExpression(), + "Expression syntax not recognized."); + return std::string(); + } + cmTarget* target = context->Makefile->FindTargetToUse(name.c_str()); + if(!target) + { + ::reportError(context, content->GetOriginalExpression(), + "No target \"" + name + "\""); + return std::string(); + } + if(target->GetType() >= cmTarget::UTILITY && + target->GetType() != cmTarget::UNKNOWN_LIBRARY) + { + ::reportError(context, content->GetOriginalExpression(), + "Target \"" + name + "\" is not an executable or library."); + return std::string(); + } + context->Targets.insert(target); + + std::string result = + TargetFilesystemArtifactResultCreator<linker, soname>::Create( + target, + context, + content); + if (context->HadError) + { + return std::string(); + } + return + TargetFilesystemArtifactResultGetter<dirQual, nameQual>::Get(result); + } +}; + +//---------------------------------------------------------------------------- +static const +TargetFilesystemArtifact<false, false, false, false> targetFileNode; +static const +TargetFilesystemArtifact<true, false, false, false> targetLinkerFileNode; +static const +TargetFilesystemArtifact<false, true, false, false> targetSoNameFileNode; +static const +TargetFilesystemArtifact<false, false, false, true> targetFileNameNode; +static const +TargetFilesystemArtifact<true, false, false, true> targetLinkerFileNameNode; +static const +TargetFilesystemArtifact<false, true, false, true> targetSoNameFileNameNode; +static const +TargetFilesystemArtifact<false, false, true, false> targetFileDirNode; +static const +TargetFilesystemArtifact<true, false, true, false> targetLinkerFileDirNode; +static const +TargetFilesystemArtifact<false, true, true, false> targetSoNameFileDirNode; + +//---------------------------------------------------------------------------- +static const +cmGeneratorExpressionNode* GetNode(const std::string &identifier) +{ + if (identifier == "0") + return &zeroNode; + if (identifier == "1") + return &oneNode; + if (identifier == "AND") + return &andNode; + if (identifier == "OR") + return &orNode; + if (identifier == "NOT") + return ¬Node; + else if (identifier == "CONFIGURATION") + return &configurationNode; + else if (identifier == "CONFIG") + return &configurationTestNode; + else if (identifier == "TARGET_FILE") + return &targetFileNode; + else if (identifier == "TARGET_LINKER_FILE") + return &targetLinkerFileNode; + else if (identifier == "TARGET_SONAME_FILE") + return &targetSoNameFileNode; + else if (identifier == "TARGET_FILE_NAME") + return &targetFileNameNode; + else if (identifier == "TARGET_LINKER_FILE_NAME") + return &targetLinkerFileNameNode; + else if (identifier == "TARGET_SONAME_FILE_NAME") + return &targetSoNameFileNameNode; + else if (identifier == "TARGET_FILE_DIR") + return &targetFileDirNode; + else if (identifier == "TARGET_LINKER_FILE_DIR") + return &targetLinkerFileDirNode; + else if (identifier == "TARGET_SONAME_FILE_DIR") + return &targetSoNameFileDirNode; + return 0; +} + +//---------------------------------------------------------------------------- +GeneratorExpressionContent::GeneratorExpressionContent( + const char *startContent, + unsigned int length) + : StartContent(startContent), ContentLength(length) +{ + +} + +//---------------------------------------------------------------------------- +std::string GeneratorExpressionContent::GetOriginalExpression() const +{ + return std::string(this->StartContent, this->ContentLength); +} + +//---------------------------------------------------------------------------- +std::string GeneratorExpressionContent::Evaluate( + cmGeneratorExpressionContext *context) const +{ + std::string identifier; + { + std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it + = this->IdentifierChildren.begin(); + const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end + = this->IdentifierChildren.end(); + for ( ; it != end; ++it) + { + identifier += (*it)->Evaluate(context); + if (context->HadError) + { + return std::string(); + } + } + } + + const cmGeneratorExpressionNode *node = GetNode(identifier); + + if (!node) + { + reportError(context, this->GetOriginalExpression(), + "Expression did not evaluate to a known generator expression"); + return std::string(); + } + + if (!node->GeneratesContent()) + { + return std::string(); + } + + if (node->AcceptsSingleArbitraryContentParameter()) + { + std::string result; + std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator + pit = this->ParamChildren.begin(); + const + std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator + pend = this->ParamChildren.end(); + for ( ; pit != pend; ++pit) + { + if (!result.empty()) + { + result += ","; + } + + std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it + = pit->begin(); + const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end + = pit->end(); + for ( ; it != end; ++it) + { + result += (*it)->Evaluate(context); + if (context->HadError) + { + return std::string(); + } + } + } + return result; + } + + std::vector<std::string> parameters; + { + std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator + pit = this->ParamChildren.begin(); + const + std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator + pend = this->ParamChildren.end(); + for ( ; pit != pend; ++pit) + { + std::string parameter; + std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = + pit->begin(); + const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end = + pit->end(); + for ( ; it != end; ++it) + { + parameter += (*it)->Evaluate(context); + if (context->HadError) + { + return std::string(); + } + } + parameters.push_back(parameter); + } + } + + int numExpected = node->NumExpectedParameters(); + if ((numExpected != -1 && (unsigned int)numExpected != parameters.size())) + { + if (numExpected == 0) + { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + "> expression requires no parameters."); + } + else if (numExpected == 1) + { + reportError(context, this->GetOriginalExpression(), + "$<" + identifier + "> expression requires " + "exactly one parameter."); + } + else + { + cmOStringStream e; + e << "$<" + identifier + "> expression requires " + << numExpected + << " comma separated parameters, but got " + << parameters.size() << " instead."; + reportError(context, this->GetOriginalExpression(), e.str()); + } + return std::string(); + } + + if (numExpected == -1 && parameters.empty()) + { + reportError(context, this->GetOriginalExpression(), "$<" + identifier + + "> expression requires at least one parameter."); + return std::string(); + } + + return node->Evaluate(parameters, context, this); +} + +//---------------------------------------------------------------------------- +static void deleteAll(const std::vector<cmGeneratorExpressionEvaluator*> &c) +{ + std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it + = c.begin(); + const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end + = c.end(); + for ( ; it != end; ++it) + { + delete *it; + } +} + +//---------------------------------------------------------------------------- +GeneratorExpressionContent::~GeneratorExpressionContent() +{ + deleteAll(this->IdentifierChildren); + + typedef std::vector<cmGeneratorExpressionEvaluator*> EvaluatorVector; + typedef std::vector<cmGeneratorExpressionToken> TokenVector; + std::vector<EvaluatorVector>::const_iterator pit = + this->ParamChildren.begin(); + const std::vector<EvaluatorVector>::const_iterator pend = + this->ParamChildren.end(); + for ( ; pit != pend; ++pit) + { + deleteAll(*pit); + } +} diff --git a/Source/cmGeneratorExpressionEvaluator.h b/Source/cmGeneratorExpressionEvaluator.h new file mode 100644 index 000000000..5163ca002 --- /dev/null +++ b/Source/cmGeneratorExpressionEvaluator.h @@ -0,0 +1,118 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly <steveire@gmail.com> + + 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. +============================================================================*/ +#ifndef cmGeneratorExpressionEvaluator_h +#define cmGeneratorExpressionEvaluator_h + +#include <vector> +#include <string> + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionContext +{ + cmListFileBacktrace Backtrace; + std::set<cmTarget*> Targets; + cmMakefile *Makefile; + const char *Config; + cmTarget *Target; + bool Quiet; + bool HadError; +}; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionEvaluator +{ + cmGeneratorExpressionEvaluator() {} + virtual ~cmGeneratorExpressionEvaluator() {} + + enum Type + { + Text, + Generator + }; + + virtual Type GetType() const = 0; + + virtual std::string Evaluate(cmGeneratorExpressionContext *context + ) const = 0; + +private: + cmGeneratorExpressionEvaluator(const cmGeneratorExpressionEvaluator &); + void operator=(const cmGeneratorExpressionEvaluator &); +}; + +struct TextContent : public cmGeneratorExpressionEvaluator +{ + TextContent(const char *start, unsigned int length) + : Content(start), Length(length) + { + + } + + std::string Evaluate(cmGeneratorExpressionContext *) const + { + return std::string(this->Content, this->Length); + } + + Type GetType() const + { + return cmGeneratorExpressionEvaluator::Text; + } + + void Extend(unsigned int length) + { + this->Length += length; + } + + unsigned int GetLength() + { + return this->Length; + } + +private: + const char *Content; + unsigned int Length; +}; + +//---------------------------------------------------------------------------- +struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator +{ + GeneratorExpressionContent(const char *startContent, unsigned int length); + void SetIdentifier(std::vector<cmGeneratorExpressionEvaluator*> identifier) + { + this->IdentifierChildren = identifier; + } + + void SetParameters( + std::vector<std::vector<cmGeneratorExpressionEvaluator*> > parameters) + { + this->ParamChildren = parameters; + } + + Type GetType() const + { + return cmGeneratorExpressionEvaluator::Generator; + } + + std::string Evaluate(cmGeneratorExpressionContext *context) const; + + std::string GetOriginalExpression() const; + + ~GeneratorExpressionContent(); + +private: + std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren; + std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren; + const char *StartContent; + unsigned int ContentLength; +}; + +#endif diff --git a/Source/cmGeneratorExpressionLexer.cxx b/Source/cmGeneratorExpressionLexer.cxx new file mode 100644 index 000000000..cd71ec033 --- /dev/null +++ b/Source/cmGeneratorExpressionLexer.cxx @@ -0,0 +1,85 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly <steveire@gmail.com> + + 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 "cmGeneratorExpressionLexer.h" + + +//---------------------------------------------------------------------------- +cmGeneratorExpressionLexer::cmGeneratorExpressionLexer() + : SawBeginExpression(false), SawGeneratorExpression(false) +{ + +} + +//---------------------------------------------------------------------------- +static void InsertText(const char *upto, const char *c, + std::vector<cmGeneratorExpressionToken> &result) +{ + if (upto != c) + { + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::Text, upto, c - upto)); + } +} + +//---------------------------------------------------------------------------- +std::vector<cmGeneratorExpressionToken> +cmGeneratorExpressionLexer::Tokenize(const char *input) +{ + std::vector<cmGeneratorExpressionToken> result; + if (!input) + return result; + + const char *c = input; + const char *upto = c; + + for ( ; *c; ++c) + { + if(c[0] == '$' && c[1] == '<') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::BeginExpression, upto, 2)); + upto = c + 2; + ++c; + SawBeginExpression = true; + } + else if(c[0] == '>') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::EndExpression, upto, 1)); + upto = c + 1; + SawGeneratorExpression = SawBeginExpression; + } + else if(c[0] == ':') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::ColonSeparator, upto, 1)); + upto = c + 1; + } + else if(c[0] == ',') + { + InsertText(upto, c, result); + upto = c; + result.push_back(cmGeneratorExpressionToken( + cmGeneratorExpressionToken::CommaSeparator, upto, 1)); + upto = c + 1; + } + } + InsertText(upto, c, result); + + return result; +} diff --git a/Source/cmGeneratorExpressionLexer.h b/Source/cmGeneratorExpressionLexer.h new file mode 100644 index 000000000..5f16712fb --- /dev/null +++ b/Source/cmGeneratorExpressionLexer.h @@ -0,0 +1,58 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly <steveire@gmail.com> + + 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. +============================================================================*/ +#ifndef cmGeneratorExpressionLexer_h +#define cmGeneratorExpressionLexer_h + +#include "cmStandardIncludes.h" + +#include <vector> + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionToken +{ + cmGeneratorExpressionToken(unsigned type, const char *c, unsigned l) + : TokenType(type), Content(c), Length(l) + { + } + enum { + Text, + BeginExpression, + EndExpression, + ColonSeparator, + CommaSeparator + }; + unsigned TokenType; + const char *Content; + unsigned Length; +}; + +/** \class cmGeneratorExpressionLexer + * + */ +class cmGeneratorExpressionLexer +{ +public: + cmGeneratorExpressionLexer(); + + std::vector<cmGeneratorExpressionToken> Tokenize(const char *input); + + bool GetSawGeneratorExpression() const + { + return this->SawGeneratorExpression; + } + +private: + bool SawBeginExpression; + bool SawGeneratorExpression; +}; + +#endif diff --git a/Source/cmGeneratorExpressionParser.cxx b/Source/cmGeneratorExpressionParser.cxx new file mode 100644 index 000000000..2a5cc7aae --- /dev/null +++ b/Source/cmGeneratorExpressionParser.cxx @@ -0,0 +1,235 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly <steveire@gmail.com> + + 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 "cmGeneratorExpressionParser.h" + +#include "cmGeneratorExpressionEvaluator.h" + +//---------------------------------------------------------------------------- +cmGeneratorExpressionParser::cmGeneratorExpressionParser( + const std::vector<cmGeneratorExpressionToken> &tokens) + : Tokens(tokens), NestingLevel(0) +{ +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionParser::Parse( + std::vector<cmGeneratorExpressionEvaluator*> &result) +{ + it = this->Tokens.begin(); + + while (this->it != this->Tokens.end()) + { + this->ParseContent(result); + } +} + +//---------------------------------------------------------------------------- +static void extendText(std::vector<cmGeneratorExpressionEvaluator*> &result, + std::vector<cmGeneratorExpressionToken>::const_iterator it) +{ + if (result.size() > 0 + && (*(result.end() - 1))->GetType() + == cmGeneratorExpressionEvaluator::Text) + { + TextContent *textContent = static_cast<TextContent*>(*(result.end() - 1)); + textContent->Extend(it->Length); + } + else + { + TextContent *textContent = new TextContent(it->Content, it->Length); + result.push_back(textContent); + } +} + +//---------------------------------------------------------------------------- +static void extendResult(std::vector<cmGeneratorExpressionEvaluator*> &result, + const std::vector<cmGeneratorExpressionEvaluator*> &contents) +{ + if (result.size() > 0 + && (*(result.end() - 1))->GetType() + == cmGeneratorExpressionEvaluator::Text + && (*contents.begin())->GetType() + == cmGeneratorExpressionEvaluator::Text) + { + TextContent *textContent = static_cast<TextContent*>(*(result.end() - 1)); + textContent->Extend( + static_cast<TextContent*>(*contents.begin())->GetLength()); + delete *contents.begin(); + result.insert(result.end(), contents.begin() + 1, contents.end()); + } else { + result.insert(result.end(), contents.begin(), contents.end()); + } +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionParser::ParseGeneratorExpression( + std::vector<cmGeneratorExpressionEvaluator*> &result) +{ + unsigned int nestedLevel = this->NestingLevel; + ++this->NestingLevel; + + std::vector<cmGeneratorExpressionToken>::const_iterator startToken + = this->it - 1; + + std::vector<cmGeneratorExpressionEvaluator*> identifier; + while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression + && this->it->TokenType != cmGeneratorExpressionToken::ColonSeparator) + { + this->ParseContent(identifier); + if (this->it == this->Tokens.end()) + { + break; + } + } + if (identifier.empty()) + { + // ERROR + } + + if (this->it->TokenType == cmGeneratorExpressionToken::EndExpression) + { + GeneratorExpressionContent *content = new GeneratorExpressionContent( + startToken->Content, this->it->Content + - startToken->Content + + this->it->Length); + ++this->it; + --this->NestingLevel; + content->SetIdentifier(identifier); + result.push_back(content); + return; + } + + std::vector<std::vector<cmGeneratorExpressionEvaluator*> > parameters; + std::vector<std::vector<cmGeneratorExpressionToken>::const_iterator> + commaTokens; + std::vector<cmGeneratorExpressionToken>::const_iterator colonToken; + if (this->it->TokenType == cmGeneratorExpressionToken::ColonSeparator) + { + colonToken = this->it; + parameters.resize(parameters.size() + 1); + ++this->it; + while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression) + { + this->ParseContent(*(parameters.end() - 1)); + if (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator) + { + commaTokens.push_back(this->it); + parameters.resize(parameters.size() + 1); + ++this->it; + } + if (this->it == this->Tokens.end()) + { + break; + } + } + if(this->it->TokenType == cmGeneratorExpressionToken::EndExpression) + { + --this->NestingLevel; + ++this->it; + } + if (parameters.empty()) + { + // ERROR + } + } + + if (nestedLevel != this->NestingLevel) + { + // There was a '$<' in the text, but no corresponding '>'. Rebuild to + // treat the '$<' as having been plain text, along with the + // corresponding : and , tokens that might have been found. + extendText(result, startToken); + extendResult(result, identifier); + if (!parameters.empty()) + { + extendText(result, colonToken); + + typedef std::vector<cmGeneratorExpressionEvaluator*> EvaluatorVector; + typedef std::vector<cmGeneratorExpressionToken> TokenVector; + std::vector<EvaluatorVector>::const_iterator pit = parameters.begin(); + const std::vector<EvaluatorVector>::const_iterator pend = + parameters.end(); + std::vector<TokenVector::const_iterator>::const_iterator commaIt = + commaTokens.begin(); + for ( ; pit != pend; ++pit, ++commaIt) + { + extendResult(result, *pit); + if (commaIt != commaTokens.end()) + { + extendText(result, *commaIt); + } + } + } + return; + } + + int contentLength = ((this->it - 1)->Content + - startToken->Content) + + (this->it - 1)->Length; + GeneratorExpressionContent *content = new GeneratorExpressionContent( + startToken->Content, contentLength); + content->SetIdentifier(identifier); + content->SetParameters(parameters); + result.push_back(content); +} + +//---------------------------------------------------------------------------- +void cmGeneratorExpressionParser::ParseContent( + std::vector<cmGeneratorExpressionEvaluator*> &result) +{ + switch(this->it->TokenType) + { + case cmGeneratorExpressionToken::Text: + { + if (this->NestingLevel == 0) + { + if (result.size() > 0 + && (*(result.end() - 1))->GetType() + == cmGeneratorExpressionEvaluator::Text) + { + // A comma in 'plain text' could have split text that should + // otherwise be continuous. Extend the last text content instead of + // creating a new one. + TextContent *textContent = + static_cast<TextContent*>(*(result.end() - 1)); + textContent->Extend(this->it->Length); + ++this->it; + return; + } + } + cmGeneratorExpressionEvaluator* n = new TextContent(this->it->Content, + this->it->Length); + result.push_back(n); + ++this->it; + return ; + } + case cmGeneratorExpressionToken::BeginExpression: + ++this->it; + this->ParseGeneratorExpression(result); + return; + case cmGeneratorExpressionToken::EndExpression: + case cmGeneratorExpressionToken::ColonSeparator: + case cmGeneratorExpressionToken::CommaSeparator: + if (this->NestingLevel == 0) + { + extendText(result, this->it); + } + else + { + // TODO: Unreachable. Assert? + } + ++this->it; + return; + } + // Unreachable. Assert? +} diff --git a/Source/cmGeneratorExpressionParser.h b/Source/cmGeneratorExpressionParser.h new file mode 100644 index 000000000..28f14410f --- /dev/null +++ b/Source/cmGeneratorExpressionParser.h @@ -0,0 +1,45 @@ +/*============================================================================ + CMake - Cross Platform Makefile Generator + Copyright 2012 Stephen Kelly <steveire@gmail.com> + + 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. +============================================================================*/ +#ifndef cmGeneratorExpressionParser_h +#define cmGeneratorExpressionParser_h + +#include "cmGeneratorExpressionLexer.h" + +#include <set> +#include <vector> + +#include "cmListFileCache.h" + +class cmMakefile; +class cmTarget; +struct cmGeneratorExpressionEvaluator; + +//---------------------------------------------------------------------------- +struct cmGeneratorExpressionParser +{ + cmGeneratorExpressionParser( + const std::vector<cmGeneratorExpressionToken> &tokens); + + void Parse(std::vector<cmGeneratorExpressionEvaluator*> &result); + +private: + void ParseContent(std::vector<cmGeneratorExpressionEvaluator*> &); + void ParseGeneratorExpression( + std::vector<cmGeneratorExpressionEvaluator*> &); + +private: + std::vector<cmGeneratorExpressionToken>::const_iterator it; + const std::vector<cmGeneratorExpressionToken> Tokens; + unsigned int NestingLevel; +}; + +#endif diff --git a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt index ced21d806..36302db9b 100644 --- a/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadAND-stderr.txt @@ -1,9 +1,18 @@ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND> + + \$<AND> expression requires at least one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ CMake Error at BadAND.cmake:1 \(add_custom_target\): Error evaluating generator expression: \$<AND:> - AND requires one or more comma-separated '0' or '1' values. + Parameters to \$<AND> must resolve to either '0' or '1'. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + @@ -12,6 +21,24 @@ CMake Error at BadAND.cmake:1 \(add_custom_target\): \$<AND:,> - AND requires one or more comma-separated '0' or '1' values. + Parameters to \$<AND> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:01> + + Parameters to \$<AND> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadAND.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<AND:nothing> + + Parameters to \$<AND> must resolve to either '0' or '1'. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadAND.cmake b/Tests/RunCMake/GeneratorExpression/BadAND.cmake index 792654046..265e4149b 100644 --- a/Tests/RunCMake/GeneratorExpression/BadAND.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadAND.cmake @@ -1,4 +1,7 @@ add_custom_target(check ALL COMMAND check + $<AND> $<AND:> $<AND:,> + $<AND:01> + $<AND:nothing> VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt index 7c86b250f..1cfbf404e 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG-stderr.txt @@ -1,8 +1,44 @@ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG> + + \$<CONFIG> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): Error evaluating generator expression: \$<CONFIG:.> + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG:Foo,Bar> + + \$<CONFIG> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG:Foo-Bar> + + Expression syntax not recognized. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadCONFIG.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<CONFIG:Foo-Nested> + Expression syntax not recognized. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake index 0c13f8944..c27ea5f73 100644 --- a/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadCONFIG.cmake @@ -1,3 +1,7 @@ add_custom_target(check ALL COMMAND check + $<CONFIG> $<CONFIG:.> + $<CONFIG:Foo,Bar> + $<CONFIG:Foo-Bar> + $<$<CONFIG:Foo-Nested>:foo> VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt index 5721f5fe1..32169c537 100644 --- a/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadNOT-stderr.txt @@ -1,9 +1,17 @@ CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT> + + \$<NOT> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++CMake Error at BadNOT.cmake:1 \(add_custom_target\): Error evaluating generator expression: \$<NOT:> - NOT requires exactly one '0' or '1' value. + \$<NOT> parameter must resolve to exactly one '0' or '1' value. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + @@ -12,7 +20,7 @@ CMake Error at BadNOT.cmake:1 \(add_custom_target\): \$<NOT:,> - NOT requires exactly one '0' or '1' value. + \$<NOT> parameter must resolve to exactly one '0' or '1' value. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + @@ -21,6 +29,24 @@ CMake Error at BadNOT.cmake:1 \(add_custom_target\): \$<NOT:0,1> - NOT requires exactly one '0' or '1' value. + \$<NOT> expression requires exactly one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:01> + + \$<NOT> parameter must resolve to exactly one '0' or '1' value. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadNOT.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<NOT:nothing> + + \$<NOT> parameter must resolve to exactly one '0' or '1' value. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadNOT.cmake b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake index 452293b8d..c2dada3c2 100644 --- a/Tests/RunCMake/GeneratorExpression/BadNOT.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadNOT.cmake @@ -1,5 +1,8 @@ add_custom_target(check ALL COMMAND check + $<NOT> $<NOT:> $<NOT:,> $<NOT:0,1> + $<NOT:01> + $<NOT:nothing> VERBATIM) diff --git a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt index 72ef2dd3c..d4ccab74c 100644 --- a/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt +++ b/Tests/RunCMake/GeneratorExpression/BadOR-stderr.txt @@ -1,9 +1,18 @@ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR> + + \$<OR> expression requires at least one parameter. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ CMake Error at BadOR.cmake:1 \(add_custom_target\): Error evaluating generator expression: \$<OR:> - OR requires one or more comma-separated '0' or '1' values. + Parameters to \$<OR> must resolve to either '0' or '1'. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\) + @@ -12,6 +21,24 @@ CMake Error at BadOR.cmake:1 \(add_custom_target\): \$<OR:,> - OR requires one or more comma-separated '0' or '1' values. + Parameters to \$<OR> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:01> + + Parameters to \$<OR> must resolve to either '0' or '1'. +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) ++ +CMake Error at BadOR.cmake:1 \(add_custom_target\): + Error evaluating generator expression: + + \$<OR:nothing> + + Parameters to \$<OR> must resolve to either '0' or '1'. Call Stack \(most recent call first\): CMakeLists.txt:3 \(include\)$ diff --git a/Tests/RunCMake/GeneratorExpression/BadOR.cmake b/Tests/RunCMake/GeneratorExpression/BadOR.cmake index f16f56a3c..0813400d6 100644 --- a/Tests/RunCMake/GeneratorExpression/BadOR.cmake +++ b/Tests/RunCMake/GeneratorExpression/BadOR.cmake @@ -1,4 +1,7 @@ add_custom_target(check ALL COMMAND check + $<OR> $<OR:> $<OR:,> + $<OR:01> + $<OR:nothing> VERBATIM) diff --git a/bootstrap b/bootstrap index ec5745df3..23134d091 100755 --- a/bootstrap +++ b/bootstrap @@ -202,6 +202,9 @@ CMAKE_CXX_SOURCES="\ cmInstallDirectoryGenerator \ cmGeneratedFileStream \ cmGeneratorTarget \ + cmGeneratorExpressionEvaluator \ + cmGeneratorExpressionLexer \ + cmGeneratorExpressionParser \ cmGeneratorExpression \ cmGlobalGenerator \ cmLocalGenerator \ From 91011bd217726f73e362b10d77a6638977d6a781 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Wed, 12 Sep 2012 15:11:25 +0200 Subject: [PATCH 139/152] cmGeneratorExpression: Port users to two-stage processing Removing the Process() API and removing the parameters from the constructor will allow cmGeneratorExpressions to be cached and evaluated with multiple configs for example, such as when evaluating target properties. This requires the creation of a new compiled representation of cmGeneratorExpression. The cmListFileBacktrace remains in the constructor so that we can record where a particular generator expression appeared in the CMakeLists file. --- Source/cmCustomCommandGenerator.cxx | 7 ++-- Source/cmGeneratorExpression.cxx | 65 +++++++++++++++++------------ Source/cmGeneratorExpression.h | 54 +++++++++++++++--------- Source/cmTarget.cxx | 17 ++++++-- Source/cmTestGenerator.cxx | 8 ++-- 5 files changed, 95 insertions(+), 56 deletions(-) diff --git a/Source/cmCustomCommandGenerator.cxx b/Source/cmCustomCommandGenerator.cxx index a65012905..07df7d5e0 100644 --- a/Source/cmCustomCommandGenerator.cxx +++ b/Source/cmCustomCommandGenerator.cxx @@ -21,7 +21,7 @@ cmCustomCommandGenerator::cmCustomCommandGenerator( cmCustomCommand const& cc, const char* config, cmMakefile* mf): CC(cc), Config(config), Makefile(mf), LG(mf->GetLocalGenerator()), OldStyle(cc.GetEscapeOldStyle()), MakeVars(cc.GetEscapeAllowMakeVars()), - GE(new cmGeneratorExpression(mf, config, cc.GetBacktrace())) + GE(new cmGeneratorExpression(cc.GetBacktrace())) { } @@ -47,7 +47,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const { return target->GetLocation(this->Config); } - return this->GE->Process(argv0); + return this->GE->Parse(argv0).Evaluate(this->Makefile, this->Config); } //---------------------------------------------------------------------------- @@ -58,7 +58,8 @@ cmCustomCommandGenerator cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c]; for(unsigned int j=1;j < commandLine.size(); ++j) { - std::string arg = this->GE->Process(commandLine[j]); + std::string arg = this->GE->Parse(commandLine[j]).Evaluate(this->Makefile, + this->Config); cmd += " "; if(this->OldStyle) { diff --git a/Source/cmGeneratorExpression.cxx b/Source/cmGeneratorExpression.cxx index 198b43a1f..0885616ad 100644 --- a/Source/cmGeneratorExpression.cxx +++ b/Source/cmGeneratorExpression.cxx @@ -22,48 +22,50 @@ //---------------------------------------------------------------------------- cmGeneratorExpression::cmGeneratorExpression( - cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace, bool quiet): - Makefile(mf), Config(config), Backtrace(backtrace), Quiet(quiet), - NeedsParsing(true) + cmListFileBacktrace const& backtrace): + Backtrace(backtrace), CompiledExpression(0) { } //---------------------------------------------------------------------------- -const char* cmGeneratorExpression::Process(std::string const& input) +const cmCompiledGeneratorExpression & +cmGeneratorExpression::Parse(std::string const& input) { - return this->Process(input.c_str()); + return this->Parse(input.c_str()); } //---------------------------------------------------------------------------- -const char* cmGeneratorExpression::Process(const char* input) +const cmCompiledGeneratorExpression & +cmGeneratorExpression::Parse(const char* input) { - this->Parse(input); - return this->Evaluate(this->Makefile, this->Config, this->Quiet); -} - -//---------------------------------------------------------------------------- -void cmGeneratorExpression::Parse(const char* input) -{ - this->Evaluators.clear(); - - this->Input = input; cmGeneratorExpressionLexer l; - std::vector<cmGeneratorExpressionToken> tokens = l.Tokenize(this->Input); - this->NeedsParsing = l.GetSawGeneratorExpression(); + std::vector<cmGeneratorExpressionToken> tokens = l.Tokenize(input); + bool needsParsing = l.GetSawGeneratorExpression(); + std::vector<cmGeneratorExpressionEvaluator*> evaluators; - if (!this->NeedsParsing) + if (needsParsing) { - return; + cmGeneratorExpressionParser p(tokens); + p.Parse(evaluators); } - cmGeneratorExpressionParser p(tokens); - p.Parse(this->Evaluators); + delete this->CompiledExpression; + this->CompiledExpression = new cmCompiledGeneratorExpression( + this->Backtrace, + evaluators, + input, + needsParsing); + return *this->CompiledExpression; +} + +cmGeneratorExpression::~cmGeneratorExpression() +{ + delete this->CompiledExpression; } //---------------------------------------------------------------------------- -const char *cmGeneratorExpression::Evaluate( - cmMakefile* mf, const char* config, bool quiet) +const char *cmCompiledGeneratorExpression::Evaluate( + cmMakefile* mf, const char* config, bool quiet) const { if (!this->NeedsParsing) { @@ -99,8 +101,19 @@ const char *cmGeneratorExpression::Evaluate( return this->Output.c_str(); } +cmCompiledGeneratorExpression::cmCompiledGeneratorExpression( + cmListFileBacktrace const& backtrace, + const std::vector<cmGeneratorExpressionEvaluator*> &evaluators, + const char *input, bool needsParsing) + : Backtrace(backtrace), Evaluators(evaluators), Input(input), + NeedsParsing(needsParsing) +{ + +} + + //---------------------------------------------------------------------------- -cmGeneratorExpression::~cmGeneratorExpression() +cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression() { std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = this->Evaluators.begin(); diff --git a/Source/cmGeneratorExpression.h b/Source/cmGeneratorExpression.h index 00e6907ef..b8467c27c 100644 --- a/Source/cmGeneratorExpression.h +++ b/Source/cmGeneratorExpression.h @@ -21,6 +21,8 @@ class cmListFileBacktrace; struct cmGeneratorExpressionEvaluator; +class cmCompiledGeneratorExpression; + /** \class cmGeneratorExpression * \brief Evaluate generate-time query expression syntax. * @@ -33,34 +35,48 @@ struct cmGeneratorExpressionEvaluator; class cmGeneratorExpression { public: - /** Construct with an evaluation context and configuration. */ - cmGeneratorExpression(cmMakefile* mf, const char* config, - cmListFileBacktrace const& backtrace, - bool quiet = false); - + /** Construct. */ + cmGeneratorExpression(cmListFileBacktrace const& backtrace); ~cmGeneratorExpression(); - /** Evaluate generator expressions in a string. */ - const char* Process(std::string const& input); - const char* Process(const char* input); + const cmCompiledGeneratorExpression& Parse(std::string const& input); + const cmCompiledGeneratorExpression& Parse(const char* input); - void Parse(const char* input); +private: + cmGeneratorExpression(const cmGeneratorExpression &); + void operator=(const cmGeneratorExpression &); + + cmListFileBacktrace const& Backtrace; + cmCompiledGeneratorExpression *CompiledExpression; +}; + +class cmCompiledGeneratorExpression +{ +public: const char* Evaluate(cmMakefile* mf, const char* config, - bool quiet = false); + bool quiet = false) const; /** Get set of targets found during evaluations. */ std::set<cmTarget*> const& GetTargets() const { return this->Targets; } + + ~cmCompiledGeneratorExpression(); + private: - std::vector<cmGeneratorExpressionEvaluator*> Evaluators; - cmMakefile* Makefile; - const char* Config; + cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace, + const std::vector<cmGeneratorExpressionEvaluator*> &evaluators, + const char *input, bool needsParsing); + + friend class cmGeneratorExpression; + + cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &); + void operator=(const cmCompiledGeneratorExpression &); + cmListFileBacktrace const& Backtrace; - bool Quiet; + const std::vector<cmGeneratorExpressionEvaluator*> Evaluators; + const char* const Input; + const bool NeedsParsing; - std::set<cmTarget*> Targets; - const char* Input; - bool NeedsParsing; - - std::string Output; + mutable std::set<cmTarget*> Targets; + mutable std::string Output; }; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 789713fcc..9a3812c2e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -1623,7 +1623,11 @@ cmTargetTraceDependencies { // Transform command names that reference targets built in this // project to corresponding target-level dependencies. - cmGeneratorExpression ge(this->Makefile, 0, cc.GetBacktrace(), true); + cmGeneratorExpression ge(cc.GetBacktrace()); + + // Add target-level dependencies referenced by generator expressions. + std::set<cmTarget*> targets; + for(cmCustomCommandLines::const_iterator cit = cc.GetCommandLines().begin(); cit != cc.GetCommandLines().end(); ++cit) { @@ -1645,12 +1649,17 @@ cmTargetTraceDependencies for(cmCustomCommandLine::const_iterator cli = cit->begin(); cli != cit->end(); ++cli) { - ge.Process(*cli); + const cmCompiledGeneratorExpression &cge = ge.Parse(*cli); + cge.Evaluate(this->Makefile, 0, true); + std::set<cmTarget*> geTargets = cge.GetTargets(); + for(std::set<cmTarget*>::const_iterator it = geTargets.begin(); + it != geTargets.end(); ++it) + { + targets.insert(*it); + } } } - // Add target-level dependencies referenced by generator expressions. - std::set<cmTarget*> targets = ge.GetTargets(); for(std::set<cmTarget*>::iterator ti = targets.begin(); ti != targets.end(); ++ti) { diff --git a/Source/cmTestGenerator.cxx b/Source/cmTestGenerator.cxx index e0892b282..2f650e72e 100644 --- a/Source/cmTestGenerator.cxx +++ b/Source/cmTestGenerator.cxx @@ -91,8 +91,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, this->TestGenerated = true; // Set up generator expression evaluation context. - cmMakefile* mf = this->Test->GetMakefile(); - cmGeneratorExpression ge(mf, config, this->Test->GetBacktrace()); + cmGeneratorExpression ge(this->Test->GetBacktrace()); // Start the test command. os << indent << "ADD_TEST(" << this->Test->GetName() << " "; @@ -103,6 +102,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, // Check whether the command executable is a target whose name is to // be translated. std::string exe = command[0]; + cmMakefile* mf = this->Test->GetMakefile(); cmTarget* target = mf->FindTargetToUse(exe.c_str()); if(target && target->GetType() == cmTarget::EXECUTABLE) { @@ -112,7 +112,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, else { // Use the command name given. - exe = ge.Process(exe.c_str()); + exe = ge.Parse(exe.c_str()).Evaluate(mf, config); cmSystemTools::ConvertToUnixSlashes(exe); } @@ -122,7 +122,7 @@ void cmTestGenerator::GenerateScriptForConfig(std::ostream& os, for(std::vector<std::string>::const_iterator ci = command.begin()+1; ci != command.end(); ++ci) { - os << " " << lg->EscapeForCMake(ge.Process(*ci)); + os << " " << lg->EscapeForCMake(ge.Parse(*ci).Evaluate(mf, config)); } // Finish the test command. From 281654b5d6e93f6e91bbf0e7091f8ffea40f79d5 Mon Sep 17 00:00:00 2001 From: Kitware Robot <kwrobot@kitware.com> Date: Wed, 19 Sep 2012 00:01:03 -0400 Subject: [PATCH 140/152] CMake Nightly Date Stamp --- Source/CMakeVersion.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index 5bf171aac..7b6af1e0d 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 9) -set(CMake_VERSION_TWEAK 20120918) +set(CMake_VERSION_TWEAK 20120919) #set(CMake_VERSION_RC 1) From f428ca25f5f983cb57eb009a330c09506ee81587 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Mon, 17 Sep 2012 12:02:24 +0200 Subject: [PATCH 141/152] Add more forwarding API to cmGeneratorTarget. This API is the most commonly required in the following patches. --- Source/cmGeneratorTarget.cxx | 30 ++++++++++++++++++++++++++++++ Source/cmGeneratorTarget.h | 6 ++++++ 2 files changed, 36 insertions(+) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 6e2e23da5..e0272fb21 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -27,6 +27,36 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) this->LookupObjectLibraries(); } +//---------------------------------------------------------------------------- +int cmGeneratorTarget::GetType() const +{ + return this->Target->GetType(); +} + +//---------------------------------------------------------------------------- +const char *cmGeneratorTarget::GetName() const +{ + return this->Target->GetName(); +} + +//---------------------------------------------------------------------------- +const char *cmGeneratorTarget::GetProperty(const char *prop) +{ + return this->Target->GetProperty(prop); +} + +//---------------------------------------------------------------------------- +bool cmGeneratorTarget::GetPropertyAsBool(const char *prop) +{ + return this->Target->GetPropertyAsBool(prop); +} + +//---------------------------------------------------------------------------- +std::vector<cmSourceFile*> const& cmGeneratorTarget::GetSourceFiles() +{ + return this->Target->GetSourceFiles(); +} + //---------------------------------------------------------------------------- void cmGeneratorTarget::ClassifySources() { diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 5c7578d94..bf0ab84bf 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -26,6 +26,12 @@ class cmGeneratorTarget public: cmGeneratorTarget(cmTarget*); + int GetType() const; + const char *GetName() const; + const char *GetProperty(const char *prop); + bool GetPropertyAsBool(const char *prop); + std::vector<cmSourceFile*> const& GetSourceFiles(); + cmTarget* Target; cmMakefile* Makefile; cmLocalGenerator* LocalGenerator; From 14bf7783f4de829f62041d1dbf3989160820b2b7 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Thu, 13 Sep 2012 00:03:23 +0200 Subject: [PATCH 142/152] Store cmGeneratorTargets with the makefile. --- Source/cmGeneratorTarget.h | 2 ++ Source/cmGlobalGenerator.cxx | 12 ++++++++---- Source/cmGlobalGenerator.h | 4 ++-- Source/cmMakefile.h | 12 ++++++++++++ 4 files changed, 24 insertions(+), 6 deletions(-) diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index bf0ab84bf..c19ef7d7d 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -66,4 +66,6 @@ private: void operator=(cmGeneratorTarget const&); }; +typedef std::map<cmTarget*, cmGeneratorTarget*> cmGeneratorTargetsType; + #endif diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 578fa9ec9..0b0679075 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1075,8 +1075,10 @@ void cmGlobalGenerator::CreateGeneratorTargets() // Construct per-target generator information. for(unsigned int i=0; i < this->LocalGenerators.size(); ++i) { - cmTargets& targets = - this->LocalGenerators[i]->GetMakefile()->GetTargets(); + cmGeneratorTargetsType generatorTargets; + + cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); + cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { @@ -1084,14 +1086,16 @@ void cmGlobalGenerator::CreateGeneratorTargets() cmGeneratorTarget* gt = new cmGeneratorTarget(t); this->GeneratorTargets[t] = gt; this->ComputeTargetObjects(gt); + generatorTargets[t] = gt; } + mf->SetGeneratorTargets(generatorTargets); } } //---------------------------------------------------------------------------- void cmGlobalGenerator::ClearGeneratorTargets() { - for(GeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); + for(cmGeneratorTargetsType::iterator i = this->GeneratorTargets.begin(); i != this->GeneratorTargets.end(); ++i) { delete i->second; @@ -1102,7 +1106,7 @@ void cmGlobalGenerator::ClearGeneratorTargets() //---------------------------------------------------------------------------- cmGeneratorTarget* cmGlobalGenerator::GetGeneratorTarget(cmTarget* t) const { - GeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); + cmGeneratorTargetsType::const_iterator ti = this->GeneratorTargets.find(t); if(ti == this->GeneratorTargets.end()) { this->CMakeInstance->IssueMessage( diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index ce9179379..2f4ebc35a 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -18,6 +18,7 @@ #include "cmTarget.h" // For cmTargets #include "cmTargetDepend.h" // For cmTargetDependSet #include "cmSystemTools.h" // for cmSystemTools::OutputOption +#include "cmGeneratorTarget.h" class cmake; class cmGeneratorTarget; class cmMakefile; @@ -383,8 +384,7 @@ private: TargetDependMap TargetDependencies; // Per-target generator information. - typedef std::map<cmTarget*, cmGeneratorTarget*> GeneratorTargetsType; - GeneratorTargetsType GeneratorTargets; + cmGeneratorTargetsType GeneratorTargets; void CreateGeneratorTargets(); void ClearGeneratorTargets(); virtual void ComputeTargetObjects(cmGeneratorTarget* gt) const; diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 74c8039b3..4e79cea41 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -20,6 +20,7 @@ #include "cmSystemTools.h" #include "cmTarget.h" #include "cmNewLineStyle.h" +#include "cmGeneratorTarget.h" #include "cmake.h" #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -519,6 +520,16 @@ public: */ const cmTargets &GetTargets() const { return this->Targets; } + const cmGeneratorTargetsType &GetGeneratorTargets() const + { + return this->GeneratorTargets; + } + + void SetGeneratorTargets(const cmGeneratorTargetsType &targets) + { + this->GeneratorTargets = targets; + } + cmTarget* FindTarget(const char* name); /** Find a target to use in place of the given name. The target @@ -865,6 +876,7 @@ protected: // libraries, classes, and executables cmTargets Targets; + cmGeneratorTargetsType GeneratorTargets; std::vector<cmSourceFile*> SourceFiles; // Tests From 987e12e2f962b6e9ed9f15f8ff486512911b744e Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Fri, 14 Sep 2012 19:04:25 +0200 Subject: [PATCH 143/152] Move GenerateTargetManifest to cmGeneratorTarget. --- Source/cmGeneratorTarget.cxx | 72 ++++++++++++++++++++++++++++++++++++ Source/cmGeneratorTarget.h | 3 ++ Source/cmLocalGenerator.cxx | 7 ++-- Source/cmTarget.cxx | 70 ----------------------------------- Source/cmTarget.h | 3 -- 5 files changed, 79 insertions(+), 76 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e0272fb21..d77e47b12 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -205,3 +205,75 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs) } } } + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GenerateTargetManifest(const char* config) +{ + cmMakefile* mf = this->Target->GetMakefile(); + cmLocalGenerator* lg = mf->GetLocalGenerator(); + cmGlobalGenerator* gg = lg->GetGlobalGenerator(); + + // Get the names. + std::string name; + std::string soName; + std::string realName; + std::string impName; + std::string pdbName; + if(this->GetType() == cmTarget::EXECUTABLE) + { + this->Target->GetExecutableNames(name, realName, impName, pdbName, + config); + } + else if(this->GetType() == cmTarget::STATIC_LIBRARY || + this->GetType() == cmTarget::SHARED_LIBRARY || + this->GetType() == cmTarget::MODULE_LIBRARY) + { + this->Target->GetLibraryNames(name, soName, realName, impName, pdbName, + config); + } + else + { + return; + } + + // Get the directory. + std::string dir = this->Target->GetDirectory(config, false); + + // Add each name. + std::string f; + if(!name.empty()) + { + f = dir; + f += "/"; + f += name; + gg->AddToManifest(config? config:"", f); + } + if(!soName.empty()) + { + f = dir; + f += "/"; + f += soName; + gg->AddToManifest(config? config:"", f); + } + if(!realName.empty()) + { + f = dir; + f += "/"; + f += realName; + gg->AddToManifest(config? config:"", f); + } + if(!pdbName.empty()) + { + f = dir; + f += "/"; + f += pdbName; + gg->AddToManifest(config? config:"", f); + } + if(!impName.empty()) + { + f = this->Target->GetDirectory(config, true); + f += "/"; + f += impName; + gg->AddToManifest(config? config:"", f); + } +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index c19ef7d7d..12aa97139 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -58,6 +58,9 @@ public: void UseObjectLibraries(std::vector<std::string>& objs); + /** Add the target output files to the global generator manifest. */ + void GenerateTargetManifest(const char* config); + private: void ClassifySources(); void LookupObjectLibraries(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index cf2af0a4f..62395575a 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -533,10 +533,11 @@ void cmLocalGenerator::GenerateTargetManifest() this->Makefile->GetConfigurations(configNames); // Add our targets to the manifest for each configuration. - cmTargets& targets = this->Makefile->GetTargets(); - for(cmTargets::iterator t = targets.begin(); t != targets.end(); ++t) + cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets(); + for(cmGeneratorTargetsType::iterator t = targets.begin(); + t != targets.end(); ++t) { - cmTarget& target = t->second; + cmGeneratorTarget& target = *t->second; if(configNames.empty()) { target.GenerateTargetManifest(0); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 9a3812c2e..d95b1ef2e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3514,76 +3514,6 @@ bool cmTarget::GetImplibGNUtoMS(std::string const& gnuName, return false; } -//---------------------------------------------------------------------------- -void cmTarget::GenerateTargetManifest(const char* config) -{ - cmMakefile* mf = this->Makefile; - cmLocalGenerator* lg = mf->GetLocalGenerator(); - cmGlobalGenerator* gg = lg->GetGlobalGenerator(); - - // Get the names. - std::string name; - std::string soName; - std::string realName; - std::string impName; - std::string pdbName; - if(this->GetType() == cmTarget::EXECUTABLE) - { - this->GetExecutableNames(name, realName, impName, pdbName, config); - } - else if(this->GetType() == cmTarget::STATIC_LIBRARY || - this->GetType() == cmTarget::SHARED_LIBRARY || - this->GetType() == cmTarget::MODULE_LIBRARY) - { - this->GetLibraryNames(name, soName, realName, impName, pdbName, config); - } - else - { - return; - } - - // Get the directory. - std::string dir = this->GetDirectory(config, false); - - // Add each name. - std::string f; - if(!name.empty()) - { - f = dir; - f += "/"; - f += name; - gg->AddToManifest(config? config:"", f); - } - if(!soName.empty()) - { - f = dir; - f += "/"; - f += soName; - gg->AddToManifest(config? config:"", f); - } - if(!realName.empty()) - { - f = dir; - f += "/"; - f += realName; - gg->AddToManifest(config? config:"", f); - } - if(!pdbName.empty()) - { - f = dir; - f += "/"; - f += pdbName; - gg->AddToManifest(config? config:"", f); - } - if(!impName.empty()) - { - f = this->GetDirectory(config, true); - f += "/"; - f += impName; - gg->AddToManifest(config? config:"", f); - } -} - //---------------------------------------------------------------------------- void cmTarget::SetPropertyDefault(const char* property, const char* default_value) diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 98eaeec76..e9fceb368 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -381,9 +381,6 @@ public: bool GetImplibGNUtoMS(std::string const& gnuName, std::string& out, const char* newExt = 0); - /** Add the target output files to the global generator manifest. */ - void GenerateTargetManifest(const char* config); - /** * Compute whether this target must be relinked before installing. */ From 4f5384e75c6a00d110d3fa3f555a3f6a4f31bb46 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Sat, 15 Sep 2012 23:54:01 +0200 Subject: [PATCH 144/152] Move GetLinkInformation to cmGeneratorTarget --- Source/cmGeneratorTarget.cxx | 38 ++++++++++++++++ Source/cmGeneratorTarget.h | 6 +++ Source/cmGlobalXCodeGenerator.cxx | 3 +- Source/cmInstallTargetGenerator.cxx | 30 +++++++++++-- Source/cmInstallTargetGenerator.h | 5 +++ Source/cmLocalGenerator.cxx | 5 ++- Source/cmLocalVisualStudio6Generator.cxx | 4 +- Source/cmLocalVisualStudio7Generator.cxx | 8 +++- Source/cmMakefileTargetGenerator.cxx | 6 ++- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmTarget.cxx | 50 ---------------------- Source/cmTarget.h | 14 ------ Source/cmVisualStudio10TargetGenerator.cxx | 2 +- 13 files changed, 95 insertions(+), 78 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index d77e47b12..e53f35e39 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -14,9 +14,12 @@ #include "cmTarget.h" #include "cmMakefile.h" #include "cmLocalGenerator.h" +#include "cmComputeLinkInformation.h" #include "cmGlobalGenerator.h" #include "cmSourceFile.h" +#include <assert.h> + //---------------------------------------------------------------------------- cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) { @@ -27,6 +30,15 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t) this->LookupObjectLibraries(); } +cmGeneratorTarget::~cmGeneratorTarget() +{ + for(std::map<cmStdString, cmComputeLinkInformation*>::iterator i + = LinkInformation.begin(); i != LinkInformation.end(); ++i) + { + delete i->second; + } +} + //---------------------------------------------------------------------------- int cmGeneratorTarget::GetType() const { @@ -277,3 +289,29 @@ void cmGeneratorTarget::GenerateTargetManifest(const char* config) gg->AddToManifest(config? config:"", f); } } + +//---------------------------------------------------------------------------- +cmComputeLinkInformation* +cmGeneratorTarget::GetLinkInformation(const char* config) +{ + // Lookup any existing information for this configuration. + std::map<cmStdString, cmComputeLinkInformation*>::iterator + i = this->LinkInformation.find(config?config:""); + if(i == this->LinkInformation.end()) + { + // Compute information for this configuration. + cmComputeLinkInformation* info = + new cmComputeLinkInformation(this->Target, config); + if(!info || !info->Compute()) + { + delete info; + info = 0; + } + + // Store the information for this configuration. + std::map<cmStdString, cmComputeLinkInformation*>::value_type + entry(config?config:"", info); + i = this->LinkInformation.insert(entry).first; + } + return i->second; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 12aa97139..fefdfb1a5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -14,6 +14,7 @@ #include "cmStandardIncludes.h" +class cmComputeLinkInformation; class cmCustomCommand; class cmGlobalGenerator; class cmLocalGenerator; @@ -25,6 +26,7 @@ class cmGeneratorTarget { public: cmGeneratorTarget(cmTarget*); + ~cmGeneratorTarget(); int GetType() const; const char *GetName() const; @@ -61,6 +63,10 @@ public: /** Add the target output files to the global generator manifest. */ void GenerateTargetManifest(const char* config); + std::map<cmStdString, cmComputeLinkInformation*> LinkInformation; + + cmComputeLinkInformation* GetLinkInformation(const char* config); + private: void ClassifySources(); void LookupObjectLibraries(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index e8ab38fe1..5ac9070cf 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -2625,7 +2625,8 @@ void cmGlobalXCodeGenerator } // Compute the link library and directory information. - cmComputeLinkInformation* pcli = cmtarget->GetLinkInformation(configName); + cmGeneratorTarget* gtgt = this->GetGeneratorTarget(cmtarget); + cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(configName); if(!pcli) { continue; diff --git a/Source/cmInstallTargetGenerator.cxx b/Source/cmInstallTargetGenerator.cxx index 5f9b6585e..347ad3ec5 100644 --- a/Source/cmInstallTargetGenerator.cxx +++ b/Source/cmInstallTargetGenerator.cxx @@ -16,6 +16,7 @@ #include "cmLocalGenerator.h" #include "cmMakefile.h" #include "cmake.h" +#include "cmGeneratorTarget.h" #include <assert.h> @@ -26,7 +27,8 @@ cmInstallTargetGenerator std::vector<std::string> const& configurations, const char* component, bool optional): cmInstallGenerator(dest, configurations, component), Target(&t), - ImportLibrary(implib), FilePermissions(file_permissions), Optional(optional) + ImportLibrary(implib), FilePermissions(file_permissions), + Optional(optional), GeneratorTarget(0) { this->ActionsPerConfig = true; this->NamelinkMode = NamelinkModeNone; @@ -484,6 +486,17 @@ void cmInstallTargetGenerator::PostReplacementTweaks(std::ostream& os, this->AddStripRule(os, indent, file); } +void cmInstallTargetGenerator::CreateGeneratorTarget() +{ + if (!this->GeneratorTarget) + { + this->GeneratorTarget = this->Target->GetMakefile() + ->GetLocalGenerator() + ->GetGlobalGenerator() + ->GetGeneratorTarget(this->Target); + } +} + //---------------------------------------------------------------------------- void cmInstallTargetGenerator @@ -507,10 +520,13 @@ cmInstallTargetGenerator return; } + this->CreateGeneratorTarget(); + // Build a map of build-tree install_name to install-tree install_name for // shared libraries linked to this target. std::map<cmStdString, cmStdString> install_name_remap; - if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config)) + if(cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(config)) { std::set<cmTarget*> const& sharedLibs = cli->GetSharedLibrariesLinked(); for(std::set<cmTarget*>::const_iterator j = sharedLibs.begin(); @@ -608,9 +624,12 @@ cmInstallTargetGenerator return; } + this->CreateGeneratorTarget(); + // Get the link information for this target. // It can provide the RPATH. - cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config); + cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(config); if(!cli) { return; @@ -639,9 +658,12 @@ cmInstallTargetGenerator return; } + this->CreateGeneratorTarget(); + // Get the link information for this target. // It can provide the RPATH. - cmComputeLinkInformation* cli = this->Target->GetLinkInformation(config); + cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(config); if(!cli) { return; diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 5d158b8d0..5d5011b15 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -15,6 +15,8 @@ #include "cmInstallGenerator.h" #include "cmTarget.h" +class cmGeneratorTarget; + /** \class cmInstallTargetGenerator * \brief Generate target installation rules. */ @@ -92,7 +94,10 @@ protected: void AddRanlibRule(std::ostream& os, Indent const& indent, const std::string& toDestDirPath); + void CreateGeneratorTarget(); + cmTarget* Target; + cmGeneratorTarget* GeneratorTarget; bool ImportLibrary; std::string FilePermissions; bool Optional; diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 62395575a..24d9b91d7 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1656,7 +1656,8 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, bool relink) { const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); - cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config); + cmGeneratorTarget* gtgt = this->GlobalGenerator->GetGeneratorTarget(&tgt); + cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(config); if(!pcli) { return; @@ -1677,7 +1678,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_"; linkFlagsVar += linkLanguage; linkFlagsVar += "_FLAGS"; - if( tgt.GetType() == cmTarget::EXECUTABLE ) + if( gtgt->GetType() == cmTarget::EXECUTABLE ) { linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar.c_str()); linkLibs += " "; diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 9f2a8635e..9a9c5bbc0 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1776,8 +1776,10 @@ void cmLocalVisualStudio6Generator const std::string extraOptions, std::string& options) { + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); // Compute the link information for this configuration. - cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); + cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); if(!pcli) { return; diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 2dfca025c..a09ab95e4 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -1079,7 +1079,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, targetNameImport, targetNamePDB, configName); // Compute the link library and directory information. - cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); if(!pcli) { return; @@ -1164,7 +1166,9 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout, targetNameImport, targetNamePDB, configName); // Compute the link library and directory information. - cmComputeLinkInformation* pcli = target.GetLinkInformation(configName); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + cmComputeLinkInformation* pcli = gt->GetLinkInformation(configName); if(!pcli) { return; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 95738c473..c818b7ef1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1022,7 +1022,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() << "SET(CMAKE_TARGET_LINKED_INFO_FILES\n"; std::set<cmTarget const*> emitted; const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); - if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) + if(cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(cfg)) { cmComputeLinkInformation::ItemVector const& items = cli->GetItems(); for(cmComputeLinkInformation::ItemVector::const_iterator @@ -1590,7 +1591,8 @@ void cmMakefileTargetGenerator // Loop over all library dependencies. const char* cfg = this->LocalGenerator->ConfigurationName.c_str(); - if(cmComputeLinkInformation* cli = this->Target->GetLinkInformation(cfg)) + if(cmComputeLinkInformation* cli = + this->GeneratorTarget->GetLinkInformation(cfg)) { std::vector<std::string> const& libDeps = cli->GetDepends(); for(std::vector<std::string>::const_iterator j = libDeps.begin(); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 4cc23cacf..b301d1bdd 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -231,7 +231,7 @@ cmNinjaDeps cmNinjaTargetGenerator::ComputeLinkDeps() const return cmNinjaDeps(); cmComputeLinkInformation* cli = - this->Target->GetLinkInformation(this->GetConfigName()); + this->GeneratorTarget->GetLinkInformation(this->GetConfigName()); if(!cli) return cmNinjaDeps(); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index d95b1ef2e..cce5cd6fb 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -15,7 +15,6 @@ #include "cmSourceFile.h" #include "cmLocalGenerator.h" #include "cmGlobalGenerator.h" -#include "cmComputeLinkInformation.h" #include "cmDocumentCompileDefinitions.h" #include "cmDocumentLocationUndefined.h" #include "cmListFileCache.h" @@ -4600,32 +4599,6 @@ std::string cmTarget::CheckCMP0004(std::string const& item) return lib; } -//---------------------------------------------------------------------------- -cmComputeLinkInformation* -cmTarget::GetLinkInformation(const char* config) -{ - // Lookup any existing information for this configuration. - std::map<cmStdString, cmComputeLinkInformation*>::iterator - i = this->LinkInformation.find(config?config:""); - if(i == this->LinkInformation.end()) - { - // Compute information for this configuration. - cmComputeLinkInformation* info = - new cmComputeLinkInformation(this, config); - if(!info || !info->Compute()) - { - delete info; - info = 0; - } - - // Store the information for this configuration. - std::map<cmStdString, cmComputeLinkInformation*>::value_type - entry(config?config:"", info); - i = this->LinkInformation.insert(entry).first; - } - return i->second; -} - //---------------------------------------------------------------------------- std::vector<std::string> cmTarget::GetIncludeDirectories() { @@ -4707,29 +4680,6 @@ std::string cmTarget::GetMacContentDirectory(const char* config, return fpath; } -//---------------------------------------------------------------------------- -cmTargetLinkInformationMap -::cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r): derived() -{ - // Ideally cmTarget instances should never be copied. However until - // we can make a sweep to remove that, this copy constructor avoids - // allowing the resources (LinkInformation) from getting copied. In - // the worst case this will lead to extra cmComputeLinkInformation - // instances. We also enforce in debug mode that the map be emptied - // when copied. - static_cast<void>(r); - assert(r.empty()); -} - -//---------------------------------------------------------------------------- -cmTargetLinkInformationMap::~cmTargetLinkInformationMap() -{ - for(derived::iterator i = this->begin(); i != this->end(); ++i) - { - delete i->second; - } -} - //---------------------------------------------------------------------------- cmTargetInternalPointer::cmTargetInternalPointer() { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index e9fceb368..9493b68cf 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -22,18 +22,8 @@ class cmake; class cmMakefile; class cmSourceFile; class cmGlobalGenerator; -class cmComputeLinkInformation; class cmListFileBacktrace; -struct cmTargetLinkInformationMap: - public std::map<cmStdString, cmComputeLinkInformation*> -{ - typedef std::map<cmStdString, cmComputeLinkInformation*> derived; - cmTargetLinkInformationMap() {} - cmTargetLinkInformationMap(cmTargetLinkInformationMap const& r); - ~cmTargetLinkInformationMap(); -}; - class cmTargetInternals; class cmTargetInternalPointer { @@ -397,8 +387,6 @@ public: std::string GetInstallNameDirForInstallTree(const char* config, bool for_xcode = false); - cmComputeLinkInformation* GetLinkInformation(const char* config); - // Get the properties cmPropertyMap &GetProperties() { return this->Properties; }; @@ -596,8 +584,6 @@ private: ImportInfo const* GetImportInfo(const char* config); void ComputeImportInfo(std::string const& desired_config, ImportInfo& info); - cmTargetLinkInformationMap LinkInformation; - bool ComputeLinkInterface(const char* config, LinkInterface& iface); void ComputeLinkImplementation(const char* config, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 3d2828dab..70aa5f696 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1452,7 +1452,7 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const& // Replace spaces in libs with ; cmSystemTools::ReplaceString(libs, " ", ";"); cmComputeLinkInformation* pcli = - this->Target->GetLinkInformation(config.c_str()); + this->GeneratorTarget->GetLinkInformation(config.c_str()); if(!pcli) { cmSystemTools::Error From 78bfee35d5bd5cba879d92eda4310d25bc54b30e Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Sun, 16 Sep 2012 01:16:43 +0200 Subject: [PATCH 145/152] Make cmLocalGenerator::AddArchitectureFlags take a cmGeneratorTarget. --- Source/cmGeneratorTarget.cxx | 21 ++++++++++++ Source/cmGeneratorTarget.h | 2 ++ Source/cmGlobalXCodeGenerator.cxx | 5 ++- Source/cmLocalGenerator.cxx | 33 ++++++++++--------- Source/cmLocalGenerator.h | 7 ++-- .../cmMakefileExecutableTargetGenerator.cxx | 2 +- Source/cmMakefileLibraryTargetGenerator.cxx | 2 +- Source/cmMakefileTargetGenerator.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmNinjaTargetGenerator.h | 3 ++ Source/cmTarget.cxx | 21 ------------ Source/cmTarget.h | 3 -- 13 files changed, 56 insertions(+), 49 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index e53f35e39..96f0ee88d 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -315,3 +315,24 @@ cmGeneratorTarget::GetLinkInformation(const char* config) } return i->second; } + +//---------------------------------------------------------------------------- +void cmGeneratorTarget::GetAppleArchs(const char* config, + std::vector<std::string>& archVec) +{ + const char* archs = 0; + if(config && *config) + { + std::string defVarName = "OSX_ARCHITECTURES_"; + defVarName += cmSystemTools::UpperCase(config); + archs = this->Target->GetProperty(defVarName.c_str()); + } + if(!archs) + { + archs = this->Target->GetProperty("OSX_ARCHITECTURES"); + } + if(archs) + { + cmSystemTools::ExpandListArgument(std::string(archs), archVec); + } +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index fefdfb1a5..ad1aa6234 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -67,6 +67,8 @@ public: cmComputeLinkInformation* GetLinkInformation(const char* config); + void GetAppleArchs(const char* config, + std::vector<std::string>& archVec); private: void ClassifySources(); void LookupObjectLibraries(); diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 5ac9070cf..599acd522 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1713,7 +1713,10 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, // Set target-specific architectures. std::vector<std::string> archs; - target.GetAppleArchs(configName, archs); + { + cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); + gtgt->GetAppleArchs(configName, archs); + } if(!archs.empty()) { // Enable ARCHS attribute. diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 24d9b91d7..62b0f5e85 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -555,9 +555,9 @@ void cmLocalGenerator::GenerateTargetManifest() } void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, - const char* lang, - cmSourceFile& source, - cmTarget& target) + const char* lang, + cmSourceFile& source, + cmGeneratorTarget& target) { std::string objectDir = cmSystemTools::GetFilenamePath(std::string(ofname)); objectDir = this->Convert(objectDir.c_str(),START_OUTPUT,SHELL); @@ -577,7 +577,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, flags += " "; { std::vector<std::string> includes; - this->GetIncludeDirectories(includes, &target, lang); + this->GetIncludeDirectories(includes, target.Target, lang); flags += this->GetIncludeFlags(includes, lang); } flags += this->Makefile->GetDefineFlags(); @@ -636,7 +636,8 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, ); } -void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) +void cmLocalGenerator::AddBuildTargetRule(const char* llang, + cmGeneratorTarget& target) { cmStdString objs; std::vector<std::string> objVector; @@ -669,8 +670,8 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) } std::string createRule = "CMAKE_"; createRule += llang; - createRule += target.GetCreateRuleVariable(); - std::string targetName = target.GetFullName(); + createRule += target.Target->GetCreateRuleVariable(); + std::string targetName = target.Target->GetFullName(); // Executable : // Shared Library: // Static Library: @@ -678,7 +679,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) std::string linkLibs; // should be set std::string flags; // should be set std::string linkFlags; // should be set - this->GetTargetFlags(linkLibs, flags, linkFlags, target); + this->GetTargetFlags(linkLibs, flags, linkFlags, *target.Target); cmLocalGenerator::RuleVariables vars; vars.Language = llang; vars.Objects = objs.c_str(); @@ -715,7 +716,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) // Store this command line. commandLines.push_back(commandLine); } - std::string targetFullPath = target.GetFullPath(); + std::string targetFullPath = target.Target->GetFullPath(); // Generate a meaningful comment for the command. std::string comment = "Linking "; comment += llang; @@ -729,7 +730,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) comment.c_str(), this->Makefile->GetStartOutputDirectory() ); - target.AddSourceFile + target.Target->AddSourceFile (this->Makefile->GetSource(targetFullPath.c_str())); } @@ -737,11 +738,11 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, cmTarget& target) void cmLocalGenerator ::CreateCustomTargetsAndCommands(std::set<cmStdString> const& lang) { - cmTargets &tgts = this->Makefile->GetTargets(); - for(cmTargets::iterator l = tgts.begin(); + cmGeneratorTargetsType tgts = this->Makefile->GetGeneratorTargets(); + for(cmGeneratorTargetsType::iterator l = tgts.begin(); l != tgts.end(); l++) { - cmTarget& target = l->second; + cmGeneratorTarget& target = *l->second; switch(target.GetType()) { case cmTarget::STATIC_LIBRARY: @@ -749,12 +750,12 @@ void cmLocalGenerator case cmTarget::MODULE_LIBRARY: case cmTarget::EXECUTABLE: { - const char* llang = target.GetLinkerLanguage(); + const char* llang = target.Target->GetLinkerLanguage(); if(!llang) { cmSystemTools::Error ("CMake can not determine linker language for target:", - target.GetName()); + target.Target->GetName()); return; } // if the language is not in the set lang then create custom @@ -1780,7 +1781,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, //---------------------------------------------------------------------------- void cmLocalGenerator::AddArchitectureFlags(std::string& flags, - cmTarget* target, + cmGeneratorTarget* target, const char *lang, const char* config) { diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index b3396e3a5..e371e40cc 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -16,6 +16,7 @@ class cmMakefile; class cmGlobalGenerator; +class cmGeneratorTarget; class cmTarget; class cmTargetManifest; class cmSourceFile; @@ -135,7 +136,7 @@ public: std::vector<cmLocalGenerator*>& GetChildren() { return this->Children; }; - void AddArchitectureFlags(std::string& flags, cmTarget* target, + void AddArchitectureFlags(std::string& flags, cmGeneratorTarget* target, const char *lang, const char* config); void AddLanguageFlags(std::string& flags, const char* lang, @@ -354,12 +355,12 @@ protected: /** Convert a target to a utility target for unsupported * languages of a generator */ - void AddBuildTargetRule(const char* llang, cmTarget& target); + void AddBuildTargetRule(const char* llang, cmGeneratorTarget& target); ///! add a custom command to build a .o file that is part of a target void AddCustomCommandToCreateObject(const char* ofname, const char* lang, cmSourceFile& source, - cmTarget& target); + cmGeneratorTarget& target); // Create Custom Targets and commands for unsupported languages // The set passed in should contain the languages supported by the // generator directly. Any targets containing files that are not diff --git a/Source/cmMakefileExecutableTargetGenerator.cxx b/Source/cmMakefileExecutableTargetGenerator.cxx index ab5150a36..d1c5b6261 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -210,7 +210,7 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Add language feature flags. this->AddFeatureFlags(flags, linkLanguage); - this->LocalGenerator->AddArchitectureFlags(flags, this->Target, + this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, linkLanguage, this->ConfigName); // Add target-specific linker flags. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index 577e5fd07..cc7d9c745 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -625,7 +625,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules std::string langFlags; this->AddFeatureFlags(langFlags, linkLanguage); - this->LocalGenerator->AddArchitectureFlags(langFlags, this->Target, + this->LocalGenerator->AddArchitectureFlags(langFlags, this->GeneratorTarget, linkLanguage, this->ConfigName); // remove any language flags that might not work with the diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index c818b7ef1..51ba75dd1 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -259,7 +259,7 @@ std::string cmMakefileTargetGenerator::GetFlags(const std::string &l) // Add language feature flags. this->AddFeatureFlags(flags, lang); - this->LocalGenerator->AddArchitectureFlags(flags, this->Target, + this->LocalGenerator->AddArchitectureFlags(flags, this->GeneratorTarget, lang, this->ConfigName); // Fortran-specific flags computed for this target. diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 9dc860ee9..082e9f37e 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -434,7 +434,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() ? vars["FLAGS"] : vars["ARCH_FLAGS"]); this->GetLocalGenerator()->AddArchitectureFlags(flags, - this->GetTarget(), + this->GetGeneratorTarget(), this->TargetLinkLanguage, this->GetConfigName()); if (targetType == cmTarget::EXECUTABLE) { diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index b301d1bdd..909d98011 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -134,7 +134,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, this->AddFeatureFlags(flags, language.c_str()); this->GetLocalGenerator()->AddArchitectureFlags(flags, - this->GetTarget(), + this->GeneratorTarget, language.c_str(), this->GetConfigName()); diff --git a/Source/cmNinjaTargetGenerator.h b/Source/cmNinjaTargetGenerator.h index cd20694b4..cf06bfdf5 100644 --- a/Source/cmNinjaTargetGenerator.h +++ b/Source/cmNinjaTargetGenerator.h @@ -52,6 +52,9 @@ protected: cmTarget* GetTarget() const { return this->Target; } + cmGeneratorTarget* GetGeneratorTarget() const + { return this->GeneratorTarget; } + cmLocalNinjaGenerator* GetLocalGenerator() const { return this->LocalGenerator; } diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index cce5cd6fb..c556813ca 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -3908,27 +3908,6 @@ void cmTarget::GetLanguages(std::set<cmStdString>& languages) const } } -//---------------------------------------------------------------------------- -void cmTarget::GetAppleArchs(const char* config, - std::vector<std::string>& archVec) -{ - const char* archs = 0; - if(config && *config) - { - std::string defVarName = "OSX_ARCHITECTURES_"; - defVarName += cmSystemTools::UpperCase(config); - archs = this->GetProperty(defVarName.c_str()); - } - if(!archs) - { - archs = this->GetProperty("OSX_ARCHITECTURES"); - } - if(archs) - { - cmSystemTools::ExpandListArgument(std::string(archs), archVec); - } -} - //---------------------------------------------------------------------------- bool cmTarget::IsChrpathUsed(const char* config) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 9493b68cf..f5ef72c2f 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -404,9 +404,6 @@ public: // until we have per-target object file properties. void GetLanguages(std::set<cmStdString>& languages) const; - /** Get the list of OS X target architectures to be built. */ - void GetAppleArchs(const char* config, std::vector<std::string>& archVec); - /** Return whether this target is an executable with symbol exports enabled. */ bool IsExecutableWithExports(); From 9facfd133654098ac59c0df957555ea5b5ed9a5a Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Sun, 16 Sep 2012 01:19:54 +0200 Subject: [PATCH 146/152] Move GetCreateRuleVariable to cmGeneratorTarget. --- Source/cmGeneratorTarget.cxx | 19 +++++++++++++++++++ Source/cmGeneratorTarget.h | 5 +++++ Source/cmLocalGenerator.cxx | 2 +- Source/cmTarget.cxx | 19 ------------------- Source/cmTarget.h | 4 ---- 5 files changed, 25 insertions(+), 24 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 96f0ee88d..03f511f51 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -336,3 +336,22 @@ void cmGeneratorTarget::GetAppleArchs(const char* config, cmSystemTools::ExpandListArgument(std::string(archs), archVec); } } + +//---------------------------------------------------------------------------- +const char* cmGeneratorTarget::GetCreateRuleVariable() +{ + switch(this->GetType()) + { + case cmTarget::STATIC_LIBRARY: + return "_CREATE_STATIC_LIBRARY"; + case cmTarget::SHARED_LIBRARY: + return "_CREATE_SHARED_LIBRARY"; + case cmTarget::MODULE_LIBRARY: + return "_CREATE_SHARED_MODULE"; + case cmTarget::EXECUTABLE: + return "_LINK_EXECUTABLE"; + default: + break; + } + return ""; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index ad1aa6234..d4640b6c5 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -69,6 +69,11 @@ public: void GetAppleArchs(const char* config, std::vector<std::string>& archVec); + + ///! Return the rule variable used to create this type of target, + // need to add CMAKE_(LANG) for full name. + const char* GetCreateRuleVariable(); + private: void ClassifySources(); void LookupObjectLibraries(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 62b0f5e85..006be05ab 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -670,7 +670,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, } std::string createRule = "CMAKE_"; createRule += llang; - createRule += target.Target->GetCreateRuleVariable(); + createRule += target.GetCreateRuleVariable(); std::string targetName = target.Target->GetFullName(); // Executable : // Shared Library: diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index c556813ca..8241d7560 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -2952,25 +2952,6 @@ void cmTarget::ComputeLinkClosure(const char* config, LinkClosure& lc) } } -//---------------------------------------------------------------------------- -const char* cmTarget::GetCreateRuleVariable() -{ - switch(this->GetType()) - { - case cmTarget::STATIC_LIBRARY: - return "_CREATE_STATIC_LIBRARY"; - case cmTarget::SHARED_LIBRARY: - return "_CREATE_SHARED_LIBRARY"; - case cmTarget::MODULE_LIBRARY: - return "_CREATE_SHARED_MODULE"; - case cmTarget::EXECUTABLE: - return "_LINK_EXECUTABLE"; - default: - break; - } - return ""; -} - //---------------------------------------------------------------------------- const char* cmTarget::GetSuffixVariableInternal(bool implib) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index f5ef72c2f..7a7b34ff0 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -320,10 +320,6 @@ public: ///! Return the preferred linker language for this target const char* GetLinkerLanguage(const char* config = 0); - ///! Return the rule variable used to create this type of target, - // need to add CMAKE_(LANG) for full name. - const char* GetCreateRuleVariable(); - /** Get the full name of the target according to the settings in its makefile. */ std::string GetFullName(const char* config=0, bool implib = false); From f9146f6b90d381a70bdb6a3c97742e3a53bb6235 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Sun, 16 Sep 2012 01:35:08 +0200 Subject: [PATCH 147/152] Port cmLocalGenerator::GetTargetFlags to cmGeneratorTarget. --- Source/cmLocalGenerator.cxx | 39 +++++++++---------- Source/cmLocalGenerator.h | 5 ++- .../cmMakefileExecutableTargetGenerator.cxx | 3 +- Source/cmMakefileLibraryTargetGenerator.cxx | 2 +- Source/cmNinjaNormalTargetGenerator.cxx | 2 +- Source/cmake.cxx | 3 +- 6 files changed, 28 insertions(+), 26 deletions(-) diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 006be05ab..c6dfed844 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -679,7 +679,7 @@ void cmLocalGenerator::AddBuildTargetRule(const char* llang, std::string linkLibs; // should be set std::string flags; // should be set std::string linkFlags; // should be set - this->GetTargetFlags(linkLibs, flags, linkFlags, *target.Target); + this->GetTargetFlags(linkLibs, flags, linkFlags, &target); cmLocalGenerator::RuleVariables vars; vars.Language = llang; vars.Objects = objs.c_str(); @@ -1451,7 +1451,7 @@ void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, std::string& flags, std::string& linkFlags, - cmTarget& target) + cmGeneratorTarget* target) { std::string buildType = this->Makefile->GetSafeDefinition("CMAKE_BUILD_TYPE"); @@ -1459,12 +1459,12 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, const char* libraryLinkVariable = "CMAKE_SHARED_LINKER_FLAGS"; // default to shared library - switch(target.GetType()) + switch(target->GetType()) { case cmTarget::STATIC_LIBRARY: { const char* targetLinkFlags = - target.GetProperty("STATIC_LIBRARY_FLAGS"); + target->GetProperty("STATIC_LIBRARY_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1474,7 +1474,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string build = "STATIC_LIBRARY_FLAGS_"; build += buildType; - targetLinkFlags = target.GetProperty(build.c_str()); + targetLinkFlags = target->GetProperty(build.c_str()); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1500,7 +1500,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, if(this->Makefile->IsOn("WIN32") && !(this->Makefile->IsOn("CYGWIN") || this->Makefile->IsOn("MINGW"))) { - const std::vector<cmSourceFile*>& sources = target.GetSourceFiles(); + const std::vector<cmSourceFile*>& sources = target->GetSourceFiles(); for(std::vector<cmSourceFile*>::const_iterator i = sources.begin(); i != sources.end(); ++i) { @@ -1515,7 +1515,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } } - const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); + const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1525,7 +1525,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target.GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1533,7 +1533,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, } } cmOStringStream linklibsStr; - this->OutputLinkLibraries(linklibsStr, target, false); + this->OutputLinkLibraries(linklibsStr, *target, false); linkLibs = linklibsStr.str(); } break; @@ -1549,17 +1549,17 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(build.c_str()); linkFlags += " "; } - const char* linkLanguage = target.GetLinkerLanguage(); + const char* linkLanguage = target->Target->GetLinkerLanguage(); if(!linkLanguage) { cmSystemTools::Error ("CMake can not determine linker language for target:", - target.GetName()); + target->Target->GetName()); return; } this->AddLanguageFlags(flags, linkLanguage, buildType.c_str()); cmOStringStream linklibs; - this->OutputLinkLibraries(linklibs, target, false); + this->OutputLinkLibraries(linklibs, *target, false); linkLibs = linklibs.str(); if(cmSystemTools::IsOn (this->Makefile->GetDefinition("BUILD_SHARED_LIBS"))) @@ -1569,7 +1569,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, linkFlags += this->Makefile->GetSafeDefinition(sFlagVar.c_str()); linkFlags += " "; } - if ( target.GetPropertyAsBool("WIN32_EXECUTABLE") ) + if ( target->GetPropertyAsBool("WIN32_EXECUTABLE") ) { linkFlags += this->Makefile->GetSafeDefinition("CMAKE_CREATE_WIN32_EXE"); @@ -1581,7 +1581,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, this->Makefile->GetSafeDefinition("CMAKE_CREATE_CONSOLE_EXE"); linkFlags += " "; } - if (target.IsExecutableWithExports()) + if (target->Target->IsExecutableWithExports()) { std::string exportFlagVar = "CMAKE_EXE_EXPORTS_"; exportFlagVar += linkLanguage; @@ -1591,7 +1591,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, this->Makefile->GetSafeDefinition(exportFlagVar.c_str()); linkFlags += " "; } - const char* targetLinkFlags = target.GetProperty("LINK_FLAGS"); + const char* targetLinkFlags = target->GetProperty("LINK_FLAGS"); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1601,7 +1601,7 @@ void cmLocalGenerator::GetTargetFlags(std::string& linkLibs, { std::string configLinkFlags = "LINK_FLAGS_"; configLinkFlags += buildType; - targetLinkFlags = target.GetProperty(configLinkFlags.c_str()); + targetLinkFlags = target->GetProperty(configLinkFlags.c_str()); if(targetLinkFlags) { linkFlags += targetLinkFlags; @@ -1653,12 +1653,11 @@ std::string cmLocalGenerator::ConvertToLinkReference(std::string const& lib) * to the name of the library. This will not link a library against itself. */ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, - cmTarget& tgt, + cmGeneratorTarget& tgt, bool relink) { const char* config = this->Makefile->GetDefinition("CMAKE_BUILD_TYPE"); - cmGeneratorTarget* gtgt = this->GlobalGenerator->GetGeneratorTarget(&tgt); - cmComputeLinkInformation* pcli = gtgt->GetLinkInformation(config); + cmComputeLinkInformation* pcli = tgt.GetLinkInformation(config); if(!pcli) { return; @@ -1679,7 +1678,7 @@ void cmLocalGenerator::OutputLinkLibraries(std::ostream& fout, std::string linkFlagsVar = "CMAKE_SHARED_LIBRARY_LINK_"; linkFlagsVar += linkLanguage; linkFlagsVar += "_FLAGS"; - if( gtgt->GetType() == cmTarget::EXECUTABLE ) + if( tgt.GetType() == cmTarget::EXECUTABLE ) { linkLibs = this->Makefile->GetSafeDefinition(linkFlagsVar.c_str()); linkLibs += " "; diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index e371e40cc..6ab80671b 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -335,11 +335,12 @@ public: void GetTargetFlags(std::string& linkLibs, std::string& flags, std::string& linkFlags, - cmTarget&target); + cmGeneratorTarget* target); protected: ///! put all the libraries for a target on into the given stream - virtual void OutputLinkLibraries(std::ostream&, cmTarget&, bool relink); + virtual void OutputLinkLibraries(std::ostream&, cmGeneratorTarget&, + bool relink); // 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 d1c5b6261..ca5f26ac9 100644 --- a/Source/cmMakefileExecutableTargetGenerator.cxx +++ b/Source/cmMakefileExecutableTargetGenerator.cxx @@ -319,7 +319,8 @@ void cmMakefileExecutableTargetGenerator::WriteExecutableRule(bool relink) // Collect up flags to link in needed libraries. cmOStringStream linklibs; - this->LocalGenerator->OutputLinkLibraries(linklibs, *this->Target, relink); + this->LocalGenerator->OutputLinkLibraries(linklibs, *this->GeneratorTarget, + relink); // Construct object file lists that may be needed to expand the // rule. diff --git a/Source/cmMakefileLibraryTargetGenerator.cxx b/Source/cmMakefileLibraryTargetGenerator.cxx index cc7d9c745..368d6fc68 100644 --- a/Source/cmMakefileLibraryTargetGenerator.cxx +++ b/Source/cmMakefileLibraryTargetGenerator.cxx @@ -546,7 +546,7 @@ void cmMakefileLibraryTargetGenerator::WriteLibraryRules if(this->Target->GetType() != cmTarget::STATIC_LIBRARY) { this->LocalGenerator - ->OutputLinkLibraries(linklibs, *this->Target, relink); + ->OutputLinkLibraries(linklibs, *this->GeneratorTarget, relink); } // Construct object file lists that may be needed to expand the diff --git a/Source/cmNinjaNormalTargetGenerator.cxx b/Source/cmNinjaNormalTargetGenerator.cxx index 082e9f37e..6f991e29d 100644 --- a/Source/cmNinjaNormalTargetGenerator.cxx +++ b/Source/cmNinjaNormalTargetGenerator.cxx @@ -423,7 +423,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement() this->GetLocalGenerator()->GetTargetFlags(vars["LINK_LIBRARIES"], vars["FLAGS"], vars["LINK_FLAGS"], - *this->GetTarget()); + this->GetGeneratorTarget()); this->AddModuleDefinitionFlag(vars["LINK_FLAGS"]); diff --git a/Source/cmake.cxx b/Source/cmake.cxx index c6787b9d0..e559fe0e8 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -630,7 +630,8 @@ bool cmake::FindPackage(const std::vector<std::string>& args) std::string linkLibs; std::string flags; std::string linkFlags; - lg->GetTargetFlags(linkLibs, flags, linkFlags, *tgt); + cmGeneratorTarget gtgt(tgt); + lg->GetTargetFlags(linkLibs, flags, linkFlags, >gt); printf("%s\n", linkLibs.c_str() ); From 290e92ada86c5b74669be48ee901494ae8e48ee3 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Sun, 16 Sep 2012 10:03:42 +0200 Subject: [PATCH 148/152] Move GetIncludeDirectories to cmGeneratorTarget. --- Source/cmExtraCodeBlocksGenerator.cxx | 4 +++- Source/cmExtraEclipseCDT4Generator.cxx | 8 +++++--- Source/cmGeneratorTarget.cxx | 24 ++++++++++++++++++++++ Source/cmGeneratorTarget.h | 3 +++ Source/cmGlobalGenerator.cxx | 12 +++++------ Source/cmGlobalXCodeGenerator.cxx | 3 ++- Source/cmLocalGenerator.cxx | 4 ++-- Source/cmLocalGenerator.h | 2 +- Source/cmLocalVisualStudio6Generator.cxx | 5 ++++- Source/cmLocalVisualStudio7Generator.cxx | 4 +++- Source/cmMakeDepend.cxx | 7 ++++--- Source/cmMakefileTargetGenerator.cxx | 12 +++++++---- Source/cmNinjaTargetGenerator.cxx | 2 +- Source/cmTarget.cxx | 24 ---------------------- Source/cmTarget.h | 3 --- Source/cmVisualStudio10TargetGenerator.cxx | 3 ++- 16 files changed, 68 insertions(+), 52 deletions(-) diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx index ad4ab76ee..b1bbd905d 100644 --- a/Source/cmExtraCodeBlocksGenerator.cxx +++ b/Source/cmExtraCodeBlocksGenerator.cxx @@ -636,9 +636,11 @@ void cmExtraCodeBlocksGenerator::AppendTarget(cmGeneratedFileStream& fout, // the include directories for this target std::set<std::string> uniqIncludeDirs; + cmGeneratorTarget *gtgt = this->GlobalGenerator + ->GetGeneratorTarget(target); std::vector<std::string> includes; target->GetMakefile()->GetLocalGenerator()-> - GetIncludeDirectories(includes, target); + GetIncludeDirectories(includes, gtgt); for(std::vector<std::string>::const_iterator dirIt=includes.begin(); dirIt != includes.end(); ++dirIt) diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx index 1f976f7d9..f1d9c31a8 100644 --- a/Source/cmExtraEclipseCDT4Generator.cxx +++ b/Source/cmExtraEclipseCDT4Generator.cxx @@ -884,11 +884,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const it != this->GlobalGenerator->GetLocalGenerators().end(); ++it) { - cmTargets & targets = (*it)->GetMakefile()->GetTargets(); - for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l) + cmGeneratorTargetsType targets = (*it)->GetMakefile() + ->GetGeneratorTargets(); + for (cmGeneratorTargetsType::iterator l = targets.begin(); + l != targets.end(); ++l) { std::vector<std::string> includeDirs; - (*it)->GetIncludeDirectories(includeDirs, &l->second); + (*it)->GetIncludeDirectories(includeDirs, l->second); this->AppendIncludeDirectories(fout, includeDirs, emmited); } } diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 03f511f51..044d8eeb9 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -355,3 +355,27 @@ const char* cmGeneratorTarget::GetCreateRuleVariable() } return ""; } + +//---------------------------------------------------------------------------- +std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories() +{ + std::vector<std::string> includes; + const char *prop = this->Target->GetProperty("INCLUDE_DIRECTORIES"); + if(prop) + { + cmSystemTools::ExpandListArgument(prop, includes); + } + + std::set<std::string> uniqueIncludes; + std::vector<std::string> orderedAndUniqueIncludes; + for(std::vector<std::string>::const_iterator + li = includes.begin(); li != includes.end(); ++li) + { + if(uniqueIncludes.insert(*li).second) + { + orderedAndUniqueIncludes.push_back(*li); + } + } + + return orderedAndUniqueIncludes; +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index d4640b6c5..6a0fe0f76 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -74,6 +74,9 @@ public: // need to add CMAKE_(LANG) for full name. const char* GetCreateRuleVariable(); + /** Get the include directories for this target. */ + std::vector<std::string> GetIncludeDirectories(); + private: void ClassifySources(); void LookupObjectLibraries(); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 0b0679075..766fcb7f6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1133,13 +1133,13 @@ void cmGlobalGenerator::CheckLocalGenerators() { manager = this->LocalGenerators[i]->GetMakefile()->GetCacheManager(); this->LocalGenerators[i]->ConfigureFinalPass(); - cmTargets & targets = - this->LocalGenerators[i]->GetMakefile()->GetTargets(); - for (cmTargets::iterator l = targets.begin(); + cmGeneratorTargetsType targets = + this->LocalGenerators[i]->GetMakefile()->GetGeneratorTargets(); + for (cmGeneratorTargetsType::iterator l = targets.begin(); l != targets.end(); l++) { const cmTarget::LinkLibraryVectorType& libs = - l->second.GetOriginalLinkLibraries(); + l->second->Target->GetOriginalLinkLibraries(); for(cmTarget::LinkLibraryVectorType::const_iterator lib = libs.begin(); lib != libs.end(); ++lib) { @@ -1155,14 +1155,14 @@ void cmGlobalGenerator::CheckLocalGenerators() } std::string text = notFoundMap[varName]; text += "\n linked by target \""; - text += l->second.GetName(); + text += l->second->GetName(); text += "\" in directory "; text+=this->LocalGenerators[i]->GetMakefile()->GetCurrentDirectory(); notFoundMap[varName] = text; } } std::vector<std::string> incs; - this->LocalGenerators[i]->GetIncludeDirectories(incs, &l->second); + this->LocalGenerators[i]->GetIncludeDirectories(incs, l->second); for( std::vector<std::string>::const_iterator incDir = incs.begin(); incDir != incs.end(); ++incDir) diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx index 599acd522..f9a1503d5 100644 --- a/Source/cmGlobalXCodeGenerator.cxx +++ b/Source/cmGlobalXCodeGenerator.cxx @@ -1953,7 +1953,8 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target, BuildObjectListOrString dirs(this, this->XcodeVersion >= 30); BuildObjectListOrString fdirs(this, this->XcodeVersion >= 30); std::vector<std::string> includes; - this->CurrentLocalGenerator->GetIncludeDirectories(includes, &target); + cmGeneratorTarget *gtgt = this->GetGeneratorTarget(&target); + this->CurrentLocalGenerator->GetIncludeDirectories(includes, gtgt); std::set<cmStdString> emitted; emitted.insert("/System/Library/Frameworks"); for(std::vector<std::string>::iterator i = includes.begin(); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index c6dfed844..662f87666 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -577,7 +577,7 @@ void cmLocalGenerator::AddCustomCommandToCreateObject(const char* ofname, flags += " "; { std::vector<std::string> includes; - this->GetIncludeDirectories(includes, target.Target, lang); + this->GetIncludeDirectories(includes, &target, lang); flags += this->GetIncludeFlags(includes, lang); } flags += this->Makefile->GetDefineFlags(); @@ -1320,7 +1320,7 @@ std::string cmLocalGenerator::GetIncludeFlags( //---------------------------------------------------------------------------- void cmLocalGenerator::GetIncludeDirectories(std::vector<std::string>& dirs, - cmTarget* target, + cmGeneratorTarget* target, const char* lang) { // Need to decide whether to automatically include the source and diff --git a/Source/cmLocalGenerator.h b/Source/cmLocalGenerator.h index 6ab80671b..0916d4422 100644 --- a/Source/cmLocalGenerator.h +++ b/Source/cmLocalGenerator.h @@ -206,7 +206,7 @@ public: /** Get the include flags for the current makefile and language. */ void GetIncludeDirectories(std::vector<std::string>& dirs, - cmTarget* target, + cmGeneratorTarget* target, const char* lang = "C"); /** Compute the language used to compile the given source file. */ diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index 9a9c5bbc0..d6af26bfe 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -862,10 +862,13 @@ cmLocalVisualStudio6Generator::GetTargetIncludeOptions(cmTarget &target) // the length threatens this problem. unsigned int maxIncludeLength = 3000; bool useShortPath = false; + + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); for(int j=0; j < 2; ++j) { std::vector<std::string> includes; - this->GetIncludeDirectories(includes, &target); + this->GetIncludeDirectories(includes, gt); std::vector<std::string>::iterator i; for(i = includes.begin(); i != includes.end(); ++i) diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index a09ab95e4..2ededfe0a 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -819,7 +819,9 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout, targetOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); fout << "\t\t\t\tAdditionalIncludeDirectories=\""; std::vector<std::string> includes; - this->GetIncludeDirectories(includes, &target); + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + this->GetIncludeDirectories(includes, gt); std::vector<std::string>::iterator i = includes.begin(); for(;i != includes.end(); ++i) { diff --git a/Source/cmMakeDepend.cxx b/Source/cmMakeDepend.cxx index a68b57c23..75a76a42e 100644 --- a/Source/cmMakeDepend.cxx +++ b/Source/cmMakeDepend.cxx @@ -58,11 +58,12 @@ void cmMakeDepend::SetMakefile(cmMakefile* makefile) // Now extract any include paths from the targets std::set<std::string> uniqueIncludes; std::vector<std::string> orderedAndUniqueIncludes; - cmTargets & targets = this->Makefile->GetTargets(); - for (cmTargets::iterator l = targets.begin(); l != targets.end(); ++l) + cmGeneratorTargetsType targets = this->Makefile->GetGeneratorTargets(); + for (cmGeneratorTargetsType::iterator l = targets.begin(); + l != targets.end(); ++l) { const std::vector<std::string>& includes = - l->second.GetIncludeDirectories(); + l->second->GetIncludeDirectories(); for(std::vector<std::string>::const_iterator j = includes.begin(); j != includes.end(); ++j) { diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 51ba75dd1..063a09968 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1062,7 +1062,8 @@ void cmMakefileTargetGenerator::WriteTargetDependRules() *this->InfoFileStream << "SET(CMAKE_C_TARGET_INCLUDE_PATH\n"; std::vector<std::string> includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget); for(std::vector<std::string>::iterator i = includes.begin(); i != includes.end(); ++i) { @@ -1547,7 +1548,8 @@ std::string cmMakefileTargetGenerator::GetFrameworkFlags() emitted.insert("/System/Library/Frameworks"); #endif std::vector<std::string> includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget); std::vector<std::string>::iterator i; // check all include directories for frameworks as this // will already have added a -F for the framework @@ -1852,7 +1854,8 @@ void cmMakefileTargetGenerator::AddIncludeFlags(std::string& flags, std::vector<std::string> includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target, lang); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget, lang); std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, lang, useResponseFile); @@ -1955,7 +1958,8 @@ void cmMakefileTargetGenerator::AddFortranFlags(std::string& flags) this->Makefile->GetDefinition("CMAKE_Fortran_MODPATH_FLAG")) { std::vector<std::string> includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget); for(std::vector<std::string>::const_iterator idi = includes.begin(); idi != includes.end(); ++idi) { diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 909d98011..a384cfb10 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -152,7 +152,7 @@ cmNinjaTargetGenerator::ComputeFlagsForObject(cmSourceFile *source, // Add include directory flags. { std::vector<std::string> includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target, + this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, language.c_str()); std::string includeFlags = this->LocalGenerator->GetIncludeFlags(includes, language.c_str(), diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 8241d7560..5a47d1749 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -4559,30 +4559,6 @@ std::string cmTarget::CheckCMP0004(std::string const& item) return lib; } -//---------------------------------------------------------------------------- -std::vector<std::string> cmTarget::GetIncludeDirectories() -{ - std::vector<std::string> includes; - const char *prop = this->GetProperty("INCLUDE_DIRECTORIES"); - if(prop) - { - cmSystemTools::ExpandListArgument(prop, includes); - } - - std::set<std::string> uniqueIncludes; - std::vector<std::string> orderedAndUniqueIncludes; - for(std::vector<std::string>::const_iterator - li = includes.begin(); li != includes.end(); ++li) - { - if(uniqueIncludes.insert(*li).second) - { - orderedAndUniqueIncludes.push_back(*li); - } - } - - return orderedAndUniqueIncludes; -} - //---------------------------------------------------------------------------- std::string cmTarget::GetFrameworkDirectory(const char* config) { diff --git a/Source/cmTarget.h b/Source/cmTarget.h index 7a7b34ff0..a025eea8e 100644 --- a/Source/cmTarget.h +++ b/Source/cmTarget.h @@ -437,9 +437,6 @@ public: directory. */ bool UsesDefaultOutputDir(const char* config, bool implib); - /** Get the include directories for this target. */ - std::vector<std::string> GetIncludeDirectories(); - /** Append to @a base the mac content directory and return it. */ std::string BuildMacContentDirectory(const std::string& base, const char* config = 0, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index 70aa5f696..fea117a4f 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1594,7 +1594,8 @@ void cmVisualStudio10TargetGenerator::WriteItemDefinitionGroups() static_cast<cmGlobalVisualStudio7Generator *> (this->GlobalGenerator)->GetConfigurations(); std::vector<std::string> includes; - this->LocalGenerator->GetIncludeDirectories(includes, this->Target); + this->LocalGenerator->GetIncludeDirectories(includes, + this->GeneratorTarget); for(std::vector<std::string>::iterator i = configs->begin(); i != configs->end(); ++i) { From d1446ca7a0d1de4ede995d64deef057c741ef0c2 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Mon, 17 Sep 2012 11:45:40 +0200 Subject: [PATCH 149/152] Append the COMPILE_DEFINITIONS from the Makefile to all targets. This way we don't need to check the definitions from the Makefile when generating later, and can more easily add generator expressions. Duplication is not a problem as the definitions are de-duplicated before generating. --- Source/cmGlobalGenerator.cxx | 19 +++++++++++++++++++ Source/cmLocalVisualStudio6Generator.cxx | 16 ---------------- Source/cmMakefileTargetGenerator.cxx | 4 ---- Source/cmNinjaTargetGenerator.cxx | 6 ------ 4 files changed, 19 insertions(+), 26 deletions(-) diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 766fcb7f6..ac75933c2 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -1078,11 +1078,30 @@ void cmGlobalGenerator::CreateGeneratorTargets() cmGeneratorTargetsType generatorTargets; cmMakefile *mf = this->LocalGenerators[i]->GetMakefile(); + const char *noconfig_compile_definitions = + mf->GetProperty("COMPILE_DEFINITIONS"); + + std::vector<std::string> configs; + mf->GetConfigurations(configs); + cmTargets& targets = mf->GetTargets(); for(cmTargets::iterator ti = targets.begin(); ti != targets.end(); ++ti) { cmTarget* t = &ti->second; + + { + t->AppendProperty("COMPILE_DEFINITIONS", noconfig_compile_definitions); + for(std::vector<std::string>::const_iterator ci = configs.begin(); + ci != configs.end(); ++ci) + { + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += cmSystemTools::UpperCase(*ci); + t->AppendProperty(defPropName.c_str(), + mf->GetProperty(defPropName.c_str())); + } + } + cmGeneratorTarget* gt = new cmGeneratorTarget(t); this->GeneratorTargets[t] = gt; this->ComputeTargetObjects(gt); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index d6af26bfe..adacd3bc6 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1679,22 +1679,6 @@ void cmLocalVisualStudio6Generator std::set<std::string> minsizeDefinesSet; std::set<std::string> debugrelDefinesSet; - this->AppendDefines( - definesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS")); - this->AppendDefines( - debugDefinesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_DEBUG")); - this->AppendDefines( - releaseDefinesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELEASE")); - this->AppendDefines( - minsizeDefinesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")); - this->AppendDefines( - debugrelDefinesSet, - this->Makefile->GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")); - this->AppendDefines( definesSet, target.GetProperty("COMPILE_DEFINITIONS")); diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 063a09968..cde329993 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -301,15 +301,11 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) } // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty("COMPILE_DEFINITIONS")); this->LocalGenerator->AppendDefines (defines, this->Target->GetProperty("COMPILE_DEFINITIONS")); std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); - this->LocalGenerator->AppendDefines - (defines, this->Makefile->GetProperty(defPropName.c_str())); this->LocalGenerator->AppendDefines (defines, this->Target->GetProperty(defPropName.c_str())); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index a384cfb10..d4ab133b2 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -193,9 +193,6 @@ ComputeDefines(cmSourceFile *source, const std::string& language) } // Add preprocessor definitions for this target and configuration. - this->LocalGenerator->AppendDefines - (defines, - this->Makefile->GetProperty("COMPILE_DEFINITIONS")); this->LocalGenerator->AppendDefines (defines, this->Target->GetProperty("COMPILE_DEFINITIONS")); @@ -205,9 +202,6 @@ ComputeDefines(cmSourceFile *source, const std::string& language) { std::string defPropName = "COMPILE_DEFINITIONS_"; defPropName += cmSystemTools::UpperCase(this->GetConfigName()); - this->LocalGenerator->AppendDefines - (defines, - this->Makefile->GetProperty(defPropName.c_str())); this->LocalGenerator->AppendDefines (defines, this->Target->GetProperty(defPropName.c_str())); From c31f3d99f8adc95c355f8607bdfccf01cc37c51d Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Mon, 17 Sep 2012 19:56:50 +0200 Subject: [PATCH 150/152] Add a wrapper for accessing config-specific compile-definitions. --- Source/cmGeneratorTarget.cxx | 14 ++++++++++++++ Source/cmGeneratorTarget.h | 2 ++ Source/cmLocalVisualStudio6Generator.cxx | 14 +++++++++----- Source/cmMakefileTargetGenerator.cxx | 9 ++++----- Source/cmNinjaTargetGenerator.cxx | 4 ++-- 5 files changed, 31 insertions(+), 12 deletions(-) diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index 044d8eeb9..db88834b9 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -379,3 +379,17 @@ std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories() return orderedAndUniqueIncludes; } + +//---------------------------------------------------------------------------- +const char *cmGeneratorTarget::GetCompileDefinitions(const char *config) +{ + if (!config) + { + return this->Target->GetProperty("COMPILE_DEFINITIONS"); + } + std::string defPropName = "COMPILE_DEFINITIONS_"; + defPropName += + cmSystemTools::UpperCase(config); + + return this->Target->GetProperty(defPropName.c_str()); +} diff --git a/Source/cmGeneratorTarget.h b/Source/cmGeneratorTarget.h index 6a0fe0f76..060e25a8b 100644 --- a/Source/cmGeneratorTarget.h +++ b/Source/cmGeneratorTarget.h @@ -77,6 +77,8 @@ public: /** Get the include directories for this target. */ std::vector<std::string> GetIncludeDirectories(); + const char *GetCompileDefinitions(const char *config = 0); + private: void ClassifySources(); void LookupObjectLibraries(); diff --git a/Source/cmLocalVisualStudio6Generator.cxx b/Source/cmLocalVisualStudio6Generator.cxx index adacd3bc6..72b56e71c 100644 --- a/Source/cmLocalVisualStudio6Generator.cxx +++ b/Source/cmLocalVisualStudio6Generator.cxx @@ -1679,21 +1679,25 @@ void cmLocalVisualStudio6Generator std::set<std::string> minsizeDefinesSet; std::set<std::string> debugrelDefinesSet; + + cmGeneratorTarget* gt = + this->GlobalGenerator->GetGeneratorTarget(&target); + this->AppendDefines( definesSet, - target.GetProperty("COMPILE_DEFINITIONS")); + gt->GetCompileDefinitions()); this->AppendDefines( debugDefinesSet, - target.GetProperty("COMPILE_DEFINITIONS_DEBUG")); + gt->GetCompileDefinitions("DEBUG")); this->AppendDefines( releaseDefinesSet, - target.GetProperty("COMPILE_DEFINITIONS_RELEASE")); + gt->GetCompileDefinitions("RELEASE")); this->AppendDefines( minsizeDefinesSet, - target.GetProperty("COMPILE_DEFINITIONS_MINSIZEREL")); + gt->GetCompileDefinitions("MINSIZEREL")); this->AppendDefines( debugrelDefinesSet, - target.GetProperty("COMPILE_DEFINITIONS_RELWITHDEBINFO")); + gt->GetCompileDefinitions("RELWITHDEBINFO")); std::string defines = " "; std::string debugDefines = " "; diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index cde329993..9560c1062 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -302,12 +302,11 @@ std::string cmMakefileTargetGenerator::GetDefines(const std::string &l) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty("COMPILE_DEFINITIONS")); - std::string defPropName = "COMPILE_DEFINITIONS_"; - defPropName += - cmSystemTools::UpperCase(this->LocalGenerator->ConfigurationName); + (defines, this->GeneratorTarget->GetCompileDefinitions()); + this->LocalGenerator->AppendDefines - (defines, this->Target->GetProperty(defPropName.c_str())); + (defines, this->GeneratorTarget->GetCompileDefinitions( + this->LocalGenerator->ConfigurationName.c_str())); std::string definesString; this->LocalGenerator->JoinDefines(defines, definesString, lang); diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index d4ab133b2..1d11acab9 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -195,7 +195,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language) // Add preprocessor definitions for this target and configuration. this->LocalGenerator->AppendDefines (defines, - this->Target->GetProperty("COMPILE_DEFINITIONS")); + this->GeneratorTarget->GetCompileDefinitions()); this->LocalGenerator->AppendDefines (defines, source->GetProperty("COMPILE_DEFINITIONS")); @@ -204,7 +204,7 @@ ComputeDefines(cmSourceFile *source, const std::string& language) defPropName += cmSystemTools::UpperCase(this->GetConfigName()); this->LocalGenerator->AppendDefines (defines, - this->Target->GetProperty(defPropName.c_str())); + this->GeneratorTarget->GetCompileDefinitions(this->GetConfigName())); this->LocalGenerator->AppendDefines (defines, source->GetProperty(defPropName.c_str())); From 52854583429e4fb8f180d8276a07d8f8226d6427 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Tue, 18 Sep 2012 13:38:10 +0200 Subject: [PATCH 151/152] Add convenience for getting a cmGeneratorTarget to use. --- Source/cmMakefile.cxx | 6 ++++++ Source/cmMakefile.h | 1 + 2 files changed, 7 insertions(+) diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index 9a9c1c859..f067da491 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3984,6 +3984,12 @@ cmTarget* cmMakefile::FindTargetToUse(const char* name) return this->LocalGenerator->GetGlobalGenerator()->FindTarget(0, name); } +cmGeneratorTarget* cmMakefile::FindGeneratorTargetToUse(const char* name) +{ + cmTarget *t = this->FindTargetToUse(name); + return this->LocalGenerator->GetGlobalGenerator()->GetGeneratorTarget(t); +} + //---------------------------------------------------------------------------- bool cmMakefile::EnforceUniqueName(std::string const& name, std::string& msg, bool isCustom) diff --git a/Source/cmMakefile.h b/Source/cmMakefile.h index 4e79cea41..80a50d6e6 100644 --- a/Source/cmMakefile.h +++ b/Source/cmMakefile.h @@ -535,6 +535,7 @@ public: /** Find a target to use in place of the given name. The target returned may be imported or built within the project. */ cmTarget* FindTargetToUse(const char* name); + cmGeneratorTarget* FindGeneratorTargetToUse(const char* name); /** * Mark include directories as system directories. From 6674583caa20244d90aa14a67d059e7228a9f169 Mon Sep 17 00:00:00 2001 From: Stephen Kelly <steveire@gmail.com> Date: Wed, 19 Sep 2012 17:16:25 +0200 Subject: [PATCH 152/152] Fix compiler warning with initialization order. --- Source/cmInstallTargetGenerator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/cmInstallTargetGenerator.h b/Source/cmInstallTargetGenerator.h index 5d5011b15..cab3e9065 100644 --- a/Source/cmInstallTargetGenerator.h +++ b/Source/cmInstallTargetGenerator.h @@ -97,11 +97,11 @@ protected: void CreateGeneratorTarget(); cmTarget* Target; - cmGeneratorTarget* GeneratorTarget; bool ImportLibrary; std::string FilePermissions; bool Optional; NamelinkModeType NamelinkMode; + cmGeneratorTarget* GeneratorTarget; }; #endif