Browse Source

Merge branch 'master' into sublime-text-2-generator

Morné Chamberlain 13 years ago
parent
commit
b3ae61f833
100 changed files with 1251 additions and 989 deletions
  1. 23 0
      CMakeLists.txt
  2. 78 5
      Modules/ExternalProject.cmake
  3. 1 1
      Modules/FindSquish.cmake
  4. 17 0
      Modules/Platform/Darwin.cmake
  5. 6 1
      Modules/Platform/Windows-MSVC.cmake
  6. 1 14
      Source/CMakeLists.txt
  7. 1 1
      Source/CMakeVersion.cmake
  8. 1 2
      Source/CPack/cmCPackGenerator.cxx
  9. 1 1
      Source/CursesDialog/cmCursesStringWidget.cxx
  10. 9 1
      Source/cmComputeLinkInformation.cxx
  11. 1 0
      Source/cmComputeLinkInformation.h
  12. 15 7
      Source/cmConfigureFileCommand.h
  13. 9 0
      Source/cmDocumentVariables.cxx
  14. 2 1
      Source/cmFileCommand.h
  15. 3 1
      Source/cmFunctionCommand.h
  16. 2 2
      Source/cmGlobalBorlandMakefileGenerator.cxx
  17. 4 3
      Source/cmGlobalBorlandMakefileGenerator.h
  18. 1 8
      Source/cmGlobalGenerator.cxx
  19. 0 3
      Source/cmGlobalGenerator.h
  20. 59 0
      Source/cmGlobalGeneratorFactory.h
  21. 2 2
      Source/cmGlobalJOMMakefileGenerator.cxx
  22. 4 3
      Source/cmGlobalJOMMakefileGenerator.h
  23. 2 2
      Source/cmGlobalMSYSMakefileGenerator.cxx
  24. 4 3
      Source/cmGlobalMSYSMakefileGenerator.h
  25. 2 2
      Source/cmGlobalMinGWMakefileGenerator.cxx
  26. 4 3
      Source/cmGlobalMinGWMakefileGenerator.h
  27. 2 2
      Source/cmGlobalNMakeMakefileGenerator.cxx
  28. 4 3
      Source/cmGlobalNMakeMakefileGenerator.h
  29. 2 2
      Source/cmGlobalNinjaGenerator.cxx
  30. 4 3
      Source/cmGlobalNinjaGenerator.h
  31. 2 2
      Source/cmGlobalUnixMakefileGenerator3.cxx
  32. 5 3
      Source/cmGlobalUnixMakefileGenerator3.h
  33. 62 10
      Source/cmGlobalVisualStudio10Generator.cxx
  34. 4 10
      Source/cmGlobalVisualStudio10Generator.h
  35. 0 50
      Source/cmGlobalVisualStudio10IA64Generator.cxx
  36. 0 40
      Source/cmGlobalVisualStudio10IA64Generator.h
  37. 0 50
      Source/cmGlobalVisualStudio10Win64Generator.cxx
  38. 0 40
      Source/cmGlobalVisualStudio10Win64Generator.h
  39. 0 29
      Source/cmGlobalVisualStudio11ARMGenerator.cxx
  40. 0 35
      Source/cmGlobalVisualStudio11ARMGenerator.h
  41. 54 10
      Source/cmGlobalVisualStudio11Generator.cxx
  42. 5 11
      Source/cmGlobalVisualStudio11Generator.h
  43. 0 37
      Source/cmGlobalVisualStudio11Win64Generator.cxx
  44. 0 37
      Source/cmGlobalVisualStudio11Win64Generator.h
  45. 2 3
      Source/cmGlobalVisualStudio6Generator.cxx
  46. 5 3
      Source/cmGlobalVisualStudio6Generator.h
  47. 12 17
      Source/cmGlobalVisualStudio71Generator.cxx
  48. 8 8
      Source/cmGlobalVisualStudio71Generator.h
  49. 103 26
      Source/cmGlobalVisualStudio7Generator.cxx
  50. 13 9
      Source/cmGlobalVisualStudio7Generator.h
  51. 73 8
      Source/cmGlobalVisualStudio8Generator.cxx
  52. 15 12
      Source/cmGlobalVisualStudio8Generator.h
  53. 0 40
      Source/cmGlobalVisualStudio8Win64Generator.cxx
  54. 0 47
      Source/cmGlobalVisualStudio8Win64Generator.h
  55. 53 10
      Source/cmGlobalVisualStudio9Generator.cxx
  56. 5 11
      Source/cmGlobalVisualStudio9Generator.h
  57. 0 37
      Source/cmGlobalVisualStudio9IA64Generator.cxx
  58. 0 47
      Source/cmGlobalVisualStudio9IA64Generator.h
  59. 0 37
      Source/cmGlobalVisualStudio9Win64Generator.cxx
  60. 0 47
      Source/cmGlobalVisualStudio9Win64Generator.h
  61. 6 1
      Source/cmGlobalVisualStudioGenerator.cxx
  62. 1 0
      Source/cmGlobalVisualStudioGenerator.h
  63. 2 2
      Source/cmGlobalWatcomWMakeGenerator.cxx
  64. 4 2
      Source/cmGlobalWatcomWMakeGenerator.h
  65. 24 3
      Source/cmGlobalXCodeGenerator.cxx
  66. 4 2
      Source/cmGlobalXCodeGenerator.h
  67. 4 1
      Source/cmIncludeDirectoryCommand.h
  68. 4 0
      Source/cmLoadCommandCommand.cxx
  69. 14 1
      Source/cmLoadCommandCommand.h
  70. 8 6
      Source/cmLocalVisualStudio6Generator.cxx
  71. 5 3
      Source/cmLocalVisualStudio7Generator.cxx
  72. 0 1
      Source/cmLocalVisualStudioGenerator.cxx
  73. 4 4
      Source/cmMacroCommand.h
  74. 40 0
      Source/cmMakefile.cxx
  75. 2 2
      Source/cmMathCommand.h
  76. 3 2
      Source/cmMessageCommand.h
  77. 1 0
      Source/cmNinjaNormalTargetGenerator.cxx
  78. 1 1
      Source/cmPolicies.cxx
  79. 76 1
      Source/cmQtAutomoc.cxx
  80. 3 1
      Source/cmSetTargetPropertiesCommand.h
  81. 1 1
      Source/cmSourceFile.cxx
  82. 1 1
      Source/cmSourceGroupCommand.h
  83. 32 0
      Source/cmTarget.cxx
  84. 2 2
      Source/cmTargetLinkLibrariesCommand.h
  85. 1 1
      Source/cmTryRunCommand.h
  86. 5 3
      Source/cmVisualStudio10TargetGenerator.cxx
  87. 0 56
      Source/cmWin32ProcessExecution.cxx
  88. 68 79
      Source/cmake.cxx
  89. 3 5
      Source/cmake.h
  90. 4 0
      Source/cmcldeps.cxx
  91. 5 5
      Source/cmw9xcom.cxx
  92. 1 1
      Source/kwsys/SystemInformation.cxx
  93. 34 0
      Tests/BuildDepends/CMakeLists.txt
  94. 15 0
      Tests/BuildDepends/Project/CMakeLists.txt
  95. 7 0
      Tests/BuildDepends/Project/link_depends_no_shared_check.cmake
  96. 9 0
      Tests/BuildDepends/Project/link_depends_no_shared_exe.c
  97. 8 0
      Tests/BuildDepends/Project/link_depends_no_shared_lib.c
  98. 59 0
      Tests/CMakeLists.txt
  99. 11 0
      Tests/ExternalProject/CMakeLists.txt
  100. 94 0
      Tests/ExternalProjectUpdate/CMakeLists.txt

+ 23 - 0
CMakeLists.txt

@@ -585,6 +585,29 @@ option(CMAKE_STRICT
   "Perform strict testing to record property and variable access. Can be used to report any undefined properties or variables" OFF)
 mark_as_advanced(CMAKE_STRICT)
 
+if(NOT CMake_VERSION_IS_RELEASE)
+  if("${CMAKE_C_COMPILER_ID}" STREQUAL "GNU" AND
+      NOT "${CMAKE_C_COMPILER_VERSION}" VERSION_LESS 4.2)
+    set(C_FLAGS_LIST -Wcast-align -Werror-implicit-function-declaration -Wchar-subscripts
+                     -Wall -W -Wpointer-arith -Wwrite-strings -Wformat-security
+                     -Wmissing-format-attribute -fno-common
+    )
+    set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
+                       -Wshadow -Wpointer-arith -Wformat-security
+    )
+
+    foreach(FLAG_LANG  C CXX)
+      foreach(FLAG ${${FLAG_LANG}_FLAGS_LIST})
+        if(NOT " ${CMAKE_${FLAG_LANG}_FLAGS} " MATCHES " ${FLAG} ")
+          set(CMAKE_${FLAG_LANG}_FLAGS "${CMAKE_${FLAG_LANG}_FLAGS} ${FLAG}")
+        endif()
+      endforeach()
+    endforeach()
+
+    unset(C_FLAGS_LIST)
+    unset(CXX_FLAGS_LIST)
+  endif()
+endif()
 
 # build the remaining subdirectories
 add_subdirectory(Source)

+ 78 - 5
Modules/ExternalProject.cmake

@@ -402,6 +402,79 @@ endif()
 endfunction()
 
 
+function(_ep_write_gitupdate_script script_filename git_EXECUTABLE git_tag git_repository work_dir)
+  file(WRITE ${script_filename}
+"if(\"${git_tag}\" STREQUAL \"\")
+  message(FATAL_ERROR \"Tag for git checkout should not be empty.\")
+endif()
+
+execute_process(
+  COMMAND \"${git_EXECUTABLE}\" rev-list --max-count=1 HEAD
+  WORKING_DIRECTORY \"${work_dir}\"
+  RESULT_VARIABLE error_code
+  OUTPUT_VARIABLE head_sha
+  )
+if(error_code)
+  message(FATAL_ERROR \"Failed to get the hash for HEAD\")
+endif()
+
+execute_process(
+  COMMAND \"${git_EXECUTABLE}\" show-ref ${git_tag}
+  WORKING_DIRECTORY \"${work_dir}\"
+  OUTPUT_VARIABLE show_ref_output
+  )
+# If a remote ref is asked for, which can possibly move around,
+# we must always do a fetch and checkout.
+if(\"\${show_ref_output}\" MATCHES \"remotes\")
+  set(is_remote_ref 1)
+else()
+  set(is_remote_ref 0)
+endif()
+
+# This will fail if the tag does not exist (it probably has not been fetched
+# yet).
+execute_process(
+  COMMAND \"${git_EXECUTABLE}\" rev-list --max-count=1 ${git_tag}
+  WORKING_DIRECTORY \"${work_dir}\"
+  RESULT_VARIABLE error_code
+  OUTPUT_VARIABLE tag_sha
+  )
+
+# Is the hash checkout out that we want?
+if(error_code OR is_remote_ref OR NOT (\"\${tag_sha}\" STREQUAL \"\${head_sha}\"))
+  execute_process(
+    COMMAND \"${git_EXECUTABLE}\" fetch
+    WORKING_DIRECTORY \"${work_dir}\"
+    RESULT_VARIABLE error_code
+    )
+  if(error_code)
+    message(FATAL_ERROR \"Failed to fetch repository '${git_repository}'\")
+  endif()
+
+  execute_process(
+    COMMAND \"${git_EXECUTABLE}\" checkout ${git_tag}
+    WORKING_DIRECTORY \"${work_dir}\"
+    RESULT_VARIABLE error_code
+    )
+  if(error_code)
+    message(FATAL_ERROR \"Failed to checkout tag: '${git_tag}'\")
+  endif()
+
+  execute_process(
+    COMMAND \"${git_EXECUTABLE}\" submodule update --recursive
+    WORKING_DIRECTORY \"${work_dir}/${src_name}\"
+    RESULT_VARIABLE error_code
+    )
+  if(error_code)
+    message(FATAL_ERROR \"Failed to update submodules in: '${work_dir}/${src_name}'\")
+  endif()
+endif()
+
+"
+)
+
+endfunction(_ep_write_gitupdate_script)
+
 function(_ep_write_downloadfile_script script_filename remote local timeout hash tls_verify tls_cainfo)
   if(timeout)
     set(timeout_args TIMEOUT ${timeout})
@@ -1354,7 +1427,7 @@ endfunction()
 
 
 function(_ep_add_update_command name)
-  ExternalProject_Get_Property(${name} source_dir)
+  ExternalProject_Get_Property(${name} source_dir tmp_dir)
 
   get_property(cmd_set TARGET ${name} PROPERTY _EP_UPDATE_COMMAND SET)
   get_property(cmd TARGET ${name} PROPERTY _EP_UPDATE_COMMAND)
@@ -1406,15 +1479,15 @@ function(_ep_add_update_command name)
       message(FATAL_ERROR "error: could not find git for fetch of ${name}")
     endif()
     set(work_dir ${source_dir})
-    set(comment "Performing update step (git fetch) for '${name}'")
+    set(comment "Performing update step for '${name}'")
     get_property(git_tag TARGET ${name} PROPERTY _EP_GIT_TAG)
     if(NOT git_tag)
       set(git_tag "master")
     endif()
-    set(cmd ${GIT_EXECUTABLE} fetch
-      COMMAND ${GIT_EXECUTABLE} checkout ${git_tag}
-      COMMAND ${GIT_EXECUTABLE} submodule update --recursive
+    _ep_write_gitupdate_script(${tmp_dir}/${name}-gitupdate.cmake
+      ${GIT_EXECUTABLE} ${git_tag} ${git_repository} ${work_dir}
       )
+    set(cmd ${CMAKE_COMMAND} -P ${tmp_dir}/${name}-gitupdate.cmake)
     set(always 1)
   elseif(hg_repository)
     if(NOT HG_EXECUTABLE)

+ 1 - 1
Modules/FindSquish.cmake

@@ -221,7 +221,7 @@ function(SQUISH_V4_ADD_TEST testName)
 
   get_target_property(testAUTLocation ${_SQUISH_AUT} LOCATION)
   get_filename_component(testAUTDir ${testAUTLocation} PATH)
-  get_target_property(testAUTName ${_SQUISH_AUT} OUTPUT_NAME)
+  get_filename_component(testAUTName ${testAUTLocation} NAME)
 
   get_filename_component(absTestSuite "${_SQUISH_SUITE}" ABSOLUTE)
   if(NOT EXISTS "${absTestSuite}")

+ 17 - 0
Modules/Platform/Darwin.cmake

@@ -263,6 +263,23 @@ set(CMAKE_SYSTEM_FRAMEWORK_PATH
   /Network/Library/Frameworks
   /System/Library/Frameworks)
 
+# Warn about known system mis-configuration case.
+if(CMAKE_OSX_SYSROOT)
+  get_property(_IN_TC GLOBAL PROPERTY IN_TRY_COMPILE)
+  if(NOT _IN_TC AND
+     NOT IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks"
+     AND IS_SYMLINK "${CMAKE_OSX_SYSROOT}/Library/Frameworks/Frameworks")
+    message(WARNING "The SDK Library/Frameworks path\n"
+      " ${CMAKE_OSX_SYSROOT}/Library/Frameworks\n"
+      "is not set up correctly on this system.  "
+      "This is known to occur when installing Xcode 3.2.6:\n"
+      " http://bugs.python.org/issue14018\n"
+      "The problem may cause build errors that report missing system frameworks.  "
+      "Fix your SDK symlinks to resolve this issue and avoid this warning."
+      )
+  endif()
+endif()
+
 # default to searching for application bundles first
 if(NOT DEFINED CMAKE_FIND_APPBUNDLE)
   set(CMAKE_FIND_APPBUNDLE FIRST)

+ 6 - 1
Modules/Platform/Windows-MSVC.cmake

@@ -154,6 +154,11 @@ else()
     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()
+
+  if(MSVC_VERSION LESS 1310)
+    set(_FLAGS_C   " /Zm1000${_FLAGS_C}")
+    set(_FLAGS_CXX " /Zm1000${_FLAGS_CXX}")
+  endif()
 endif()
 
 set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
@@ -233,7 +238,7 @@ macro(__windows_compiler_msvc lang)
   set(CMAKE_${lang}_LINK_EXECUTABLE
     "${_CMAKE_VS_LINK_EXE}<CMAKE_${lang}_COMPILER> ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> /Fd<TARGET_PDB> <OBJECTS> /link /implib:<TARGET_IMPLIB> /version:<TARGET_VERSION_MAJOR>.<TARGET_VERSION_MINOR> <CMAKE_${lang}_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
 
-  set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3 /Zm1000${_FLAGS_${lang}}")
+  set(CMAKE_${lang}_FLAGS_INIT "${_PLATFORM_DEFINES}${_PLATFORM_DEFINES_${lang}} /D_WINDOWS /W3${_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")

+ 1 - 14
Source/CMakeLists.txt

@@ -203,6 +203,7 @@ set(SRCS
   cmGeneratorTarget.h
   cmGlobalGenerator.cxx
   cmGlobalGenerator.h
+  cmGlobalGeneratorFactory.h
   cmGlobalUnixMakefileGenerator3.cxx
   cmGlobalUnixMakefileGenerator3.h
   cmGraphAdjacencyList.h
@@ -332,12 +333,6 @@ if (WIN32)
       cmGlobalVisualStudio8Generator.h
       cmGlobalVisualStudio9Generator.cxx
       cmGlobalVisualStudio9Generator.h
-      cmGlobalVisualStudio8Win64Generator.cxx
-      cmGlobalVisualStudio8Win64Generator.h
-      cmGlobalVisualStudio9Win64Generator.cxx
-      cmGlobalVisualStudio9Win64Generator.h
-      cmGlobalVisualStudio9IA64Generator.cxx
-      cmGlobalVisualStudio9IA64Generator.h
       cmVisualStudioGeneratorOptions.h
       cmVisualStudioGeneratorOptions.cxx
       cmVisualStudio10TargetGenerator.h
@@ -346,16 +341,8 @@ if (WIN32)
       cmLocalVisualStudio10Generator.h
       cmGlobalVisualStudio10Generator.h
       cmGlobalVisualStudio10Generator.cxx
-      cmGlobalVisualStudio10Win64Generator.h
-      cmGlobalVisualStudio10Win64Generator.cxx
-      cmGlobalVisualStudio10IA64Generator.h
-      cmGlobalVisualStudio10IA64Generator.cxx
       cmGlobalVisualStudio11Generator.h
       cmGlobalVisualStudio11Generator.cxx
-      cmGlobalVisualStudio11Win64Generator.h
-      cmGlobalVisualStudio11Win64Generator.cxx
-      cmGlobalVisualStudio11ARMGenerator.h
-      cmGlobalVisualStudio11ARMGenerator.cxx
       cmGlobalVisualStudioGenerator.cxx
       cmGlobalVisualStudioGenerator.h
       cmGlobalWatcomWMakeGenerator.cxx

+ 1 - 1
Source/CMakeVersion.cmake

@@ -2,5 +2,5 @@
 set(CMake_VERSION_MAJOR 2)
 set(CMake_VERSION_MINOR 8)
 set(CMake_VERSION_PATCH 10)
-set(CMake_VERSION_TWEAK 20121111)
+set(CMake_VERSION_TWEAK 20121124)
 #set(CMake_VERSION_RC 1)

+ 1 - 2
Source/CPack/cmCPackGenerator.cxx

@@ -97,7 +97,6 @@ int cmCPackGenerator::PrepareNames()
     }
   tempDirectory += this->GetOption("CPACK_GENERATOR");
   std::string topDirectory = tempDirectory;
-  this->GetOption("CPACK_PACKAGE_FILE_NAME");
   const char* pfname = this->GetOption("CPACK_PACKAGE_FILE_NAME");
   if(!pfname)
     {
@@ -208,7 +207,7 @@ int cmCPackGenerator::InstallProject()
     {
     cmCPackLogger(cmCPackLog::LOG_ERROR,
       "Problem creating temporary directory: "
-                  << (tempInstallDirectory ? tempInstallDirectory : "(NULL}")
+                  << (tempInstallDirectory ? tempInstallDirectory : "(NULL)")
                   << std::endl);
     return 0;
     }

+ 1 - 1
Source/CursesDialog/cmCursesStringWidget.cxx

@@ -175,7 +175,7 @@ bool cmCursesStringWidget::HandleInput(int& key, cmCursesMainForm* fm,
       }
     else if ( key == ctrl('d') ||key == KEY_DC )
       {
-      if ( form->curcol > 0 )
+      if ( form->curcol >= 0 )
         {
         form_driver(form, REQ_DEL_CHAR);
         }

+ 9 - 1
Source/cmComputeLinkInformation.cxx

@@ -277,6 +277,10 @@ cmComputeLinkInformation
   this->UseImportLibrary =
     this->Makefile->GetDefinition("CMAKE_IMPORT_LIBRARY_SUFFIX")?true:false;
 
+  // Check whether we should skip dependencies on shared library files.
+  this->LinkDependsNoShared =
+    this->Target->GetPropertyAsBool("LINK_DEPENDS_NO_SHARED");
+
   // On platforms without import libraries there may be a special flag
   // to use when creating a plugin (module) that obtains symbols from
   // the program that will load it.
@@ -650,7 +654,11 @@ void cmComputeLinkInformation::AddItem(std::string const& item, cmTarget* tgt)
 
       // Pass the full path to the target file.
       std::string lib = tgt->GetFullPath(config, implib, true);
-      this->Depends.push_back(lib);
+      if(!this->LinkDependsNoShared ||
+         tgt->GetType() != cmTarget::SHARED_LIBRARY)
+        {
+        this->Depends.push_back(lib);
+        }
 
       this->AddTargetItem(lib, tgt);
       this->AddLibraryRuntimeInfo(lib, tgt);

+ 1 - 0
Source/cmComputeLinkInformation.h

@@ -82,6 +82,7 @@ private:
   // Configuration information.
   const char* Config;
   const char* LinkLanguage;
+  bool LinkDependsNoShared;
 
   // Modes for dealing with dependent shared libraries.
   enum SharedDepMode

+ 15 - 7
Source/cmConfigureFileCommand.h

@@ -68,6 +68,9 @@ public:
         "If <output> names an existing directory the input file is placed "
         "in that directory with its original name.  "
         "\n"
+        "If the <input> file is modified the build system will re-run CMake "
+        "to re-configure the file and generate the build system again."
+        "\n"
         "This command replaces any variables in the input file referenced as "
         "${VAR} or @VAR@ with their values as determined by CMake.  If a "
         "variable is not defined, it will be replaced with nothing.  "
@@ -76,13 +79,18 @@ public:
         "will be C-style escaped.  "
         "The file will be configured with the current values of CMake "
         "variables. If @ONLY is specified, only variables "
-        "of the form @VAR@ will be replaces and ${VAR} will be ignored.  "
-        "This is useful for configuring scripts that use ${VAR}. "
-        "Any occurrences of #cmakedefine VAR will be replaced with "
-        "either #define VAR or /* #undef VAR */ depending on "
-        "the setting of VAR in CMake. Any occurrences of #cmakedefine01 VAR "
-        "will be replaced with either #define VAR 1 or #define VAR 0 "
-        "depending on whether VAR evaluates to TRUE or FALSE in CMake.\n"
+        "of the form @VAR@ will be replaced and ${VAR} will be ignored.  "
+        "This is useful for configuring scripts that use ${VAR}."
+        "\n"
+        "Input file lines of the form \"#cmakedefine VAR ...\" "
+        "will be replaced with either \"#define VAR ...\" or "
+        "\"/* #undef VAR */\" depending on whether VAR is set in CMake to "
+        "any value not considered a false constant by the if() command. "
+        "(Content of \"...\", if any, is processed as above.) "
+        "Input file lines of the form \"#cmakedefine01 VAR\" "
+        "will be replaced with either \"#define VAR 1\" or "
+        "\"#define VAR 0\" similarly."
+        "\n"
         "With NEWLINE_STYLE the line ending could be adjusted: \n"
         "    'UNIX' or 'LF' for \\n, 'DOS', 'WIN32' or 'CRLF' for \\r\\n.\n"
         "COPYONLY must not be used with NEWLINE_STYLE.\n";

+ 9 - 0
Source/cmDocumentVariables.cxx

@@ -1230,6 +1230,15 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      false,
      "Variables that Control the Build");
 
+  cm->DefineProperty
+    ("CMAKE_LINK_DEPENDS_NO_SHARED", cmProperty::VARIABLE,
+     "Whether to skip link dependencies on shared library files.",
+     "This variable initializes the LINK_DEPENDS_NO_SHARED "
+     "property on targets when they are created.  "
+     "See that target property for additional information.",
+     false,
+     "Variables that Control the Build");
+
   cm->DefineProperty
     ("CMAKE_AUTOMOC", cmProperty::VARIABLE,
      "Whether to handle moc automatically for Qt targets.",

+ 2 - 1
Source/cmFileCommand.h

@@ -89,7 +89,8 @@ public:
       "       [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n"
       "WRITE will write a message into a file called 'filename'. It "
       "overwrites the file if it already exists, and creates the file "
-      "if it does not exist.\n"
+      "if it does not exist. (If the file is a build input, use "
+      "configure_file to update the file only when its content changes.)\n"
       "APPEND will write a message into a file same as WRITE, except "
       "it will append it to the end of the file\n"
       "READ will read the content of a file and store it into the "

+ 3 - 1
Source/cmFunctionCommand.h

@@ -90,7 +90,9 @@ public:
       "will have the actual values of the arguments passed in. This "
       "facilitates creating functions with optional arguments. Additionally "
       "ARGV holds the list of all arguments given to the function and ARGN "
-      "holds the list of argument past the last expected argument."
+      "holds the list of arguments past the last expected argument."
+      "\n"
+      "A function opens a new scope: see set(var PARENT_SCOPE) for details."
       "\n"
       "See the cmake_policy() command documentation for the behavior of "
       "policies inside functions."

+ 2 - 2
Source/cmGlobalBorlandMakefileGenerator.cxx

@@ -55,9 +55,9 @@ cmLocalGenerator *cmGlobalBorlandMakefileGenerator::CreateLocalGenerator()
 
 //----------------------------------------------------------------------------
 void cmGlobalBorlandMakefileGenerator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalBorlandMakefileGenerator::GetActualName();
   entry.Brief = "Generates Borland makefiles.";
   entry.Full = "";
 }

+ 4 - 3
Source/cmGlobalBorlandMakefileGenerator.h

@@ -23,8 +23,9 @@ class cmGlobalBorlandMakefileGenerator : public cmGlobalNMakeMakefileGenerator
 {
 public:
   cmGlobalBorlandMakefileGenerator();
-  static cmGlobalGenerator* New()
-    { return new cmGlobalBorlandMakefileGenerator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalBorlandMakefileGenerator>(); }
 
   ///! Get the name for the generator.
   virtual const char* GetName() const {
@@ -32,7 +33,7 @@ public:
   static const char* GetActualName() {return "Borland Makefiles";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();

+ 1 - 8
Source/cmGlobalGenerator.cxx

@@ -828,6 +828,7 @@ void cmGlobalGenerator::Configure()
   this->LocalGenerators.clear();
   this->TargetDependencies.clear();
   this->TotalTargets.clear();
+  this->ImportedTargets.clear();
   this->LocalGeneratorToTargetMap.clear();
   this->ProjectMap.clear();
   this->RuleHashes.clear();
@@ -1555,14 +1556,6 @@ void cmGlobalGenerator::SetConfiguredFilesPath(cmGlobalGenerator* gen)
     }
 }
 
-//----------------------------------------------------------------------------
-void cmGlobalGenerator::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "";
-  entry.Full = "";
-}
-
 bool cmGlobalGenerator::IsExcluded(cmLocalGenerator* root,
                                    cmLocalGenerator* gen)
 {

+ 0 - 3
Source/cmGlobalGenerator.h

@@ -49,9 +49,6 @@ public:
   ///! Get the name for this generator
   virtual const char *GetName() const { return "Generic"; };
 
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
   /**
    * Create LocalGenerators and process the CMakeLists files. This does not
    * actually produce any makefiles, DSPs, etc.

+ 59 - 0
Source/cmGlobalGeneratorFactory.h

@@ -0,0 +1,59 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2012 Kitware, Inc., Insight Software Consortium
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmGlobalGeneratorFactory_h
+#define cmGlobalGeneratorFactory_h
+
+#include "cmStandardIncludes.h"
+
+class cmGlobalGenerator;
+struct cmDocumentationEntry;
+
+/** \class cmGlobalGeneratorFactory
+ * \brief Responable for creating cmGlobalGenerator instances
+ *
+ * Subclasses of this class generate instances of cmGlobalGenerator.
+ */
+class cmGlobalGeneratorFactory
+{
+public:
+  virtual ~cmGlobalGeneratorFactory() {}
+
+  /** Create a GlobalGenerator */
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* n) const = 0;
+
+  /** Get the documentation entry for this factory */
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const = 0;
+
+  /** Get the names of the current registered generators */
+  virtual void GetGenerators(std::vector<std::string>& names) const = 0;
+};
+
+template<class T>
+class cmGlobalGeneratorSimpleFactory : public cmGlobalGeneratorFactory
+{
+public:
+  /** Create a GlobalGenerator */
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
+    if (strcmp(name, T::GetActualName())) return 0;
+    return new T; }
+
+  /** Get the documentation entry for this factory */
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const {
+    T::GetDocumentation(entry); }
+
+  /** Get the names of the current registered generators */
+  virtual void GetGenerators(std::vector<std::string>& names) const {
+    names.push_back(T::GetActualName()); }
+};
+
+#endif

+ 2 - 2
Source/cmGlobalJOMMakefileGenerator.cxx

@@ -61,9 +61,9 @@ cmLocalGenerator *cmGlobalJOMMakefileGenerator::CreateLocalGenerator()
 
 //----------------------------------------------------------------------------
 void cmGlobalJOMMakefileGenerator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalJOMMakefileGenerator::GetActualName();
   entry.Brief = "Generates JOM makefiles.";
   entry.Full = "";
 }

+ 4 - 3
Source/cmGlobalJOMMakefileGenerator.h

@@ -23,8 +23,9 @@ class cmGlobalJOMMakefileGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
   cmGlobalJOMMakefileGenerator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalJOMMakefileGenerator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalJOMMakefileGenerator>(); }
   ///! Get the name for the generator.
   virtual const char* GetName() const {
     return cmGlobalJOMMakefileGenerator::GetActualName();}
@@ -33,7 +34,7 @@ public:
   static const char* GetActualName() {return "NMake Makefiles JOM";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();

+ 2 - 2
Source/cmGlobalMSYSMakefileGenerator.cxx

@@ -106,9 +106,9 @@ cmLocalGenerator *cmGlobalMSYSMakefileGenerator::CreateLocalGenerator()
 
 //----------------------------------------------------------------------------
 void cmGlobalMSYSMakefileGenerator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalMSYSMakefileGenerator::GetActualName();
   entry.Brief = "Generates MSYS makefiles.";
   entry.Full = "The makefiles use /bin/sh as the shell.  "
     "They require msys to be installed on the machine.";

+ 4 - 3
Source/cmGlobalMSYSMakefileGenerator.h

@@ -23,8 +23,9 @@ class cmGlobalMSYSMakefileGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
   cmGlobalMSYSMakefileGenerator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalMSYSMakefileGenerator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalMSYSMakefileGenerator>(); }
 
   ///! Get the name for the generator.
   virtual const char* GetName() const {
@@ -32,7 +33,7 @@ public:
   static const char* GetActualName() {return "MSYS Makefiles";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();

+ 2 - 2
Source/cmGlobalMinGWMakefileGenerator.cxx

@@ -71,9 +71,9 @@ cmLocalGenerator *cmGlobalMinGWMakefileGenerator::CreateLocalGenerator()
 
 //----------------------------------------------------------------------------
 void cmGlobalMinGWMakefileGenerator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalMinGWMakefileGenerator::GetActualName();
   entry.Brief = "Generates a make file for use with mingw32-make.";
   entry.Full = "The makefiles generated use cmd.exe as the shell.  "
     "They do not require msys or a unix shell.";

+ 4 - 3
Source/cmGlobalMinGWMakefileGenerator.h

@@ -23,15 +23,16 @@ class cmGlobalMinGWMakefileGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
   cmGlobalMinGWMakefileGenerator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalMinGWMakefileGenerator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalMinGWMakefileGenerator>(); }
   ///! Get the name for the generator.
   virtual const char* GetName() const {
     return cmGlobalMinGWMakefileGenerator::GetActualName();}
   static const char* GetActualName() {return "MinGW Makefiles";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();

+ 2 - 2
Source/cmGlobalNMakeMakefileGenerator.cxx

@@ -61,9 +61,9 @@ cmLocalGenerator *cmGlobalNMakeMakefileGenerator::CreateLocalGenerator()
 
 //----------------------------------------------------------------------------
 void cmGlobalNMakeMakefileGenerator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalNMakeMakefileGenerator::GetActualName();
   entry.Brief = "Generates NMake makefiles.";
   entry.Full = "";
 }

+ 4 - 3
Source/cmGlobalNMakeMakefileGenerator.h

@@ -23,15 +23,16 @@ class cmGlobalNMakeMakefileGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
   cmGlobalNMakeMakefileGenerator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalNMakeMakefileGenerator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalNMakeMakefileGenerator>(); }
   ///! Get the name for the generator.
   virtual const char* GetName() const {
     return cmGlobalNMakeMakefileGenerator::GetActualName();}
   static const char* GetActualName() {return "NMake Makefiles";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();

+ 2 - 2
Source/cmGlobalNinjaGenerator.cxx

@@ -452,9 +452,9 @@ cmLocalGenerator* cmGlobalNinjaGenerator::CreateLocalGenerator()
 }
 
 void cmGlobalNinjaGenerator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalNinjaGenerator::GetActualName();
   entry.Brief = "Generates build.ninja files (experimental).";
   entry.Full =
     "A build.ninja file is generated into the build tree. Recent "

+ 4 - 3
Source/cmGlobalNinjaGenerator.h

@@ -14,6 +14,7 @@
 #  define cmGlobalNinjaGenerator_h
 
 #  include "cmGlobalGenerator.h"
+#  include "cmGlobalGeneratorFactory.h"
 #  include "cmNinjaTypes.h"
 
 //#define NINJA_GEN_VERBOSE_FILES
@@ -160,8 +161,8 @@ public:
   cmGlobalNinjaGenerator();
 
   /// Convenience method for creating an instance of this class.
-  static cmGlobalGenerator* New() {
-    return new cmGlobalNinjaGenerator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory<cmGlobalNinjaGenerator>(); }
 
   /// Destructor.
   virtual ~cmGlobalNinjaGenerator() { }
@@ -177,7 +178,7 @@ public:
   static const char* GetActualName() { return "Ninja"; }
 
   /// Overloaded methods. @see cmGlobalGenerator::GetDocumentation()
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   /// Overloaded methods. @see cmGlobalGenerator::Generate()
   virtual void Generate();

+ 2 - 2
Source/cmGlobalUnixMakefileGenerator3.cxx

@@ -61,9 +61,9 @@ cmLocalGenerator *cmGlobalUnixMakefileGenerator3::CreateLocalGenerator()
 
 //----------------------------------------------------------------------------
 void cmGlobalUnixMakefileGenerator3
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalUnixMakefileGenerator3::GetActualName();
   entry.Brief = "Generates standard UNIX makefiles.";
   entry.Full =
     "A hierarchy of UNIX makefiles is generated into the build tree.  Any "

+ 5 - 3
Source/cmGlobalUnixMakefileGenerator3.h

@@ -13,6 +13,7 @@
 #define cmGlobalUnixMakefileGenerator3_h
 
 #include "cmGlobalGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
 
 class cmGeneratedFileStream;
 class cmMakefileTargetGenerator;
@@ -54,8 +55,9 @@ class cmGlobalUnixMakefileGenerator3 : public cmGlobalGenerator
 {
 public:
   cmGlobalUnixMakefileGenerator3();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalUnixMakefileGenerator3; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalUnixMakefileGenerator3>(); }
 
   ///! Get the name for the generator.
   virtual const char* GetName() const {
@@ -63,7 +65,7 @@ public:
   static const char* GetActualName() {return "Unix Makefiles";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator3
   virtual cmLocalGenerator *CreateLocalGenerator();

+ 62 - 10
Source/cmGlobalVisualStudio10Generator.cxx

@@ -16,8 +16,61 @@
 #include "cmSourceFile.h"
 #include "cmake.h"
 
+static const char vs10Win32generatorName[] = "Visual Studio 10";
+static const char vs10Win64generatorName[] = "Visual Studio 10 Win64";
+static const char vs10IA64generatorName[] = "Visual Studio 10 IA64";
 
-cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator()
+class cmGlobalVisualStudio10Generator::Factory
+  : public cmGlobalGeneratorFactory
+{
+public:
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
+    if(!strcmp(name, vs10Win32generatorName))
+      {
+      return new cmGlobalVisualStudio10Generator(
+        vs10Win32generatorName, NULL, NULL);
+      }
+    if(!strcmp(name, vs10Win64generatorName))
+      {
+      return new cmGlobalVisualStudio10Generator(
+        vs10Win64generatorName, "x64", "CMAKE_FORCE_WIN64");
+      }
+    if(!strcmp(name, vs10IA64generatorName))
+      {
+      return new cmGlobalVisualStudio10Generator(
+        vs10IA64generatorName, "Itanium", "CMAKE_FORCE_IA64");
+      }
+    return 0;
+  }
+
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const {
+    entry.Name = "Visual Studio 10";
+    entry.Brief = "Generates Visual Studio 10 project files.";
+    entry.Full =
+      "It is possible to append a space followed by the platform name "
+      "to create project files for a specific target platform. E.g. "
+      "\"Visual Studio 10 Win64\" will create project files for "
+      "the x64 processor; \"Visual Studio 10 IA64\" for Itanium.";
+  }
+
+  virtual void GetGenerators(std::vector<std::string>& names) const {
+    names.push_back(vs10Win32generatorName);
+    names.push_back(vs10Win64generatorName);
+    names.push_back(vs10IA64generatorName); }
+};
+
+//----------------------------------------------------------------------------
+cmGlobalGeneratorFactory* cmGlobalVisualStudio10Generator::NewFactory()
+{
+  return new Factory;
+}
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio10Generator::cmGlobalVisualStudio10Generator(
+  const char* name, const char* architectureId,
+  const char* additionalPlatformDefinition)
+  : cmGlobalVisualStudio8Generator(name, architectureId,
+                                   additionalPlatformDefinition)
 {
   this->FindMakeProgramFile = "CMakeVS10FindMake.cmake";
   std::string vc10Express;
@@ -86,20 +139,19 @@ void cmGlobalVisualStudio10Generator::Generate()
     }
 }
 
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio10Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 10 project files.";
-  entry.Full = "";
-}
-
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio10Generator
 ::EnableLanguage(std::vector<std::string>const &  lang,
                  cmMakefile *mf, bool optional)
 {
+  if(!strcmp(this->ArchitectureId, "Itanium") ||
+     !strcmp(this->ArchitectureId, "x64"))
+    {
+    if(this->IsExpressEdition() && !this->Find64BitTools(mf))
+      {
+      return;
+      }
+    }
   cmGlobalVisualStudio8Generator::EnableLanguage(lang, mf, optional);
 }
 

+ 4 - 10
Source/cmGlobalVisualStudio10Generator.h

@@ -24,9 +24,9 @@ class cmGlobalVisualStudio10Generator :
   public cmGlobalVisualStudio8Generator
 {
 public:
-  cmGlobalVisualStudio10Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio10Generator; }
+  cmGlobalVisualStudio10Generator(const char* name,
+    const char* architectureId, const char* additionalPlatformDefinition);
+  static cmGlobalGeneratorFactory* NewFactory();
 
   virtual std::string
   GenerateBuildCommand(const char* makeProgram,
@@ -34,15 +34,8 @@ public:
                        const char* additionalOptions, const char *targetName,
                        const char* config, bool ignoreErrors, bool);
 
-  ///! Get the name for the generator.
-  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;
-
   ///! create the correct local generator
   virtual cmLocalGenerator *CreateLocalGenerator();
 
@@ -92,6 +85,7 @@ protected:
   bool UseFolderProperty();
 
 private:
+  class Factory;
   struct LongestSourcePath
   {
     LongestSourcePath(): Length(0), Target(0), SourceFile(0) {}

+ 0 - 50
Source/cmGlobalVisualStudio10IA64Generator.cxx

@@ -1,50 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "cmGlobalVisualStudio10IA64Generator.h"
-#include "cmMakefile.h"
-#include "cmake.h"
-
-//----------------------------------------------------------------------------
-cmGlobalVisualStudio10IA64Generator::cmGlobalVisualStudio10IA64Generator()
-{
-  this->ArchitectureId = "x64";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio10IA64Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 10 Itanium project files.";
-  entry.Full = "";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio10IA64Generator
-::AddPlatformDefinitions(cmMakefile* mf)
-{
-  this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf);
-  mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio10IA64Generator
-::EnableLanguage(std::vector<std::string> const& languages,
-                 cmMakefile* mf, bool optional)
-{
-  if(this->IsExpressEdition() && !this->Find64BitTools(mf))
-    {
-    return;
-    }
-  this->cmGlobalVisualStudio10Generator
-    ::EnableLanguage(languages, mf, optional);
-}

+ 0 - 40
Source/cmGlobalVisualStudio10IA64Generator.h

@@ -1,40 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef cmGlobalVisualStudio10IA64Generator_h
-#define cmGlobalVisualStudio10IA64Generator_h
-
-#include "cmGlobalVisualStudio10Generator.h"
-
-class cmGlobalVisualStudio10IA64Generator :
-  public cmGlobalVisualStudio10Generator
-{
-public:
-  cmGlobalVisualStudio10IA64Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio10IA64Generator; }
-
-  ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio10IA64Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 10 IA64";}
-
-  virtual const char* GetPlatformName() const {return "Itanium";}
-
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
-  virtual void AddPlatformDefinitions(cmMakefile* mf);
-
-  virtual void EnableLanguage(std::vector<std::string>const& languages,
-                              cmMakefile *, bool optional);
-};
-#endif

+ 0 - 50
Source/cmGlobalVisualStudio10Win64Generator.cxx

@@ -1,50 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "cmGlobalVisualStudio10Win64Generator.h"
-#include "cmMakefile.h"
-#include "cmake.h"
-
-//----------------------------------------------------------------------------
-cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator()
-{
-  this->ArchitectureId = "x64";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio10Win64Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 10 Win64 project files.";
-  entry.Full = "";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio10Win64Generator
-::AddPlatformDefinitions(cmMakefile* mf)
-{
-  this->cmGlobalVisualStudio10Generator::AddPlatformDefinitions(mf);
-  mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio10Win64Generator
-::EnableLanguage(std::vector<std::string> const& languages,
-                 cmMakefile* mf, bool optional)
-{
-  if(this->IsExpressEdition() && !this->Find64BitTools(mf))
-    {
-    return;
-    }
-  this->cmGlobalVisualStudio10Generator
-    ::EnableLanguage(languages, mf, optional);
-}

+ 0 - 40
Source/cmGlobalVisualStudio10Win64Generator.h

@@ -1,40 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef cmGlobalVisualStudio10Win64Generator_h
-#define cmGlobalVisualStudio10Win64Generator_h
-
-#include "cmGlobalVisualStudio10Generator.h"
-
-class cmGlobalVisualStudio10Win64Generator :
-  public cmGlobalVisualStudio10Generator
-{
-public:
-  cmGlobalVisualStudio10Win64Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio10Win64Generator; }
-
-  ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio10Win64Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 10 Win64";}
-
-  virtual const char* GetPlatformName() const {return "x64";}
-
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
-  virtual void AddPlatformDefinitions(cmMakefile* mf);
-
-  virtual void EnableLanguage(std::vector<std::string>const& languages,
-                              cmMakefile *, bool optional);
-};
-#endif

+ 0 - 29
Source/cmGlobalVisualStudio11ARMGenerator.cxx

@@ -1,29 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "cmGlobalVisualStudio11ARMGenerator.h"
-#include "cmMakefile.h"
-#include "cmake.h"
-
-//----------------------------------------------------------------------------
-cmGlobalVisualStudio11ARMGenerator::cmGlobalVisualStudio11ARMGenerator()
-{
-  this->ArchitectureId = "ARM";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio11ARMGenerator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 11 ARM project files.";
-  entry.Full = "";
-}

+ 0 - 35
Source/cmGlobalVisualStudio11ARMGenerator.h

@@ -1,35 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef cmGlobalVisualStudio11ARMGenerator_h
-#define cmGlobalVisualStudio11ARMGenerator_h
-
-#include "cmGlobalVisualStudio11Generator.h"
-
-class cmGlobalVisualStudio11ARMGenerator :
-  public cmGlobalVisualStudio11Generator
-{
-public:
-  cmGlobalVisualStudio11ARMGenerator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio11ARMGenerator; }
-
-  ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio11ARMGenerator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 11 ARM";}
-
-  virtual const char* GetPlatformName() const {return "ARM";}
-
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-};
-#endif

+ 54 - 10
Source/cmGlobalVisualStudio11Generator.cxx

@@ -13,8 +13,61 @@
 #include "cmLocalVisualStudio10Generator.h"
 #include "cmMakefile.h"
 
+static const char vs11Win32generatorName[] = "Visual Studio 11";
+static const char vs11Win64generatorName[] = "Visual Studio 11 Win64";
+static const char vs11ARMgeneratorName[] = "Visual Studio 11 ARM";
+
+class cmGlobalVisualStudio11Generator::Factory
+  : public cmGlobalGeneratorFactory
+{
+public:
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
+    if(!strcmp(name, vs11Win32generatorName))
+      {
+      return new cmGlobalVisualStudio11Generator(
+        vs11Win32generatorName, NULL, NULL);
+      }
+    if(!strcmp(name, vs11Win64generatorName))
+      {
+      return new cmGlobalVisualStudio11Generator(
+        vs11Win64generatorName, "x64", "CMAKE_FORCE_WIN64");
+      }
+    if(!strcmp(name, vs11ARMgeneratorName))
+      {
+      return new cmGlobalVisualStudio11Generator(
+        vs11ARMgeneratorName, "ARM", NULL);
+      }
+    return 0;
+  }
+
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const {
+    entry.Name = "Visual Studio 11";
+    entry.Brief = "Generates Visual Studio 11 project files.";
+    entry.Full =
+      "It is possible to append a space followed by the platform name "
+      "to create project files for a specific target platform. E.g. "
+      "\"Visual Studio 11 Win64\" will create project files for "
+      "the x64 processor; \"Visual Studio 11 ARM\" for ARM.";
+  }
+
+  virtual void GetGenerators(std::vector<std::string>& names) const {
+    names.push_back(vs11Win32generatorName);
+    names.push_back(vs11Win64generatorName);
+    names.push_back(vs11ARMgeneratorName); }
+};
+
 //----------------------------------------------------------------------------
-cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator()
+cmGlobalGeneratorFactory* cmGlobalVisualStudio11Generator::NewFactory()
+{
+  return new Factory;
+}
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio11Generator::cmGlobalVisualStudio11Generator(
+  const char* name, const char* architectureId,
+  const char* additionalPlatformDefinition)
+  : cmGlobalVisualStudio10Generator(name, architectureId,
+                                   additionalPlatformDefinition)
 {
   this->FindMakeProgramFile = "CMakeVS11FindMake.cmake";
   std::string vc11Express;
@@ -40,12 +93,3 @@ cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator()
   lg->SetGlobalGenerator(this);
   return lg;
 }
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio11Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 11 project files.";
-  entry.Full = "";
-}

+ 5 - 11
Source/cmGlobalVisualStudio11Generator.h

@@ -20,20 +20,12 @@ class cmGlobalVisualStudio11Generator:
   public cmGlobalVisualStudio10Generator
 {
 public:
-  cmGlobalVisualStudio11Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio11Generator; }
-
-  ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio11Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 11";}
+  cmGlobalVisualStudio11Generator(const char* name,
+    const char* architectureId, const char* additionalPlatformDefinition);
+  static cmGlobalGeneratorFactory* NewFactory();
 
   virtual void WriteSLNHeader(std::ostream& fout);
 
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
   ///! create the correct local generator
   virtual cmLocalGenerator *CreateLocalGenerator();
 
@@ -41,5 +33,7 @@ public:
   virtual std::string GetUserMacrosDirectory() { return ""; }
 protected:
   virtual const char* GetIDEVersion() { return "11.0"; }
+private:
+  class Factory;
 };
 #endif

+ 0 - 37
Source/cmGlobalVisualStudio11Win64Generator.cxx

@@ -1,37 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "cmGlobalVisualStudio11Win64Generator.h"
-#include "cmMakefile.h"
-#include "cmake.h"
-
-//----------------------------------------------------------------------------
-cmGlobalVisualStudio11Win64Generator::cmGlobalVisualStudio11Win64Generator()
-{
-  this->ArchitectureId = "x64";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio11Win64Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 11 Win64 project files.";
-  entry.Full = "";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio11Win64Generator
-::AddPlatformDefinitions(cmMakefile* mf)
-{
-  this->cmGlobalVisualStudio11Generator::AddPlatformDefinitions(mf);
-  mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
-}

+ 0 - 37
Source/cmGlobalVisualStudio11Win64Generator.h

@@ -1,37 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2011 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef cmGlobalVisualStudio11Win64Generator_h
-#define cmGlobalVisualStudio11Win64Generator_h
-
-#include "cmGlobalVisualStudio11Generator.h"
-
-class cmGlobalVisualStudio11Win64Generator :
-  public cmGlobalVisualStudio11Generator
-{
-public:
-  cmGlobalVisualStudio11Win64Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio11Win64Generator; }
-
-  ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio11Win64Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 11 Win64";}
-
-  virtual const char* GetPlatformName() const {return "x64";}
-
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
-  virtual void AddPlatformDefinitions(cmMakefile* mf);
-};
-#endif

+ 2 - 3
Source/cmGlobalVisualStudio6Generator.cxx

@@ -200,7 +200,6 @@ void cmGlobalVisualStudio6Generator
       tt != orderedProjectTargets.end(); ++tt)
     {
     cmTarget* target = *tt;
-    cmMakefile* mf = target->GetMakefile();
     // Write the project into the DSW file
     const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
     if(expath)
@@ -398,9 +397,9 @@ cmGlobalVisualStudio6Generator::WriteUtilityDepend(cmTarget* target)
 
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio6Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalVisualStudio6Generator::GetActualName();
   entry.Brief = "Generates Visual Studio 6 project files.";
   entry.Full = "";
 }

+ 5 - 3
Source/cmGlobalVisualStudio6Generator.h

@@ -13,6 +13,7 @@
 #define cmGlobalVisualStudio6Generator_h
 
 #include "cmGlobalVisualStudioGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
 
 class cmTarget;
 
@@ -25,8 +26,9 @@ class cmGlobalVisualStudio6Generator : public cmGlobalVisualStudioGenerator
 {
 public:
   cmGlobalVisualStudio6Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio6Generator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalVisualStudio6Generator>(); }
 
   ///! Get the name for the generator.
   virtual const char* GetName() const {
@@ -34,7 +36,7 @@ public:
   static const char* GetActualName() {return "Visual Studio 6";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();

+ 12 - 17
Source/cmGlobalVisualStudio71Generator.cxx

@@ -128,6 +128,9 @@ void cmGlobalVisualStudio71Generator
     fout << "\tEndGlobalSection\n";
     }
 
+  // Write out global sections
+  this->WriteSLNGlobalSections(fout, root);
+
   // Write the footer for the SLN file
   this->WriteSLNFooter(fout);
 }
@@ -273,9 +276,10 @@ void cmGlobalVisualStudio71Generator
 // Write a dsp file into the SLN file, Note, that dependencies from
 // executables to the libraries it uses are also done here
 void cmGlobalVisualStudio71Generator
-::WriteProjectConfigurations(std::ostream& fout, const char* name,
-                             bool partOfDefaultBuild,
-                             const char* platformMapping)
+::WriteProjectConfigurations(
+  std::ostream& fout, const char* name,
+  const std::set<std::string>& configsPartOfDefaultBuild,
+  const char* platformMapping)
 {
   std::string guid = this->GetGUID(name);
   for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -284,7 +288,9 @@ void cmGlobalVisualStudio71Generator
     fout << "\t\t{" << guid << "}." << *i
          << ".ActiveCfg = " << *i << "|"
          << (platformMapping ? platformMapping : "Win32") << std::endl;
-    if(partOfDefaultBuild)
+    std::set<std::string>::const_iterator
+      ci = configsPartOfDefaultBuild.find(*i);
+    if(!(ci == configsPartOfDefaultBuild.end()))
       {
       fout << "\t\t{" << guid << "}." << *i
            << ".Build.0 = " << *i << "|"
@@ -293,17 +299,6 @@ void cmGlobalVisualStudio71Generator
     }
 }
 
-//----------------------------------------------------------------------------
-// Standard end of dsw file
-void cmGlobalVisualStudio71Generator::WriteSLNFooter(std::ostream& fout)
-{
-  fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n"
-       << "\tEndGlobalSection\n"
-       << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n"
-       << "\tEndGlobalSection\n"
-       << "EndGlobal\n";
-}
-
 //----------------------------------------------------------------------------
 // ouput standard header for dsw file
 void cmGlobalVisualStudio71Generator::WriteSLNHeader(std::ostream& fout)
@@ -313,9 +308,9 @@ void cmGlobalVisualStudio71Generator::WriteSLNHeader(std::ostream& fout)
 
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio71Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalVisualStudio71Generator::GetActualName();
   entry.Brief = "Generates Visual Studio .NET 2003 project files.";
   entry.Full = "";
 }

+ 8 - 8
Source/cmGlobalVisualStudio71Generator.h

@@ -24,8 +24,9 @@ class cmGlobalVisualStudio71Generator : public cmGlobalVisualStudio7Generator
 {
 public:
   cmGlobalVisualStudio71Generator();
-  static cmGlobalGenerator* New()
-    { return new cmGlobalVisualStudio71Generator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalVisualStudio71Generator>(); }
 
   ///! Get the name for the generator.
   virtual const char* GetName() const {
@@ -33,7 +34,7 @@ public:
   static const char* GetActualName() {return "Visual Studio 7 .NET 2003";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();
@@ -61,16 +62,15 @@ protected:
                             const char* name, const char* path, cmTarget &t);
   virtual void WriteProjectDepends(std::ostream& fout,
                            const char* name, const char* path, cmTarget &t);
-  virtual void WriteProjectConfigurations(std::ostream& fout,
-                                          const char* name,
-                                          bool partOfDefaultBuild,
-                                          const char* platformMapping = NULL);
+  virtual void WriteProjectConfigurations(
+    std::ostream& fout, const char* name,
+    const std::set<std::string>& configsPartOfDefaultBuild,
+    const char* platformMapping = NULL);
   virtual void WriteExternalProject(std::ostream& fout,
                                     const char* name,
                                     const char* path,
                                     const char* typeGuid,
                                     const std::set<cmStdString>& depends);
-  virtual void WriteSLNFooter(std::ostream& fout);
   virtual void WriteSLNHeader(std::ostream& fout);
 
   std::string ProjectConfigurationSectionName;

+ 103 - 26
Source/cmGlobalVisualStudio7Generator.cxx

@@ -10,6 +10,7 @@
   See the License for more information.
 ============================================================================*/
 #include "windows.h" // this must be first to define GetCurrentDirectory
+#include <assert.h>
 #include "cmGlobalVisualStudio7Generator.h"
 #include "cmGeneratedFileStream.h"
 #include "cmLocalVisualStudio7Generator.h"
@@ -243,20 +244,23 @@ void cmGlobalVisualStudio7Generator::WriteTargetConfigurations(
     const char* expath = target->GetProperty("EXTERNAL_MSPROJECT");
     if(expath)
       {
+      std::set<std::string> allConfigurations(this->Configurations.begin(),
+                                              this->Configurations.end());
       this->WriteProjectConfigurations(
         fout, target->GetName(),
-        true, target->GetProperty("VS_PLATFORM_MAPPING"));
+        allConfigurations, target->GetProperty("VS_PLATFORM_MAPPING"));
       }
     else
       {
-      bool partOfDefaultBuild = this->IsPartOfDefaultBuild(
-        root->GetMakefile()->GetProjectName(), target);
+      const std::set<std::string>& configsPartOfDefaultBuild =
+        this->IsPartOfDefaultBuild(root->GetMakefile()->GetProjectName(),
+                                   target);
       const char *vcprojName =
         target->GetProperty("GENERATOR_FILE_NAME");
       if (vcprojName)
         {
         this->WriteProjectConfigurations(fout, vcprojName,
-                                         partOfDefaultBuild);
+                                         configsPartOfDefaultBuild);
         }
       }
     }
@@ -431,6 +435,9 @@ void cmGlobalVisualStudio7Generator
   this->WriteTargetConfigurations(fout, root, orderedProjectTargets);
   fout << "\tEndGlobalSection\n";
 
+  // Write out global sections
+  this->WriteSLNGlobalSections(fout, root);
+
   // Write the footer for the SLN file
   this->WriteSLNFooter(fout);
 }
@@ -579,9 +586,10 @@ cmGlobalVisualStudio7Generator
 // Write a dsp file into the SLN file, Note, that dependencies from
 // executables to the libraries it uses are also done here
 void cmGlobalVisualStudio7Generator
-::WriteProjectConfigurations(std::ostream& fout, const char* name,
-                             bool partOfDefaultBuild,
-                             const char* platformMapping)
+::WriteProjectConfigurations(
+  std::ostream& fout, const char* name,
+  const std::set<std::string>& configsPartOfDefaultBuild,
+  const char* platformMapping)
 {
   std::string guid = this->GetGUID(name);
   for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -590,7 +598,9 @@ void cmGlobalVisualStudio7Generator
     fout << "\t\t{" << guid << "}." << *i
          << ".ActiveCfg = " << *i << "|"
          << (platformMapping ? platformMapping : "Win32") << "\n";
-    if(partOfDefaultBuild)
+      std::set<std::string>::const_iterator
+        ci = configsPartOfDefaultBuild.find(*i);
+      if(!(ci == configsPartOfDefaultBuild.end()))
       {
       fout << "\t\t{" << guid << "}." << *i
            << ".Build.0 = " << *i << "|"
@@ -624,14 +634,73 @@ void cmGlobalVisualStudio7Generator::WriteExternalProject(std::ostream& fout,
 
 
 
+void cmGlobalVisualStudio7Generator
+::WriteSLNGlobalSections(std::ostream& fout,
+                         cmLocalGenerator* root)
+{
+  bool extensibilityGlobalsOverridden = false;
+  bool extensibilityAddInsOverridden = false;
+  const cmPropertyMap& props = root->GetMakefile()->GetProperties();
+  for(cmPropertyMap::const_iterator itProp = props.begin();
+      itProp != props.end(); ++itProp)
+    {
+    if(itProp->first.find("VS_GLOBAL_SECTION_") == 0)
+      {
+      std::string sectionType;
+      std::string name = itProp->first.substr(18);
+      if(name.find("PRE_") == 0)
+        {
+        name = name.substr(4);
+        sectionType = "preSolution";
+        }
+      else if(name.find("POST_") == 0)
+        {
+        name = name.substr(5);
+        sectionType = "postSolution";
+        }
+      else
+        continue;
+      if(!name.empty())
+        {
+        if(name == "ExtensibilityGlobals" && sectionType == "postSolution")
+          extensibilityGlobalsOverridden = true;
+        else if(name == "ExtensibilityAddIns" && sectionType == "postSolution")
+          extensibilityAddInsOverridden = true;
+        fout << "\tGlobalSection(" << name << ") = " << sectionType << "\n";
+        std::vector<std::string> keyValuePairs;
+        cmSystemTools::ExpandListArgument(itProp->second.GetValue(),
+                                          keyValuePairs);
+        for(std::vector<std::string>::const_iterator itPair =
+            keyValuePairs.begin(); itPair != keyValuePairs.end(); ++itPair)
+          {
+          const std::string::size_type posEqual = itPair->find('=');
+          if(posEqual != std::string::npos)
+            {
+            const std::string key =
+              cmSystemTools::TrimWhitespace(itPair->substr(0, posEqual));
+            const std::string value =
+              cmSystemTools::TrimWhitespace(itPair->substr(posEqual + 1));
+            fout << "\t\t" << key << " = " << value << "\n";
+            }
+          }
+        fout << "\tEndGlobalSection\n";
+        }
+      }
+    }
+  if(!extensibilityGlobalsOverridden)
+    fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n"
+         << "\tEndGlobalSection\n";
+  if(!extensibilityAddInsOverridden)
+    fout << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n"
+         << "\tEndGlobalSection\n";
+}
+
+
+
 // Standard end of dsw file
 void cmGlobalVisualStudio7Generator::WriteSLNFooter(std::ostream& fout)
 {
-  fout << "\tGlobalSection(ExtensibilityGlobals) = postSolution\n"
-       << "\tEndGlobalSection\n"
-       << "\tGlobalSection(ExtensibilityAddIns) = postSolution\n"
-       << "\tEndGlobalSection\n"
-       << "EndGlobal\n";
+  fout << "EndGlobal\n";
 }
 
 
@@ -740,9 +809,9 @@ std::vector<std::string> *cmGlobalVisualStudio7Generator::GetConfigurations()
 
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio7Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalVisualStudio7Generator::GetActualName();
   entry.Brief = "Generates Visual Studio .NET 2002 project files.";
   entry.Full = "";
 }
@@ -763,26 +832,34 @@ cmGlobalVisualStudio7Generator
     }
 }
 
-bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
-                                                          cmTarget* target)
+std::set<std::string>
+cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
+                                                     cmTarget* target)
 {
-  if(target->GetPropertyAsBool("EXCLUDE_FROM_DEFAULT_BUILD"))
-    {
-    return false;
-    }
+  std::set<std::string> activeConfigs;
   // if it is a utilitiy target then only make it part of the
   // default build if another target depends on it
   int type = target->GetType();
   if (type == cmTarget::GLOBAL_TARGET)
     {
-    return false;
+    return activeConfigs;
     }
-  if(type == cmTarget::UTILITY)
+  if(type == cmTarget::UTILITY && !this->IsDependedOn(project, target))
     {
-    return this->IsDependedOn(project, target);
+    return activeConfigs;
+    }
+  // inspect EXCLUDE_FROM_DEFAULT_BUILD[_<CONFIG>] properties
+  for(std::vector<std::string>::iterator i = this->Configurations.begin();
+      i != this->Configurations.end(); ++i)
+    {
+    const char* propertyValue =
+      target->GetFeature("EXCLUDE_FROM_DEFAULT_BUILD", i->c_str());
+    if(cmSystemTools::IsOff(propertyValue))
+      {
+      activeConfigs.insert(*i);
+      }
     }
-  // default is to be part of the build
-  return true;
+  return activeConfigs;
 }
 
 //----------------------------------------------------------------------------

+ 13 - 9
Source/cmGlobalVisualStudio7Generator.h

@@ -13,6 +13,7 @@
 #define cmGlobalVisualStudio7Generator_h
 
 #include "cmGlobalVisualStudioGenerator.h"
+#include "cmGlobalGeneratorFactory.h"
 
 class cmTarget;
 struct cmIDEFlagTable;
@@ -26,8 +27,9 @@ class cmGlobalVisualStudio7Generator : public cmGlobalVisualStudioGenerator
 {
 public:
   cmGlobalVisualStudio7Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio7Generator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalVisualStudio7Generator>(); }
 
   ///! Get the name for the generator.
   virtual const char* GetName() const {
@@ -38,7 +40,7 @@ public:
   virtual cmLocalGenerator *CreateLocalGenerator();
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   /**
    * Try to determine system infomation such as shared library
@@ -105,10 +107,12 @@ protected:
                             const char* name, const char* path, cmTarget &t);
   virtual void WriteProjectDepends(std::ostream& fout,
                            const char* name, const char* path, cmTarget &t);
-  virtual void WriteProjectConfigurations(std::ostream& fout,
-                                          const char* name,
-                                          bool partOfDefaultBuild,
-                                          const char* platformMapping = NULL);
+  virtual void WriteProjectConfigurations(
+    std::ostream& fout, const char* name,
+    const std::set<std::string>& configsPartOfDefaultBuild,
+    const char* platformMapping = NULL);
+  virtual void WriteSLNGlobalSections(std::ostream& fout,
+                                      cmLocalGenerator* root);
   virtual void WriteSLNFooter(std::ostream& fout);
   virtual void WriteSLNHeader(std::ostream& fout);
   virtual std::string WriteUtilityDepend(cmTarget* target);
@@ -136,8 +140,8 @@ protected:
 
   std::string ConvertToSolutionPath(const char* path);
 
-  bool IsPartOfDefaultBuild(const char* project,
-                            cmTarget* target);
+  std::set<std::string> IsPartOfDefaultBuild(const char* project,
+                                             cmTarget* target);
   std::vector<std::string> Configurations;
   std::map<cmStdString, cmStdString> GUIDMap;
 

+ 73 - 8
Source/cmGlobalVisualStudio8Generator.cxx

@@ -16,11 +16,74 @@
 #include "cmake.h"
 #include "cmGeneratedFileStream.h"
 
+static const char vs8Win32generatorName[] = "Visual Studio 8 2005";
+static const char vs8Win64generatorName[] = "Visual Studio 8 2005 Win64";
+
+class cmGlobalVisualStudio8Generator::Factory
+  : public cmGlobalGeneratorFactory
+{
+public:
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
+    if(!strcmp(name, vs8Win32generatorName))
+      {
+      return new cmGlobalVisualStudio8Generator(
+        vs8Win32generatorName, NULL, NULL);
+      }
+    if(!strcmp(name, vs8Win64generatorName))
+      {
+      return new cmGlobalVisualStudio8Generator(
+        vs8Win64generatorName, "x64", "CMAKE_FORCE_WIN64");
+      }
+    return 0;
+  }
+
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const {
+    entry.Name = "Visual Studio 8 2005";
+    entry.Brief = "Generates Visual Studio 8 2005 project files.";
+    entry.Full =
+      "It is possible to append a space followed by the platform name "
+      "to create project files for a specific target platform. E.g. "
+      "\"Visual Studio 8 2005 Win64\" will create project files for "
+      "the x64 processor.";
+  }
+
+  virtual void GetGenerators(std::vector<std::string>& names) const {
+    names.push_back(vs8Win32generatorName);
+    names.push_back(vs8Win64generatorName); }
+};
+
 //----------------------------------------------------------------------------
-cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator()
+cmGlobalGeneratorFactory* cmGlobalVisualStudio8Generator::NewFactory()
+{
+  return new Factory;
+}
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio8Generator::cmGlobalVisualStudio8Generator(
+  const char* name, const char* architectureId,
+  const char* additionalPlatformDefinition)
 {
   this->FindMakeProgramFile = "CMakeVS8FindMake.cmake";
   this->ProjectConfigurationSectionName = "ProjectConfigurationPlatforms";
+  this->Name = name;
+  if (architectureId)
+    {
+    this->ArchitectureId = architectureId;
+    }
+  if (additionalPlatformDefinition)
+    {
+    this->AdditionalPlatformDefinition = additionalPlatformDefinition;
+    }
+}
+
+//----------------------------------------------------------------------------
+const char* cmGlobalVisualStudio8Generator::GetPlatformName() const
+{
+  if (!strcmp(this->ArchitectureId, "X86"))
+    {
+    return "Win32";
+    }
+  return this->ArchitectureId;
 }
 
 //----------------------------------------------------------------------------
@@ -45,9 +108,9 @@ void cmGlobalVisualStudio8Generator::WriteSLNHeader(std::ostream& fout)
 
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio8Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalVisualStudio8Generator::GetActualName();
   entry.Brief = "Generates Visual Studio 8 2005 project files.";
   entry.Full = "";
 }
@@ -204,7 +267,6 @@ void cmGlobalVisualStudio8Generator::AddCheckTarget()
   // overwritten by the CreateVCProjBuildRule.
   // (this could be avoided with per-target source files)
   const char* no_main_dependency = 0;
-  const char* no_working_directory = 0;
   if(cmSourceFile* file =
      mf->AddCustomCommandToOutput(
        stamps, listFiles,
@@ -258,9 +320,10 @@ cmGlobalVisualStudio8Generator
 //----------------------------------------------------------------------------
 void
 cmGlobalVisualStudio8Generator
-::WriteProjectConfigurations(std::ostream& fout, const char* name,
-                             bool partOfDefaultBuild,
-                             const char* platformMapping)
+::WriteProjectConfigurations(
+  std::ostream& fout, const char* name,
+  const std::set<std::string>& configsPartOfDefaultBuild,
+  const char* platformMapping)
 {
   std::string guid = this->GetGUID(name);
   for(std::vector<std::string>::iterator i = this->Configurations.begin();
@@ -270,7 +333,9 @@ cmGlobalVisualStudio8Generator
          << "|" << this->GetPlatformName() << ".ActiveCfg = " << *i << "|"
          << (platformMapping ? platformMapping : this->GetPlatformName())
          << "\n";
-    if(partOfDefaultBuild)
+      std::set<std::string>::const_iterator
+        ci = configsPartOfDefaultBuild.find(*i);
+      if(!(ci == configsPartOfDefaultBuild.end()))
       {
       fout << "\t\t{" << guid << "}." << *i
            << "|" << this->GetPlatformName() << ".Build.0 = " << *i << "|"

+ 15 - 12
Source/cmGlobalVisualStudio8Generator.h

@@ -23,19 +23,17 @@
 class cmGlobalVisualStudio8Generator : public cmGlobalVisualStudio71Generator
 {
 public:
-  cmGlobalVisualStudio8Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio8Generator; }
+  cmGlobalVisualStudio8Generator(const char* name,
+    const char* architectureId, const char* additionalPlatformDefinition);
+  static cmGlobalGeneratorFactory* NewFactory();
 
   ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio8Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 8 2005";}
+  virtual const char* GetName() const {return this->Name;}
 
-  virtual const char* GetPlatformName() const {return "Win32";}
+  const char* GetPlatformName() const;
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();
@@ -74,12 +72,17 @@ protected:
   static cmIDEFlagTable const* GetExtraFlagTableVS8();
   virtual void WriteSLNHeader(std::ostream& fout);
   virtual void WriteSolutionConfigurations(std::ostream& fout);
-  virtual void WriteProjectConfigurations(std::ostream& fout,
-                                          const char* name,
-                                          bool partOfDefaultBuild,
-                                          const char* platformMapping = NULL);
+  virtual void WriteProjectConfigurations(
+    std::ostream& fout, const char* name,
+    const std::set<std::string>& configsPartOfDefaultBuild,
+    const char* platformMapping = NULL);
   virtual bool ComputeTargetDepends();
   virtual void WriteProjectDepends(std::ostream& fout, const char* name,
                                    const char* path, cmTarget &t);
+
+  const char* Name;
+
+private:
+  class Factory;
 };
 #endif

+ 0 - 40
Source/cmGlobalVisualStudio8Win64Generator.cxx

@@ -1,40 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "windows.h" // this must be first to define GetCurrentDirectory
-#include "cmGlobalVisualStudio8Win64Generator.h"
-#include "cmLocalVisualStudio7Generator.h"
-#include "cmMakefile.h"
-#include "cmake.h"
-
-
-
-cmGlobalVisualStudio8Win64Generator::cmGlobalVisualStudio8Win64Generator()
-{
-  this->ArchitectureId = "x64";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio8Win64Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 8 2005 Win64 project files.";
-  entry.Full = "";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio8Win64Generator
-::AddPlatformDefinitions(cmMakefile* mf)
-{
-  this->cmGlobalVisualStudio8Generator::AddPlatformDefinitions(mf);
-  mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
-}

+ 0 - 47
Source/cmGlobalVisualStudio8Win64Generator.h

@@ -1,47 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef cmGlobalVisualStudio8Win64Generator_h
-#define cmGlobalVisualStudio8Win64Generator_h
-
-#include "cmGlobalVisualStudio8Generator.h"
-
-
-/** \class cmGlobalVisualStudio8Win64Generator
- * \brief Write a Unix makefiles.
- *
- * cmGlobalVisualStudio8Win64Generator manages UNIX build process for a tree
- */
-class cmGlobalVisualStudio8Win64Generator :
-  public cmGlobalVisualStudio8Generator
-{
-public:
-  cmGlobalVisualStudio8Win64Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio8Win64Generator; }
-
-  ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio8Win64Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 8 2005 Win64";}
-
-  virtual const char* GetPlatformName() const {return "x64";}
-
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
-  /**
-   * Try to determine system infomation such as shared library
-   * extension, pthreads, byte order etc.
-   */
-  virtual void AddPlatformDefinitions(cmMakefile *);
-};
-#endif

+ 53 - 10
Source/cmGlobalVisualStudio9Generator.cxx

@@ -15,9 +15,61 @@
 #include "cmMakefile.h"
 #include "cmake.h"
 
+static const char vs9Win32generatorName[] = "Visual Studio 9 2008";
+static const char vs9Win64generatorName[] = "Visual Studio 8 2005 Win64";
+static const char vs9IA64generatorName[] = "Visual Studio 9 2008 IA64";
 
+class cmGlobalVisualStudio9Generator::Factory
+  : public cmGlobalGeneratorFactory
+{
+public:
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const {
+    if(!strcmp(name, vs9Win32generatorName))
+      {
+      return new cmGlobalVisualStudio9Generator(
+        vs9Win32generatorName, NULL, NULL);
+      }
+    if(!strcmp(name, vs9Win64generatorName))
+      {
+      return new cmGlobalVisualStudio9Generator(
+        vs9Win64generatorName, "x64", "CMAKE_FORCE_WIN64");
+      }
+    if(!strcmp(name, vs9IA64generatorName))
+      {
+      return new cmGlobalVisualStudio9Generator(
+        vs9IA64generatorName, "Itanium", "CMAKE_FORCE_IA64");
+      }
+    return 0;
+  }
+
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const {
+    entry.Name = "Visual Studio 9 2008";
+    entry.Brief = "Generates Visual Studio 9 2008 project files.";
+    entry.Full =
+      "It is possible to append a space followed by the platform name "
+      "to create project files for a specific target platform. E.g. "
+      "\"Visual Studio 9 2008 Win64\" will create project files for "
+      "the x64 processor; \"Visual Studio 9 2008 IA64\" for Itanium.";
+  }
 
-cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator()
+  virtual void GetGenerators(std::vector<std::string>& names) const {
+    names.push_back(vs9Win32generatorName);
+    names.push_back(vs9Win64generatorName);
+    names.push_back(vs9IA64generatorName); }
+};
+
+//----------------------------------------------------------------------------
+cmGlobalGeneratorFactory* cmGlobalVisualStudio9Generator::NewFactory()
+{
+  return new Factory;
+}
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio9Generator::cmGlobalVisualStudio9Generator(
+  const char* name, const char* architectureId,
+  const char* additionalPlatformDefinition)
+  : cmGlobalVisualStudio8Generator(name, architectureId,
+                                   additionalPlatformDefinition)
 {
   this->FindMakeProgramFile = "CMakeVS9FindMake.cmake";
 }
@@ -40,15 +92,6 @@ cmLocalGenerator *cmGlobalVisualStudio9Generator::CreateLocalGenerator()
   return lg;
 }
 
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio9Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 9 2008 project files.";
-  entry.Full = "";
-}
-
 //----------------------------------------------------------------------------
 void cmGlobalVisualStudio9Generator
 ::EnableLanguage(std::vector<std::string>const &  lang,

+ 5 - 11
Source/cmGlobalVisualStudio9Generator.h

@@ -24,17 +24,9 @@ class cmGlobalVisualStudio9Generator :
   public cmGlobalVisualStudio8Generator
 {
 public:
-  cmGlobalVisualStudio9Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio9Generator; }
-
-  ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio9Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 9 2008";}
-
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  cmGlobalVisualStudio9Generator(const char* name,
+    const char* architectureId, const char* additionalPlatformDefinition);
+  static cmGlobalGeneratorFactory* NewFactory();
 
   ///! create the correct local generator
   virtual cmLocalGenerator *CreateLocalGenerator();
@@ -61,5 +53,7 @@ public:
   virtual std::string GetUserMacrosRegKeyBase();
 protected:
   virtual const char* GetIDEVersion() { return "9.0"; }
+private:
+  class Factory;
 };
 #endif

+ 0 - 37
Source/cmGlobalVisualStudio9IA64Generator.cxx

@@ -1,37 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "cmGlobalVisualStudio9IA64Generator.h"
-#include "cmLocalVisualStudio7Generator.h"
-#include "cmMakefile.h"
-
-
-cmGlobalVisualStudio9IA64Generator::cmGlobalVisualStudio9IA64Generator()
-{
-  this->ArchitectureId = "Itanium";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio9IA64Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 9 2008 Itanium project files.";
-  entry.Full = "";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio9IA64Generator
-::AddPlatformDefinitions(cmMakefile* mf)
-{
-  cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf);
-  mf->AddDefinition("CMAKE_FORCE_IA64", "TRUE");
-}

+ 0 - 47
Source/cmGlobalVisualStudio9IA64Generator.h

@@ -1,47 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef cmGlobalVisualStudio9IA64Generator_h
-#define cmGlobalVisualStudio9IA64Generator_h
-
-#include "cmGlobalVisualStudio9Generator.h"
-
-
-/** \class cmGlobalVisualStudio8IA64Generator
- * \brief Write a Unix makefiles.
- *
- * cmGlobalVisualStudio8IA64Generator manages UNIX build process for a tree
- */
-class cmGlobalVisualStudio9IA64Generator :
-  public cmGlobalVisualStudio9Generator
-{
-public:
-  cmGlobalVisualStudio9IA64Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio9IA64Generator; }
-
-  ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio9IA64Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 9 2008 IA64";}
-
-  virtual const char* GetPlatformName() const {return "Itanium";}
-
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
-  /**
-   * Try to determine system infomation such as shared library
-   * extension, pthreads, byte order etc.
-   */
-  virtual void AddPlatformDefinitions(cmMakefile *);
-};
-#endif

+ 0 - 37
Source/cmGlobalVisualStudio9Win64Generator.cxx

@@ -1,37 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#include "cmGlobalVisualStudio9Win64Generator.h"
-#include "cmLocalVisualStudio7Generator.h"
-#include "cmMakefile.h"
-
-
-cmGlobalVisualStudio9Win64Generator::cmGlobalVisualStudio9Win64Generator()
-{
-  this->ArchitectureId = "x64";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio9Win64Generator
-::GetDocumentation(cmDocumentationEntry& entry) const
-{
-  entry.Name = this->GetName();
-  entry.Brief = "Generates Visual Studio 9 2008 Win64 project files.";
-  entry.Full = "";
-}
-
-//----------------------------------------------------------------------------
-void cmGlobalVisualStudio9Win64Generator
-::AddPlatformDefinitions(cmMakefile* mf)
-{
-  cmGlobalVisualStudio9Generator::AddPlatformDefinitions(mf);
-  mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
-}

+ 0 - 47
Source/cmGlobalVisualStudio9Win64Generator.h

@@ -1,47 +0,0 @@
-/*============================================================================
-  CMake - Cross Platform Makefile Generator
-  Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
-
-  Distributed under the OSI-approved BSD License (the "License");
-  see accompanying file Copyright.txt for details.
-
-  This software is distributed WITHOUT ANY WARRANTY; without even the
-  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-  See the License for more information.
-============================================================================*/
-#ifndef cmGlobalVisualStudio9Win64Generator_h
-#define cmGlobalVisualStudio9Win64Generator_h
-
-#include "cmGlobalVisualStudio9Generator.h"
-
-
-/** \class cmGlobalVisualStudio8Win64Generator
- * \brief Write a Unix makefiles.
- *
- * cmGlobalVisualStudio8Win64Generator manages UNIX build process for a tree
- */
-class cmGlobalVisualStudio9Win64Generator :
-  public cmGlobalVisualStudio9Generator
-{
-public:
-  cmGlobalVisualStudio9Win64Generator();
-  static cmGlobalGenerator* New() {
-    return new cmGlobalVisualStudio9Win64Generator; }
-
-  ///! Get the name for the generator.
-  virtual const char* GetName() const {
-    return cmGlobalVisualStudio9Win64Generator::GetActualName();}
-  static const char* GetActualName() {return "Visual Studio 9 2008 Win64";}
-
-  virtual const char* GetPlatformName() const {return "x64";}
-
-  /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
-
-  /**
-   * Try to determine system infomation such as shared library
-   * extension, pthreads, byte order etc.
-   */
-  virtual void AddPlatformDefinitions(cmMakefile *);
-};
-#endif

+ 6 - 1
Source/cmGlobalVisualStudioGenerator.cxx

@@ -22,6 +22,7 @@
 cmGlobalVisualStudioGenerator::cmGlobalVisualStudioGenerator()
 {
   this->ArchitectureId = "X86";
+  this->AdditionalPlatformDefinition = NULL;
 }
 
 //----------------------------------------------------------------------------
@@ -75,7 +76,6 @@ void cmGlobalVisualStudioGenerator::Generate()
 #endif
 
       // Now make all targets depend on the ALL_BUILD target
-      cmTargets targets;
       for(std::vector<cmLocalGenerator*>::iterator i = gen.begin();
           i != gen.end(); ++i)
         {
@@ -494,6 +494,11 @@ void cmGlobalVisualStudioGenerator::AddPlatformDefinitions(cmMakefile* mf)
 {
   mf->AddDefinition("MSVC_C_ARCHITECTURE_ID", this->ArchitectureId);
   mf->AddDefinition("MSVC_CXX_ARCHITECTURE_ID", this->ArchitectureId);
+
+  if(this->AdditionalPlatformDefinition)
+    {
+    mf->AddDefinition(this->AdditionalPlatformDefinition, "TRUE");
+    }
 }
 
 //----------------------------------------------------------------------------

+ 1 - 0
Source/cmGlobalVisualStudioGenerator.h

@@ -99,6 +99,7 @@ protected:
   typedef std::map<cmTarget*, cmStdString> UtilityDependsMap;
   UtilityDependsMap UtilityDepends;
   const char* ArchitectureId;
+  const char* AdditionalPlatformDefinition;
 
 private:
   void ComputeTargetObjects(cmGeneratorTarget* gt) const;

+ 2 - 2
Source/cmGlobalWatcomWMakeGenerator.cxx

@@ -58,9 +58,9 @@ cmLocalGenerator *cmGlobalWatcomWMakeGenerator::CreateLocalGenerator()
 
 //----------------------------------------------------------------------------
 void cmGlobalWatcomWMakeGenerator
-::GetDocumentation(cmDocumentationEntry& entry) const
+::GetDocumentation(cmDocumentationEntry& entry)
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalWatcomWMakeGenerator::GetActualName();
   entry.Brief = "Generates Watcom WMake makefiles.";
   entry.Full = "";
 }

+ 4 - 2
Source/cmGlobalWatcomWMakeGenerator.h

@@ -23,14 +23,16 @@ class cmGlobalWatcomWMakeGenerator : public cmGlobalUnixMakefileGenerator3
 {
 public:
   cmGlobalWatcomWMakeGenerator();
-  static cmGlobalGenerator* New() { return new cmGlobalWatcomWMakeGenerator; }
+  static cmGlobalGeneratorFactory* NewFactory() {
+    return new cmGlobalGeneratorSimpleFactory
+      <cmGlobalWatcomWMakeGenerator>(); }
   ///! Get the name for the generator.
   virtual const char* GetName() const {
     return cmGlobalWatcomWMakeGenerator::GetActualName();}
   static const char* GetActualName() {return "Watcom WMake";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();

+ 24 - 3
Source/cmGlobalXCodeGenerator.cxx

@@ -20,6 +20,7 @@
 #include "cmSourceFile.h"
 #include "cmCustomCommandGenerator.h"
 #include "cmGeneratorTarget.h"
+#include "cmGlobalGeneratorFactory.h"
 
 #include <cmsys/auto_ptr.hxx>
 
@@ -112,6 +113,18 @@ public:
     }
 };
 
+class cmGlobalXCodeGenerator::Factory : public cmGlobalGeneratorFactory
+{
+public:
+  virtual cmGlobalGenerator* CreateGlobalGenerator(const char* name) const;
+
+  virtual void GetDocumentation(cmDocumentationEntry& entry) const {
+    cmGlobalXCodeGenerator::GetDocumentation(entry); }
+
+  virtual void GetGenerators(std::vector<std::string>& names) const {
+    names.push_back(cmGlobalXCodeGenerator::GetActualName()); }
+};
+
 //----------------------------------------------------------------------------
 cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version)
 {
@@ -132,8 +145,17 @@ cmGlobalXCodeGenerator::cmGlobalXCodeGenerator(std::string const& version)
 }
 
 //----------------------------------------------------------------------------
-cmGlobalGenerator* cmGlobalXCodeGenerator::New()
+cmGlobalGeneratorFactory* cmGlobalXCodeGenerator::NewFactory()
 {
+  return new Factory;
+}
+
+//----------------------------------------------------------------------------
+cmGlobalGenerator* cmGlobalXCodeGenerator::Factory
+::CreateGlobalGenerator(const char* name) const
+{
+  if (strcmp(name, GetActualName()))
+    return 0;
 #if defined(CMAKE_BUILD_WITH_CMAKE)
   cmXcodeVersionParser parser;
   std::string versionFile;
@@ -3474,9 +3496,8 @@ const char* cmGlobalXCodeGenerator::GetCMakeCFGIntDir() const
 
 //----------------------------------------------------------------------------
 void cmGlobalXCodeGenerator::GetDocumentation(cmDocumentationEntry& entry)
-  const
 {
-  entry.Name = this->GetName();
+  entry.Name = cmGlobalXCodeGenerator::GetActualName();
   entry.Brief = "Generate Xcode project files.";
   entry.Full = "";
 }

+ 4 - 2
Source/cmGlobalXCodeGenerator.h

@@ -15,6 +15,7 @@
 #include "cmGlobalGenerator.h"
 #include "cmXCodeObject.h"
 #include "cmCustomCommand.h"
+class cmGlobalGeneratorFactory;
 class cmTarget;
 class cmSourceFile;
 class cmSourceGroup;
@@ -29,7 +30,7 @@ class cmGlobalXCodeGenerator : public cmGlobalGenerator
 {
 public:
   cmGlobalXCodeGenerator(std::string const& version);
-  static cmGlobalGenerator* New();
+  static cmGlobalGeneratorFactory* NewFactory();
 
   ///! Get the name for the generator.
   virtual const char* GetName() const {
@@ -37,7 +38,7 @@ public:
   static const char* GetActualName() {return "Xcode";}
 
   /** Get the documentation entry for this generator.  */
-  virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+  static void GetDocumentation(cmDocumentationEntry& entry);
 
   ///! Create a local generator appropriate to this Global Generator
   virtual cmLocalGenerator *CreateLocalGenerator();
@@ -186,6 +187,7 @@ private:
                           const char* varNameSuffix,
                           const char* default_flags);
 
+  class Factory;
   class BuildObjectListOrString;
   friend class BuildObjectListOrString;
 

+ 4 - 1
Source/cmIncludeDirectoryCommand.h

@@ -72,9 +72,12 @@ public:
       "CMAKE_INCLUDE_DIRECTORIES_BEFORE to ON. "
       "By using AFTER or BEFORE explicitly, you can select between "
       "appending and prepending, independent of the default. "
+      "\n"
       "If the SYSTEM option is given, the compiler will be told the "
       "directories are meant as system include directories on some "
-      "platforms.";
+      "platforms (signalling this setting might achieve effects such as "
+      "the compiler skipping warnings, or these fixed-install system files "
+      "not being considered in dependency calculations - see compiler docs).";
     }
 
   cmTypeMacro(cmIncludeDirectoryCommand, cmCommand);

+ 4 - 0
Source/cmLoadCommandCommand.cxx

@@ -224,6 +224,10 @@ cmLoadedCommand::~cmLoadedCommand()
 bool cmLoadCommandCommand
 ::InitialPass(std::vector<std::string> const& args, cmExecutionStatus &)
 {
+  this->Makefile->IssueMessage(
+    cmake::AUTHOR_WARNING,
+    "The \"load_command\" command will be removed in CMake 3.0.  "
+    "See command documentation for details.");
   if(args.size() < 1 )
     {
     return true;

+ 14 - 1
Source/cmLoadCommandCommand.h

@@ -47,7 +47,7 @@ public:
    */
   virtual const char* GetTerseDocumentation() const
     {
-    return "Load a command into a running CMake.";
+    return "Deprecated.  Use macro() or function() instead.";
     }
 
   /**
@@ -56,6 +56,13 @@ public:
   virtual const char* GetFullDocumentation() const
     {
     return
+      "This command will be removed in CMake 3.0.  "
+      "It works only when the target architecture matches the "
+      "running CMake binary.  "
+      "Use macro() or function() to add commands.  "
+      "Use execute_process() to run advanced computations "
+      "in external processes."
+      "\n"
       "  load_command(COMMAND_NAME <loc1> [loc2 ...])\n"
       "The given locations are searched for a library whose name is "
       "cmCOMMAND_NAME.  If found, it is loaded as a module and the command "
@@ -67,6 +74,12 @@ public:
       "Otherwise the variable will not be set.";
     }
 
+  /** This command is kept for compatibility with older CMake versions. */
+  virtual bool IsDiscouraged() const
+    {
+    return true;
+    }
+
   cmTypeMacro(cmLoadCommandCommand, cmCommand);
 };
 

+ 8 - 6
Source/cmLocalVisualStudio6Generator.cxx

@@ -326,18 +326,18 @@ void cmLocalVisualStudio6Generator::WriteDSPFile(std::ostream& fout,
         {
         cmSystemTools::ReplaceString(source, "$(IntDir)/", "");
 #if defined(_WIN32) || defined(__CYGWIN__)
-        std::ofstream fout(source.c_str(),
+        std::ofstream sourceFout(source.c_str(),
                            std::ios::binary | std::ios::out
                            | std::ios::trunc);
 #else
-        std::ofstream fout(source.c_str(),
+        std::ofstream sourceFout(source.c_str(),
                            std::ios::out | std::ios::trunc);
 #endif
-        if(fout)
+        if(sourceFout)
           {
-          fout.write("# generated from CMake",22);
-          fout.flush();
-          fout.close();
+          sourceFout.write("# generated from CMake",22);
+          sourceFout.flush();
+          sourceFout.close();
           }
         }
       }
@@ -710,6 +710,8 @@ void cmLocalVisualStudio6Generator::SetBuildType(BuildType b,
 
   switch(b)
     {
+    case WIN32_EXECUTABLE:
+      break;
     case STATIC_LIBRARY:
       this->DSPHeaderTemplate = root;
       this->DSPHeaderTemplate += "/staticLibHeader.dsptemplate";

+ 5 - 3
Source/cmLocalVisualStudio7Generator.cxx

@@ -914,12 +914,12 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
       // for FAT32 file systems, which can cause an empty manifest
       // to be embedded into the resulting executable.  See CMake
       // bug #2617.
-      const char* tool  = "VCManifestTool";
+      const char* manifestTool  = "VCManifestTool";
       if(this->FortranProject)
         {
-        tool = "VFManifestTool";
+        manifestTool = "VFManifestTool";
         }
-      fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << tool << "\"\n"
+      fout << "\t\t\t<Tool\n\t\t\t\tName=\"" << manifestTool << "\"\n"
            << "\t\t\t\tUseFAT32Workaround=\"true\"\n"
            << "\t\t\t/>\n";
       }
@@ -1003,6 +1003,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
     }
   switch(target.GetType())
     {
+    case cmTarget::UNKNOWN_LIBRARY:
+      break;
     case cmTarget::OBJECT_LIBRARY:
       {
       std::string libpath = this->GetTargetDirectory(target);

+ 0 - 1
Source/cmLocalVisualStudioGenerator.cxx

@@ -84,7 +84,6 @@ cmLocalVisualStudioGenerator
                   const char* newline_text)
 {
   bool useLocal = this->CustomCommandUseLocal();
-  const cmCustomCommandLines& commandLines = cc.GetCommandLines();
   const char* workingDirectory = cc.GetWorkingDirectory();
   cmCustomCommandGenerator ccg(cc, configName, this->Makefile);
   RelativeRoot relativeRoot = workingDirectory? NONE : START_OUTPUT;

+ 4 - 4
Source/cmMacroCommand.h

@@ -92,12 +92,12 @@ public:
       "facilitates creating macros with optional arguments. Additionally "
       "${ARGV} holds the list of all arguments given to the macro and "
       "${ARGN} "
-      "holds the list of argument past the last expected argument. "
+      "holds the list of arguments past the last expected argument. "
       "Note that the parameters to a macro and values such as ARGN "
       "are not variables in the usual CMake sense. They are string "
-      "replacements much like the c preprocessor would do with a "
-      "macro. If you want true CMake variables you should look at "
-      "the function command."
+      "replacements much like the C preprocessor would do with a macro. "
+      "If you want true CMake variables and/or better CMake scope control "
+      "you should look at the function command."
       "\n"
       "See the cmake_policy() command documentation for the behavior of "
       "policies inside macros."

+ 40 - 0
Source/cmMakefile.cxx

@@ -3937,6 +3937,46 @@ void cmMakefile::DefineProperties(cmake *cm)
      "See the global property of the same name for details.  "
      "This overrides the global property for a directory.",
      true);
+
+  cm->DefineProperty
+    ("VS_GLOBAL_SECTION_PRE_<section>", cmProperty::DIRECTORY,
+     "Specify a preSolution global section in Visual Studio.",
+     "Setting a property like this generates an entry of the following form "
+     "in the solution file:\n"
+     "  GlobalSection(<section>) = preSolution\n"
+     "    <contents based on property value>\n"
+     "  EndGlobalSection\n"
+     "The property must be set to a semicolon-separated list of key=value "
+     "pairs. Each such pair will be transformed into an entry in the solution "
+     "global section. Whitespace around key and value is ignored. List "
+     "elements which do not contain an equal sign are skipped."
+     "\n"
+     "This property only works for Visual Studio 7 and above; it is ignored "
+     "on other generators. The property only applies when set on a directory "
+     "whose CMakeLists.txt conatins a project() command.");
+  cm->DefineProperty
+    ("VS_GLOBAL_SECTION_POST_<section>", cmProperty::DIRECTORY,
+     "Specify a postSolution global section in Visual Studio.",
+     "Setting a property like this generates an entry of the following form "
+     "in the solution file:\n"
+     "  GlobalSection(<section>) = postSolution\n"
+     "    <contents based on property value>\n"
+     "  EndGlobalSection\n"
+     "The property must be set to a semicolon-separated list of key=value "
+     "pairs. Each such pair will be transformed into an entry in the solution "
+     "global section. Whitespace around key and value is ignored. List "
+     "elements which do not contain an equal sign are skipped."
+     "\n"
+     "This property only works for Visual Studio 7 and above; it is ignored "
+     "on other generators. The property only applies when set on a directory "
+     "whose CMakeLists.txt conatins a project() command."
+     "\n"
+     "Note that CMake generates postSolution sections ExtensibilityGlobals "
+     "and ExtensibilityAddIns by default. If you set the corresponding "
+     "property, it will override the default section. For example, setting "
+     "VS_GLOBAL_SECTION_POST_ExtensibilityGlobals will override the default "
+     "contents of the ExtensibilityGlobals section, while keeping "
+     "ExtensibilityAddIns on its default.");
 }
 
 //----------------------------------------------------------------------------

+ 2 - 2
Source/cmMathCommand.h

@@ -58,11 +58,11 @@ public:
     {
     return
       "  math(EXPR <output variable> <math expression>)\n"
-      "EXPR evaluates mathematical expression and return result in the "
+      "EXPR evaluates mathematical expression and returns result in the "
       "output variable. Example mathematical expression is "
       "'5 * ( 10 + 13 )'.  Supported operators are "
       "+ - * / % | & ^ ~ << >> * / %.  They have the same meaning "
-      " as they do in c code.";
+      " as they do in C code.";
     }
 
   cmTypeMacro(cmMathCommand, cmCommand);

+ 3 - 2
Source/cmMessageCommand.h

@@ -67,8 +67,9 @@ public:
       "  STATUS         = Incidental information\n"
       "  WARNING        = CMake Warning, continue processing\n"
       "  AUTHOR_WARNING = CMake Warning (dev), continue processing\n"
-      "  SEND_ERROR     = CMake Error, continue but skip generation\n"
-      "  FATAL_ERROR    = CMake Error, stop all processing\n"
+      "  SEND_ERROR     = CMake Error, continue processing,\n"
+      "                                but skip generation\n"
+      "  FATAL_ERROR    = CMake Error, stop processing and generation\n"
       "The CMake command-line tool displays STATUS messages on stdout "
       "and all other message types on stderr.  "
       "The CMake GUI displays all messages in its log area.  "

+ 1 - 0
Source/cmNinjaNormalTargetGenerator.cxx

@@ -564,6 +564,7 @@ void cmNinjaNormalTargetGenerator::WriteLinkStatement()
     // for instance ARG_MAX is 2096152 on Ubuntu or 262144 on Mac
     commandLineLengthLimit = ((int)sysconf(_SC_ARG_MAX))-linkRuleLength-1000;
 #else
+    (void)linkRuleLength;
     commandLineLengthLimit = -1;
 #endif
   }

+ 1 - 1
Source/cmPolicies.cxx

@@ -457,7 +457,7 @@ cmPolicies::cmPolicies()
     "This makes sure that the modules belonging to "
     "CMake always get those files included which they expect, and against "
     "which they were developed and tested.  "
-    "In call other cases, the files found in "
+    "In all other cases, the files found in "
     "CMAKE_MODULE_PATH still take precedence over the ones in "
     "the CMake module directory.  "
     "The OLD behaviour is to always prefer files from CMAKE_MODULE_PATH over "

+ 76 - 1
Source/cmQtAutomoc.cxx

@@ -85,6 +85,18 @@ static std::string extractSubDir(const std::string& absPath,
 }
 
 
+static void copyTargetProperty(cmTarget* destinationTarget,
+                               cmTarget* sourceTarget,
+                               const char* propertyName)
+{
+  const char* propertyValue = sourceTarget->GetProperty(propertyName);
+  if (propertyValue)
+    {
+    destinationTarget->SetProperty(propertyName, propertyValue);
+    }
+}
+
+
 cmQtAutomoc::cmQtAutomoc()
 :Verbose(cmsys::SystemTools::GetEnv("VERBOSE") != 0)
 ,ColorOutput(true)
@@ -152,9 +164,13 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
   std::string automocComment = "Automoc for target ";
   automocComment += targetName;
 
-  makefile->AddUtilityCommand(automocTargetName.c_str(), true,
+  cmTarget* automocTarget = makefile->AddUtilityCommand(
+                              automocTargetName.c_str(), true,
                               workingDirectory.c_str(), depends,
                               commandLines, false, automocComment.c_str());
+  // inherit FOLDER property from target (#13688)
+  copyTargetProperty(automocTarget, target, "FOLDER");
+
   target->AddUtility(automocTargetName.c_str());
 
   // configure a file to get all information to automoc at buildtime:
@@ -195,6 +211,34 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
       }
     }
 
+
+  const char* qtIncDir = 0;
+  const char* qtCoreIncDir = 0;
+
+  // check whether ${QT_INCLUDE_DIR} is part of the implicit include dirs,
+  // see http://public.kitware.com/Bug/view.php?id=13667
+  bool qtIncludeDirMayHaveBeenRemoved = false;
+  if (makefile->IsSet("QT_INCLUDE_DIR"))
+    {
+    qtIncDir = makefile->GetDefinition("QT_INCLUDE_DIR");
+    std::string s =
+         makefile->GetSafeDefinition("CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES");
+    std::vector<std::string> implIncDirs;
+    cmSystemTools::ExpandListArgument(s, implIncDirs);
+    if (std::find(implIncDirs.begin(), implIncDirs.end(),std::string(qtIncDir))
+                                                          != implIncDirs.end())
+      {
+      qtIncludeDirMayHaveBeenRemoved = true;
+      if (makefile->IsSet("QT_QTCORE_INCLUDE_DIR"))
+        {
+        qtCoreIncDir = makefile->GetDefinition("QT_QTCORE_INCLUDE_DIR");
+        }
+      }
+    }
+
+  bool haveQtCoreIncDir = false;
+  bool haveQtIncDir = false;
+
   std::vector<std::string> includeDirs;
   cmGeneratorTarget gtgt(target);
   localGen->GetIncludeDirectories(includeDirs, &gtgt, "CXX");
@@ -207,6 +251,37 @@ void cmQtAutomoc::SetupAutomocTarget(cmTarget* target)
     _moc_incs += sep;
     sep = ";";
     _moc_incs += *incDirIt;
+
+    if (qtIncludeDirMayHaveBeenRemoved && qtCoreIncDir && qtIncDir) // #13667
+      {
+      if (*incDirIt == qtIncDir)
+        {
+        haveQtIncDir = true;
+        qtIncludeDirMayHaveBeenRemoved = false; // it's here, i.e. not removed
+        }
+      if (*incDirIt == qtCoreIncDir)
+        {
+        haveQtCoreIncDir = true;
+        }
+      }
+    }
+
+  // Some projects (kdelibs, phonon) query the compiler for its default
+  // include search dirs, and add those to
+  // CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES.
+  // These may include e.g./usr/lib/qt/include . This is typically also part
+  // of ${QT_INCLUDES}. If this directory is then contained in the implicit
+  // include dirs, it is removed from the include dirs returned from the
+  // target above. So we add ${QT_INCLUDE_DIR} manually for moc if we detected
+  // that ${QT_QTCORE_INCLUDE_DIR} is among the include dirs (there shouldn't
+  // be a way to use Qt4 without using ${QT_QTCORE_INCLUDE_DIR} I think.
+  // See #13646 and #13667.
+  if (qtIncludeDirMayHaveBeenRemoved && qtCoreIncDir && qtIncDir
+      && (haveQtCoreIncDir == true) && (haveQtIncDir == false))
+    {
+    _moc_incs += sep;
+    sep = ";";
+    _moc_incs += qtIncDir;
     }
 
   const char* tmp = target->GetProperty("COMPILE_DEFINITIONS");

+ 3 - 1
Source/cmSetTargetPropertiesCommand.h

@@ -156,7 +156,9 @@ public:
         "\n"
         "The EXCLUDE_FROM_DEFAULT_BUILD property is used by the visual "
         "studio generators.  If it is set to 1 the target will not be "
-        "part of the default build when you select \"Build Solution\"."
+        "part of the default build when you select \"Build Solution\". "
+        "This can also be set on a per-configuration basis using "
+        "EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>."
         ;
     }
 

+ 1 - 1
Source/cmSourceFile.cxx

@@ -458,7 +458,7 @@ void cmSourceFile::DefineProperties(cmake *cm)
      "A property on a source file that indicates if the source file "
      "is a header file with no associated implementation. This is "
      "set automatically based on the file extension and is used by "
-     "CMake to determine is certain dependency information should be "
+     "CMake to determine if certain dependency information should be "
      "computed.");
 
   cm->DefineProperty

+ 1 - 1
Source/cmSourceGroupCommand.h

@@ -68,7 +68,7 @@ public:
       "expression matches the file will be favored.\n"
       "The name of the group may contain backslashes to specify subgroups:\n"
       "  source_group(outer\\\\inner ...)\n"
-      "For backwards compatibility, this command is also supports the "
+      "For backwards compatibility, this command also supports the "
       "format:\n"
       "  source_group(name regex)";
     }

+ 32 - 0
Source/cmTarget.cxx

@@ -265,6 +265,21 @@ void cmTarget::DefineProperties(cmake *cm)
      "whatever file extension is required by the host app for your "
      "bundle.");
 
+  cm->DefineProperty
+    ("EXCLUDE_FROM_DEFAULT_BUILD", cmProperty::TARGET,
+     "Exclude target from \"Build Solution\".",
+     "This property is only used by Visual Studio generators 7 and above. "
+     "When set to TRUE, the target will not be built when you press "
+     "\"Build Solution\".");
+
+  cm->DefineProperty
+    ("EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG>", cmProperty::TARGET,
+     "Per-configuration version of target exclusion from \"Build Solution\". ",
+     "This is the configuration-specific version of "
+     "EXCLUDE_FROM_DEFAULT_BUILD. If the generic EXCLUDE_FROM_DEFAULT_BUILD "
+     "is also set on a target, EXCLUDE_FROM_DEFAULT_BUILD_<CONFIG> takes "
+     "precedence in configurations for which it has a value.");
+
   cm->DefineProperty
     ("FRAMEWORK", cmProperty::TARGET,
      "This target is a framework on the Mac.",
@@ -650,6 +665,22 @@ void cmTarget::DefineProperties(cmake *cm)
      "It is intended to specify dependencies on \"linker scripts\" for "
      "custom Makefile link rules.");
 
+  cm->DefineProperty
+    ("LINK_DEPENDS_NO_SHARED", cmProperty::TARGET,
+     "Do not depend on linked shared library files.",
+     "Set this property to true to tell CMake generators not to add "
+     "file-level dependencies on the shared library files linked by "
+     "this target.  "
+     "Modification to the shared libraries will not be sufficient to "
+     "re-link this target.  "
+     "Logical target-level dependencies will not be affected so the "
+     "linked shared libraries will still be brought up to date before "
+     "this target is built."
+     "\n"
+     "This property is initialized by the value of the variable "
+     "CMAKE_LINK_DEPENDS_NO_SHARED if it is set when a target is "
+     "created.");
+
   cm->DefineProperty
     ("LINK_INTERFACE_LIBRARIES", cmProperty::TARGET,
      "List public interface libraries for a shared library or executable.",
@@ -1314,6 +1345,7 @@ void cmTarget::SetMakefile(cmMakefile* mf)
   this->SetPropertyDefault("OSX_ARCHITECTURES", 0);
   this->SetPropertyDefault("AUTOMOC", 0);
   this->SetPropertyDefault("AUTOMOC_MOC_OPTIONS", 0);
+  this->SetPropertyDefault("LINK_DEPENDS_NO_SHARED", 0);
   this->SetPropertyDefault("LINK_INTERFACE_LIBRARIES", 0);
   this->SetPropertyDefault("WIN32_EXECUTABLE", 0);
   this->SetPropertyDefault("MACOSX_BUNDLE", 0);

+ 2 - 2
Source/cmTargetLinkLibrariesCommand.h

@@ -100,11 +100,11 @@ public:
       "to the LINK_INTERFACE_LIBRARIES and its per-configuration equivalent "
       "target properties instead of using them for linking.  "
       "Libraries specified as \"debug\" are appended to the "
-      "the LINK_INTERFACE_LIBRARIES_DEBUG property (or to the properties "
+      "LINK_INTERFACE_LIBRARIES_DEBUG property (or to the properties "
       "corresponding to configurations listed in the DEBUG_CONFIGURATIONS "
       "global property if it is set).  "
       "Libraries specified as \"optimized\" are appended to the "
-      "the LINK_INTERFACE_LIBRARIES property.  "
+      "LINK_INTERFACE_LIBRARIES property.  "
       "Libraries specified as \"general\" (or without any keyword) are "
       "treated as if specified for both \"debug\" and \"optimized\"."
       "\n"

+ 1 - 1
Source/cmTryRunCommand.h

@@ -81,7 +81,7 @@ public:
       "the executable, but it will not try to run the executable. Instead it "
       "will create cache variables which must be filled by the user or by "
       "presetting them in some CMake script file to the values the "
-      "executable would have produced if it would have been run on its actual "
+      "executable would have produced if it had been run on its actual "
       "target platform. These variables are RUN_RESULT_VAR (explanation see "
       "above) and if RUN_OUTPUT_VARIABLE (or OUTPUT_VARIABLE) was used, an "
       "additional cache variable "

+ 5 - 3
Source/cmVisualStudio10TargetGenerator.cxx

@@ -404,6 +404,9 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
       case cmTarget::UTILITY:
         configType += "Utility";
         break;
+      case cmTarget::GLOBAL_TARGET:
+      case cmTarget::UNKNOWN_LIBRARY:
+        break;
       }
     configType += "</ConfigurationType>\n";
     this->WriteString(configType.c_str(), 2);
@@ -425,8 +428,8 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
     mfcLine += useOfMfcValue + "</UseOfMfc>\n";
     this->WriteString(mfcLine.c_str(), 2);
 
-    if(this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
-       this->ClOptions[*i]->UsingUnicode() ||
+    if((this->Target->GetType() <= cmTarget::OBJECT_LIBRARY &&
+       this->ClOptions[*i]->UsingUnicode()) ||
        this->Target->GetPropertyAsBool("VS_WINRT_EXTENSIONS"))
       {
       this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
@@ -907,7 +910,6 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
   cmSourceFile* source)
 {
   cmSourceFile& sf = *source;
-  cmLocalVisualStudio7Generator* lg = this->LocalGenerator;
 
   std::string objectName;
   if(this->GeneratorTarget->ExplicitObjectName.find(&sf)

+ 0 - 56
Source/cmWin32ProcessExecution.cxx

@@ -271,13 +271,6 @@ bool cmWin32ProcessExecution::Wait(int timeout)
   return this->PrivateClose(timeout);
 }
 
-/*
- * Internal dictionary mapping popen* file pointers to process handles,
- * for use when retrieving the process exit code.  See _PyPclose() below
- * for more information on this dictionary's use.
- */
-static void *_PyPopenProcs = NULL;
-
 static BOOL RealPopenCreateProcess(const char *cmdstring,
                                    const char *path,
                                    const char *szConsoleSpawn,
@@ -679,18 +672,6 @@ bool cmWin32ProcessExecution::PrivateOpen(const char *cmdstring,
       }
     }
 
-  /*
-   * Insert the files we've created into the process dictionary
-   * all referencing the list with the process handle and the
-   * initial number of files (see description below in _PyPclose).
-   * Since if _PyPclose later tried to wait on a process when all
-   * handles weren't closed, it could create a deadlock with the
-   * child, we spend some energy here to try to ensure that we
-   * either insert all file handles into the dictionary or none
-   * at all.  It's a little clumsy with the various popen modes
-   * and variable number of files involved.
-   */
-
   /* Child is launched. Close the parents copy of those pipe
    * handles that only the child should have open.  You need to
    * make sure that no handles to the write end of the output pipe
@@ -761,43 +742,6 @@ cmWin32ProcessExecution::~cmWin32ProcessExecution()
   this->CloseHandles();
 }
 
-/*
- * Wrapper for fclose() to use for popen* files, so we can retrieve the
- * exit code for the child process and return as a result of the close.
- *
- * This function uses the _PyPopenProcs dictionary in order to map the
- * input file pointer to information about the process that was
- * originally created by the popen* call that created the file pointer.
- * The dictionary uses the file pointer as a key (with one entry
- * inserted for each file returned by the original popen* call) and a
- * single list object as the value for all files from a single call.
- * The list object contains the Win32 process handle at [0], and a file
- * count at [1], which is initialized to the total number of file
- * handles using that list.
- *
- * This function closes whichever handle it is passed, and decrements
- * the file count in the dictionary for the process handle pointed to
- * by this file.  On the last close (when the file count reaches zero),
- * this function will wait for the child process and then return its
- * exit code as the result of the close() operation.  This permits the
- * files to be closed in any order - it is always the close() of the
- * final handle that will return the exit code.
- */
-
- /* RED_FLAG 31-Aug-2000 Tim
-  * This is always called (today!) between a pair of
-  * Py_BEGIN_ALLOW_THREADS/ Py_END_ALLOW_THREADS
-  * macros.  So the thread running this has no valid thread state, as
-  * far as Python is concerned.  However, this calls some Python API
-  * functions that cannot be called safely without a valid thread
-  * state, in particular PyDict_GetItem.
-  * As a temporary hack (although it may last for years ...), we
-  * *rely* on not having a valid thread state in this function, in
-  * order to create our own "from scratch".
-  * This will deadlock if _PyPclose is ever called by a thread
-  * holding the global lock.
-  */
-
 bool cmWin32ProcessExecution::PrivateClose(int /* timeout */)
 {
   HANDLE hProcess = this->ProcessHandle;

+ 68 - 79
Source/cmake.cxx

@@ -63,15 +63,8 @@
 #    include "cmGlobalVisualStudio71Generator.h"
 #    include "cmGlobalVisualStudio8Generator.h"
 #    include "cmGlobalVisualStudio9Generator.h"
-#    include "cmGlobalVisualStudio9IA64Generator.h"
-#    include "cmGlobalVisualStudio9Win64Generator.h"
 #    include "cmGlobalVisualStudio10Generator.h"
-#    include "cmGlobalVisualStudio10IA64Generator.h"
-#    include "cmGlobalVisualStudio10Win64Generator.h"
 #    include "cmGlobalVisualStudio11Generator.h"
-#    include "cmGlobalVisualStudio11Win64Generator.h"
-#    include "cmGlobalVisualStudio11ARMGenerator.h"
-#    include "cmGlobalVisualStudio8Win64Generator.h"
 #    include "cmGlobalBorlandMakefileGenerator.h"
 #    include "cmGlobalNMakeMakefileGenerator.h"
 #    include "cmGlobalJOMMakefileGenerator.h"
@@ -223,6 +216,11 @@ cmake::~cmake()
     {
     delete (*j).second;
     }
+  for(RegisteredGeneratorsVector::iterator j = this->Generators.begin();
+      j != this->Generators.end(); ++j)
+    {
+    delete *j;
+    }
 #ifdef CMAKE_BUILD_WITH_CMAKE
   delete this->VariableWatch;
 #endif
@@ -1872,10 +1870,10 @@ void cmake::AddDefaultExtraGenerators()
 //----------------------------------------------------------------------------
 void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
 {
-  for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin();
+  for(RegisteredGeneratorsVector::const_iterator i = this->Generators.begin();
       i != this->Generators.end(); ++i)
     {
-    names.push_back(i->first);
+    (*i)->GetGenerators(names);
     }
   for(RegisteredExtraGeneratorsMap::const_iterator
       i = this->ExtraGenerators.begin();
@@ -1887,29 +1885,36 @@ void cmake::GetRegisteredGenerators(std::vector<std::string>& names)
 
 cmGlobalGenerator* cmake::CreateGlobalGenerator(const char* name)
 {
-  cmGlobalGenerator* generator = 0;
   cmExternalMakefileProjectGenerator* extraGenerator = 0;
-  RegisteredGeneratorsMap::const_iterator genIt = this->Generators.find(name);
-  if(genIt == this->Generators.end())
+  RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
+                                            this->ExtraGenerators.find(name);
+  if (extraGenIt != this->ExtraGenerators.end())
     {
-    RegisteredExtraGeneratorsMap::const_iterator extraGenIt =
-                                              this->ExtraGenerators.find(name);
-    if (extraGenIt == this->ExtraGenerators.end())
-      {
-      return 0;
-      }
     extraGenerator = (extraGenIt->second)();
-    genIt=this->Generators.find(extraGenerator->GetGlobalGeneratorName(name));
-    if(genIt == this->Generators.end())
+    name = extraGenerator->GetGlobalGeneratorName(name);
+    }
+
+  cmGlobalGenerator* generator = 0;
+  for (RegisteredGeneratorsVector::const_iterator i =
+    this->Generators.begin(); i != this->Generators.end(); ++i)
+    {
+    generator = (*i)->CreateGlobalGenerator(name);
+    if (generator)
       {
-      delete extraGenerator;
-      return 0;
+      break;
       }
-  }
+    }
+
+  if (generator)
+    {
+    generator->SetCMakeInstance(this);
+    generator->SetExternalMakefileProjectGenerator(extraGenerator);
+    }
+  else
+    {
+    delete extraGenerator;
+    }
 
-  generator = (genIt->second)();
-  generator->SetCMakeInstance(this);
-  generator->SetExternalMakefileProjectGenerator(extraGenerator);
   return generator;
 }
 
@@ -2573,55 +2578,41 @@ void cmake::AddDefaultGenerators()
 {
 #if defined(_WIN32) && !defined(__CYGWIN__)
 # if !defined(CMAKE_BOOT_MINGW)
-  this->Generators[cmGlobalVisualStudio6Generator::GetActualName()] =
-    &cmGlobalVisualStudio6Generator::New;
-  this->Generators[cmGlobalVisualStudio7Generator::GetActualName()] =
-    &cmGlobalVisualStudio7Generator::New;
-  this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] =
-    &cmGlobalVisualStudio10Generator::New;
-  this->Generators[cmGlobalVisualStudio10IA64Generator::GetActualName()] =
-    &cmGlobalVisualStudio10IA64Generator::New;
-  this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] =
-    &cmGlobalVisualStudio10Win64Generator::New;
-  this->Generators[cmGlobalVisualStudio11Generator::GetActualName()] =
-    &cmGlobalVisualStudio11Generator::New;
-  this->Generators[cmGlobalVisualStudio11Win64Generator::GetActualName()] =
-    &cmGlobalVisualStudio11Win64Generator::New;
-  this->Generators[cmGlobalVisualStudio11ARMGenerator::GetActualName()] =
-    &cmGlobalVisualStudio11ARMGenerator::New;
-  this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
-    &cmGlobalVisualStudio71Generator::New;
-  this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] =
-    &cmGlobalVisualStudio8Generator::New;
-  this->Generators[cmGlobalVisualStudio9Generator::GetActualName()] =
-    &cmGlobalVisualStudio9Generator::New;
-  this->Generators[cmGlobalVisualStudio9IA64Generator::GetActualName()] =
-    &cmGlobalVisualStudio9IA64Generator::New;
-  this->Generators[cmGlobalVisualStudio9Win64Generator::GetActualName()] =
-    &cmGlobalVisualStudio9Win64Generator::New;
-  this->Generators[cmGlobalVisualStudio8Win64Generator::GetActualName()] =
-    &cmGlobalVisualStudio8Win64Generator::New;
-  this->Generators[cmGlobalBorlandMakefileGenerator::GetActualName()] =
-    &cmGlobalBorlandMakefileGenerator::New;
-  this->Generators[cmGlobalNMakeMakefileGenerator::GetActualName()] =
-    &cmGlobalNMakeMakefileGenerator::New;
-  this->Generators[cmGlobalJOMMakefileGenerator::GetActualName()] =
-    &cmGlobalJOMMakefileGenerator::New;
-  this->Generators[cmGlobalWatcomWMakeGenerator::GetActualName()] =
-    &cmGlobalWatcomWMakeGenerator::New;
+  this->Generators.push_back(
+    cmGlobalVisualStudio6Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio7Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio10Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio11Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio71Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio8Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalVisualStudio9Generator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalBorlandMakefileGenerator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalNMakeMakefileGenerator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalJOMMakefileGenerator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalWatcomWMakeGenerator::NewFactory());
 # endif
-  this->Generators[cmGlobalMSYSMakefileGenerator::GetActualName()] =
-    &cmGlobalMSYSMakefileGenerator::New;
-  this->Generators[cmGlobalMinGWMakefileGenerator::GetActualName()] =
-    &cmGlobalMinGWMakefileGenerator::New;
+  this->Generators.push_back(
+    cmGlobalMSYSMakefileGenerator::NewFactory());
+  this->Generators.push_back(
+    cmGlobalMinGWMakefileGenerator::NewFactory());
 #endif
-  this->Generators[cmGlobalUnixMakefileGenerator3::GetActualName()] =
-    &cmGlobalUnixMakefileGenerator3::New;
-  this->Generators[cmGlobalNinjaGenerator::GetActualName()] =
-    &cmGlobalNinjaGenerator::New;
+  this->Generators.push_back(
+    cmGlobalUnixMakefileGenerator3::NewFactory());
+  this->Generators.push_back(
+    cmGlobalNinjaGenerator::NewFactory());
 #ifdef CMAKE_USE_XCODE
-  this->Generators[cmGlobalXCodeGenerator::GetActualName()] =
-    &cmGlobalXCodeGenerator::New;
+  this->Generators.push_back(
+    cmGlobalXCodeGenerator::NewFactory());
 #endif
 }
 
@@ -2715,17 +2706,15 @@ void cmake::GetPropertiesDocumentation(std::map<std::string,
 
 void cmake::GetGeneratorDocumentation(std::vector<cmDocumentationEntry>& v)
 {
-  for(RegisteredGeneratorsMap::const_iterator i = this->Generators.begin();
-      i != this->Generators.end(); ++i)
+  for(RegisteredGeneratorsVector::const_iterator i =
+      this->Generators.begin(); i != this->Generators.end(); ++i)
     {
     cmDocumentationEntry e;
-    cmGlobalGenerator* generator = (i->second)();
-    generator->GetDocumentation(e);
-    delete generator;
+    (*i)->GetDocumentation(e);
     v.push_back(e);
     }
-  for(RegisteredExtraGeneratorsMap::const_iterator
-      i = this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i)
+  for(RegisteredExtraGeneratorsMap::const_iterator i =
+      this->ExtraGenerators.begin(); i != this->ExtraGenerators.end(); ++i)
     {
     cmDocumentationEntry e;
     cmExternalMakefileProjectGenerator* generator = (i->second)();

+ 3 - 5
Source/cmake.h

@@ -17,6 +17,7 @@
 #include "cmPropertyDefinitionMap.h"
 #include "cmPropertyMap.h"
 
+class cmGlobalGeneratorFactory;
 class cmGlobalGenerator;
 class cmLocalGenerator;
 class cmCacheManager;
@@ -396,12 +397,9 @@ protected:
      cmExternalMakefileProjectGenerator* (*CreateExtraGeneratorFunctionType)();
   typedef std::map<cmStdString,
                 CreateExtraGeneratorFunctionType> RegisteredExtraGeneratorsMap;
-
-  typedef cmGlobalGenerator* (*CreateGeneratorFunctionType)();
-  typedef std::map<cmStdString,
-                   CreateGeneratorFunctionType> RegisteredGeneratorsMap;
+  typedef std::vector<cmGlobalGeneratorFactory*> RegisteredGeneratorsVector;
   RegisteredCommandsMap Commands;
-  RegisteredGeneratorsMap Generators;
+  RegisteredGeneratorsVector Generators;
   RegisteredExtraGeneratorsMap ExtraGenerators;
   void AddDefaultCommands();
   void AddDefaultGenerators();

+ 4 - 0
Source/cmcldeps.cxx

@@ -237,12 +237,14 @@ 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) {
     srcfilename = srcfile;
   } else {
     srcfilename = srcfile.substr(pos + 1);
   }
+  }
 
   std::string nol = " /nologo ";
   std::string show = " /showIncludes ";
@@ -266,10 +268,12 @@ int main() {
 
     // call cl in object dir so the .i is generated there
     std::string objdir;
+    {
     std::string::size_type pos = objfile.rfind("\\");
     if (pos != std::string::npos) {
       objdir = objfile.substr(0, pos);
     }
+    }
 
     // extract dependencies with cl.exe
     int exit_code = process(srcfilename, dfile, objfile,

+ 5 - 5
Source/cmw9xcom.cxx

@@ -31,14 +31,14 @@ int main (int argc, char *argv[])
   int cc;
   for ( cc = 2; cc < argc; cc ++ )
     {
-    std::string arg = argv[cc];
-    if ( (arg.find_first_of(" ") != arg.npos) &&
-         (arg.find_first_of("\"") == arg.npos) )
+    std::string nextArg = argv[cc];
+    if ( (nextArg.find_first_of(" ") != nextArg.npos) &&
+         (nextArg.find_first_of("\"") == nextArg.npos) )
       {
-      arg = "\"" + arg + "\"";
+      nextArg = "\"" + nextArg + "\"";
       }
     command += " ";
-    command += arg;
+    command += nextArg;
     }
 
   return cmWin32ProcessExecution::Windows9xHack(command.c_str());

+ 1 - 1
Source/kwsys/SystemInformation.cxx

@@ -1323,7 +1323,7 @@ int SystemInformationImplementation::GetFullyQualifiedDomainName(
 
   for (ifa=ifas; ifa!=NULL; ifa=ifa->ifa_next)
     {
-    int fam=ifa->ifa_addr->sa_family;
+    int fam = ifa->ifa_addr? ifa->ifa_addr->sa_family : -1;
     if ((fam==AF_INET) || (fam==AF_INET6))
       {
       char host[NI_MAXHOST]={'\0'};

+ 34 - 0
Tests/BuildDepends/CMakeLists.txt

@@ -60,6 +60,12 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_dir.hxx
 file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx
   "static const char* zot_macro_tgt = \"zot_macro_tgt\";\n")
 
+file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_lib.h
+  "#define link_depends_no_shared_lib_value 1\n")
+file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h
+  "#define link_depends_no_shared_exe_value 0\n")
+set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt)
+
 help_xcode_depends()
 
 message("Building project first time")
@@ -125,6 +131,19 @@ else()
   message(SEND_ERROR "Project did not initially build properly: ${out}")
 endif()
 
+if(EXISTS "${link_depends_no_shared_check_txt}")
+  file(STRINGS "${link_depends_no_shared_check_txt}" link_depends_no_shared_check LIMIT_COUNT 1)
+  if("${link_depends_no_shared_check}" STREQUAL "1")
+    message(STATUS "link_depends_no_shared_exe is newer than link_depends_no_shared_lib as expected.")
+  else()
+    message(SEND_ERROR "Project did not initially build properly: "
+      "link_depends_no_shared_exe is older than link_depends_no_shared_lib.")
+  endif()
+else()
+  message(SEND_ERROR "Project did not initially build properly: "
+    "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.")
+endif()
+
 message("Waiting 3 seconds...")
 # any additional argument will cause ${bar} to wait forever
 execute_process(COMMAND ${bar} -infinite TIMEOUT 3 OUTPUT_VARIABLE out)
@@ -141,6 +160,9 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_dir.hxx
 file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_tgt.hxx
   "static const char* zot_macro_tgt = \"zot_macro_tgt changed\";\n")
 
+file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_lib.h
+  "#define link_depends_no_shared_lib_value 0\n")
+
 if(TEST_LINK_DEPENDS)
   file(WRITE ${TEST_LINK_DEPENDS} "2")
 endif()
@@ -219,3 +241,15 @@ is not newer than dependency
 ")
   endif()
 endif()
+
+if(EXISTS "${link_depends_no_shared_check_txt}")
+  file(STRINGS "${link_depends_no_shared_check_txt}" link_depends_no_shared_check LIMIT_COUNT 1)
+  if("${link_depends_no_shared_check}" STREQUAL "0")
+    message(STATUS "link_depends_no_shared_exe is older than link_depends_no_shared_lib as expected.")
+  else()
+    message(SEND_ERROR "Project did not rebuild properly: link_depends_no_shared_exe is newer than link_depends_no_shared_lib.")
+  endif()
+else()
+  message(SEND_ERROR "Project did not rebuild properly.  "
+    "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.")
+endif()

+ 15 - 0
Tests/BuildDepends/Project/CMakeLists.txt

@@ -108,3 +108,18 @@ if(TEST_LINK_DEPENDS)
   add_executable(linkdep linkdep.cxx)
   set_property(TARGET linkdep PROPERTY LINK_DEPENDS ${TEST_LINK_DEPENDS})
 endif()
+
+add_library(link_depends_no_shared_lib SHARED link_depends_no_shared_lib.c
+  ${CMAKE_CURRENT_BINARY_DIR}/link_depends_no_shared_lib.h)
+add_executable(link_depends_no_shared_exe link_depends_no_shared_exe.c
+  ${CMAKE_CURRENT_BINARY_DIR}/link_depends_no_shared_exe.h)
+target_link_libraries(link_depends_no_shared_exe link_depends_no_shared_lib)
+set_property(TARGET link_depends_no_shared_exe PROPERTY LINK_DEPENDS_NO_SHARED 1)
+add_custom_target(link_depends_no_shared_check ALL
+  COMMAND ${CMAKE_COMMAND}
+   -Dlib=$<TARGET_FILE:link_depends_no_shared_lib>
+   -Dexe=$<TARGET_FILE:link_depends_no_shared_exe>
+   -Dout=${CMAKE_CURRENT_BINARY_DIR}/link_depends_no_shared_check.txt
+   -P ${CMAKE_CURRENT_SOURCE_DIR}/link_depends_no_shared_check.cmake
+  )
+add_dependencies(link_depends_no_shared_check link_depends_no_shared_exe)

+ 7 - 0
Tests/BuildDepends/Project/link_depends_no_shared_check.cmake

@@ -0,0 +1,7 @@
+if(NOT EXISTS "${lib}" OR NOT EXISTS "${exe}")
+  file(REMOVE "${out}")
+elseif("${exe}" IS_NEWER_THAN "${lib}")
+  file(WRITE "${out}" "1\n")
+else()
+  file(WRITE "${out}" "0\n")
+endif()

+ 9 - 0
Tests/BuildDepends/Project/link_depends_no_shared_exe.c

@@ -0,0 +1,9 @@
+#include "link_depends_no_shared_exe.h"
+#ifdef _WIN32
+__declspec(dllimport)
+#endif
+int link_depends_no_shared_lib(void);
+int main()
+{
+  return link_depends_no_shared_lib() + link_depends_no_shared_exe_value;
+}

+ 8 - 0
Tests/BuildDepends/Project/link_depends_no_shared_lib.c

@@ -0,0 +1,8 @@
+#include "link_depends_no_shared_lib.h"
+#ifdef _WIN32
+__declspec(dllexport)
+#endif
+int link_depends_no_shared_lib(void)
+{
+  return link_depends_no_shared_lib_value;
+}

+ 59 - 0
Tests/CMakeLists.txt

@@ -983,6 +983,36 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
   set_tests_properties(ExternalProject PROPERTIES
     TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
 
+  add_test(ExternalProjectUpdateSetup ${CMAKE_CTEST_COMMAND}
+    --build-and-test
+    "${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate"
+    "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate"
+    --build-generator ${CMAKE_TEST_GENERATOR}
+    --build-project ExternalProjectUpdateTest
+    --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+    --build-exe-dir "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate"
+    --force-new-ctest-process
+    --test-command ${CMAKE_CTEST_COMMAND} -V
+    )
+  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate")
+  set_tests_properties(ExternalProjectUpdateSetup PROPERTIES
+    TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
+
+  add_test(NAME ExternalProjectUpdate
+    COMMAND ${CMAKE_CMAKE_COMMAND}
+    -DExternalProjectUpdate_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate
+    -DExternalProjectUpdate_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate
+    -DCMAKE_TEST_GENERATOR=${CMAKE_TEST_GENERATOR}
+    -DCMAKE_TEST_MAKEPROGRAM=${CMAKE_TEST_MAKEPROGRAM}
+    -DCMAKE_CTEST_COMMAND=${CMAKE_CTEST_COMMAND}
+    -P ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate/ExternalProjectUpdateTest.cmake
+    )
+  list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/ExternalProjectUpdate")
+  set_tests_properties(ExternalProjectUpdate PROPERTIES
+    TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}
+    WORKING_DIRECTORY ${CMake_SOURCE_DIR}/Tests/ExternalProjectUpdate
+    DEPENDS ExternalProjectUpdateSetup )
+
   # do each of the tutorial steps
   foreach(STP RANGE 1 7)
     add_test(TutorialStep${STP} ${CMAKE_CTEST_COMMAND}
@@ -1412,6 +1442,35 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/
       --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
       --test-command VSMidl)
     list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSMidl")
+
+    if(NOT MSVC60 AND NOT CMAKE_TEST_MAKEPROGRAM MATCHES "[mM][sS][bB][uU][iI][lL][dD]\\.[eE][xX][eE]")
+      # The test (and tested property) works with .sln files, so it's skipped when:
+      # * Using VS6, which doesn't use .sln files
+      # * cmake --build is set up to use MSBuild, since the MSBuild invocation does not use the .sln file
+      set(_last_test "")
+      foreach(config ${CMAKE_CONFIGURATION_TYPES})
+        add_test(NAME VSExcludeFromDefaultBuild-${config} COMMAND ${CMAKE_CTEST_COMMAND}
+          --build-and-test
+          "${CMake_SOURCE_DIR}/Tests/VSExcludeFromDefaultBuild"
+          "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild"
+          --build-config ${config}
+          --build-two-config
+          --build-generator ${CMAKE_TEST_GENERATOR}
+          --build-project VSExcludeFromDefaultBuild
+          --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+          --test-command ${CMAKE_COMMAND}
+             -D "activeConfig=${config}"
+             -D "allConfigs=${CMAKE_CONFIGURATION_TYPES}"
+             -D "dir=${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild"
+             -P "${CMake_SOURCE_DIR}/Tests/VSExcludeFromDefaultBuild/ResultTest.cmake")
+        if(_last_test)
+          set_property(TEST VSExcludeFromDefaultBuild-${config} PROPERTY DEPENDS ${_last_test})
+        endif()
+        set(_last_test "VSExcludeFromDefaultBuild-${config}")
+      endforeach()
+      unset(_last_test)
+      list(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/VSExcludeFromDefaultBuild")
+    endif()
   endif()
 
   if (APPLE)

+ 11 - 0
Tests/ExternalProject/CMakeLists.txt

@@ -638,6 +638,17 @@ if(do_svn_tests)
     "${binary_base}/TutorialStep1-SVN-trunk/Tutorial" 98)
 endif()
 
+if(do_git_tests)
+  add_test(TutorialStep1-GIT-byhash
+    "${binary_base}/TutorialStep1-GIT-byhash/Tutorial" 100)
+
+  add_test(TutorialStep1-GIT-bytag
+    "${binary_base}/TutorialStep1-GIT-bytag/Tutorial" 99)
+
+  add_test(TutorialStep1-GIT-master
+    "${binary_base}/TutorialStep1-GIT-master/Tutorial" 98)
+endif()
+
 
 # InstallTree tests:
 #

+ 94 - 0
Tests/ExternalProjectUpdate/CMakeLists.txt

@@ -0,0 +1,94 @@
+cmake_minimum_required(VERSION 2.8)
+project(ExternalProjectUpdateTest NONE)
+
+include(ExternalProject)
+
+find_package(Git)
+
+option(ExternalProjectUpdateTest_USE_FOLDERS "Enable folder grouping in IDEs." ON)
+if(ExternalProjectUpdateTest_USE_FOLDERS)
+  set_property(GLOBAL PROPERTY USE_FOLDERS ON)
+else()
+  set_property(GLOBAL PROPERTY USE_FOLDERS OFF)
+endif()
+
+set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER
+  "CMakePredefinedTargets-in-ExternalProjectUpdateTest")
+
+set(base "${CMAKE_BINARY_DIR}/CMakeExternals")
+set(binary_base "${base}/Build")
+set_property(DIRECTORY PROPERTY EP_BASE ${base})
+set_property(DIRECTORY PROPERTY EP_STEP_TARGETS configure build test)
+
+set(do_git_tests 0)
+
+if(GIT_EXECUTABLE)
+  set(do_git_tests 1)
+
+  execute_process(
+    COMMAND "${GIT_EXECUTABLE}" --version
+    OUTPUT_VARIABLE ov
+    OUTPUT_STRIP_TRAILING_WHITESPACE
+    )
+  string(REGEX REPLACE "^git version (.+)$" "\\1" git_version "${ov}")
+  message(STATUS "git_version='${git_version}'")
+
+  if(git_version VERSION_LESS 1.6.5)
+    message(STATUS "No ExternalProject git tests with git client less than version 1.6.5")
+    set(do_git_tests 0)
+  endif()
+endif()
+
+# This should be specified from the command line.
+if(NOT TEST_GIT_TAG)
+  set(TEST_GIT_TAG origin/master)
+endif()
+
+if(do_git_tests)
+  set(local_git_repo "../../LocalRepositories/GIT")
+
+  # Unzip/untar the git repository in our source folder so that other
+  # projects below may use it to test git args of ExternalProject_Add
+  #
+  set(proj SetupLocalGITRepository)
+  ExternalProject_Add(${proj}
+    SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/LocalRepositories/GIT
+    URL ${CMAKE_CURRENT_SOURCE_DIR}/gitrepo.tgz
+    BUILD_COMMAND ""
+    CONFIGURE_COMMAND "${GIT_EXECUTABLE}" --version
+    INSTALL_COMMAND ""
+  )
+  set_property(TARGET ${proj}
+    PROPERTY FOLDER "SetupRepos/Local/Deeply/Nested/For/Testing")
+
+  set(proj TutorialStep1-GIT)
+  ExternalProject_Add(${proj}
+    GIT_REPOSITORY "${local_git_repo}"
+    GIT_TAG ${TEST_GIT_TAG}
+    CMAKE_GENERATOR "${CMAKE_GENERATOR}"
+    CMAKE_ARGS -DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
+    INSTALL_COMMAND ""
+    DEPENDS "SetupLocalGITRepository"
+  )
+  set_property(TARGET ${proj} PROPERTY FOLDER "GIT")
+endif()
+
+
+# Test the testable built/installed products:
+#
+enable_testing()
+
+
+# Do at least a smoke test of a built executable from each
+# project's build directory...
+#
+# BuildTree tests:
+#
+
+if(do_git_tests)
+  add_test(TutorialStep1-GIT
+    "${binary_base}/TutorialStep1-GIT/Tutorial" 81)
+endif()
+
+message(STATUS "do_git_tests='${do_git_tests}'")
+message(STATUS "GIT_EXECUTABLE='${GIT_EXECUTABLE}'")

Some files were not shown because too many files changed in this diff