Explorar o código

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

Resolve conflict in Source/cmDocumentVariables.cxx by adding both
variables.
Robert Maynard %!s(int64=13) %!d(string=hai) anos
pai
achega
badb40d0f8
Modificáronse 100 ficheiros con 2716 adicións e 318 borrados
  1. 24 0
      CMakeCPackOptions.cmake.in
  2. 2 4
      CMakeLists.txt
  3. 14 0
      ChangeLog.manual
  4. 1 0
      Modules/CMakeCCompiler.cmake.in
  5. 1 0
      Modules/CMakeCXXCompiler.cmake.in
  6. 12 13
      Modules/CMakeDetermineCompilerABI.cmake
  7. 13 9
      Modules/CMakeDetermineCompilerId.cmake
  8. 2 0
      Modules/CMakeDetermineJavaCompiler.cmake
  9. 6 0
      Modules/CMakeDetermineSystem.cmake
  10. 1 0
      Modules/CMakeFortranCompiler.cmake.in
  11. 1 5
      Modules/CMakeFortranCompilerId.F.in
  12. 5 0
      Modules/CMakePackageConfigHelpers.cmake
  13. 43 8
      Modules/CMakeParseImplicitLinkInfo.cmake
  14. 1 4
      Modules/CMakePlatformId.h.in
  15. 6 1
      Modules/CPack.cmake
  16. 109 0
      Modules/CPackWIX.cmake
  17. 1 1
      Modules/CTestUseLaunchers.cmake
  18. 1 1
      Modules/CheckForPthreads.c
  19. 3 3
      Modules/CompilerId/VS-7.vcproj.in
  20. 1 1
      Modules/FindBISON.cmake
  21. 2 0
      Modules/FindBullet.cmake
  22. 6 4
      Modules/FindFLEX.cmake
  23. 3 0
      Modules/FindFreetype.cmake
  24. 21 7
      Modules/FindGLUT.cmake
  25. 0 2
      Modules/FindGettext.cmake
  26. 9 0
      Modules/FindJNI.cmake
  27. 7 0
      Modules/FindJava.cmake
  28. 2 2
      Modules/FindLua51.cmake
  29. 21 9
      Modules/FindOpenGL.cmake
  30. 4 1
      Modules/FindPackageHandleStandardArgs.cmake
  31. 14 0
      Modules/FindQt.cmake
  32. 4 2
      Modules/FindQt3.cmake
  33. 96 11
      Modules/FindQt4.cmake
  34. 1 1
      Modules/FindSDL.cmake
  35. 2 1
      Modules/FindSDL_image.cmake
  36. 2 1
      Modules/FindSDL_mixer.cmake
  37. 2 1
      Modules/FindSDL_net.cmake
  38. 2 1
      Modules/FindSDL_sound.cmake
  39. 2 1
      Modules/FindSDL_ttf.cmake
  40. 8 0
      Modules/FindTCL.cmake
  41. 5 2
      Modules/NSIS.template.in
  42. 1 0
      Modules/Platform/Darwin-Clang.cmake
  43. 1 0
      Modules/Platform/Darwin-GNU.cmake
  44. 18 0
      Modules/Platform/Darwin.cmake
  45. 4 0
      Modules/Platform/OpenBSD.cmake
  46. 1 1
      Modules/Platform/Windows-Intel.cmake
  47. 2 2
      Modules/Platform/Windows-MSVC.cmake
  48. 10 2
      Modules/UseQt4.cmake
  49. 44 0
      Modules/WIX.template.in
  50. 10 0
      Source/CMakeLists.txt
  51. 1 1
      Source/CMakeVersion.cmake
  52. 571 0
      Source/CPack/WiX/cmCPackWIXGenerator.cxx
  53. 101 0
      Source/CPack/WiX/cmCPackWIXGenerator.h
  54. 137 0
      Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx
  55. 46 0
      Source/CPack/WiX/cmWIXRichTextFormatWriter.h
  56. 189 0
      Source/CPack/WiX/cmWIXSourceWriter.cxx
  57. 67 0
      Source/CPack/WiX/cmWIXSourceWriter.h
  58. 1 2
      Source/CPack/cmCPackGenerator.cxx
  59. 15 2
      Source/CPack/cmCPackGeneratorFactory.cxx
  60. 17 1
      Source/CPack/cmCPackNSISGenerator.cxx
  61. 6 1
      Source/CPack/cmCPackNSISGenerator.h
  62. 1 2
      Source/CPack/cpack.cxx
  63. 11 4
      Source/CTest/cmCTestCoverageHandler.cxx
  64. 6 1
      Source/CTest/cmCTestMultiProcessHandler.cxx
  65. 1 2
      Source/CTest/cmCTestTestHandler.cxx
  66. 4 0
      Source/cmAddLibraryCommand.h
  67. 1 0
      Source/cmBootstrapCommands.cxx
  68. 1 1
      Source/cmCTest.cxx
  69. 2 2
      Source/cmCommandArgumentParser.cxx
  70. 5 0
      Source/cmCommands.cxx
  71. 6 5
      Source/cmComputeLinkDepends.cxx
  72. 2 1
      Source/cmComputeLinkDepends.h
  73. 32 8
      Source/cmComputeLinkInformation.cxx
  74. 3 1
      Source/cmComputeLinkInformation.h
  75. 92 6
      Source/cmComputeTargetDepends.cxx
  76. 5 1
      Source/cmComputeTargetDepends.h
  77. 2 2
      Source/cmCustomCommandGenerator.cxx
  78. 10 0
      Source/cmDocumentGeneratorExpressions.h
  79. 36 0
      Source/cmDocumentVariables.cxx
  80. 34 2
      Source/cmExportBuildFileGenerator.cxx
  81. 228 1
      Source/cmExportFileGenerator.cxx
  82. 21 0
      Source/cmExportFileGenerator.h
  83. 36 2
      Source/cmExportInstallFileGenerator.cxx
  84. 5 0
      Source/cmExtraCodeBlocksGenerator.cxx
  85. 57 0
      Source/cmFileCommand.cxx
  86. 9 0
      Source/cmFileCommand.h
  87. 2 2
      Source/cmFindBase.cxx
  88. 4 2
      Source/cmFindPathCommand.cxx
  89. 126 38
      Source/cmGeneratorExpression.cxx
  90. 33 12
      Source/cmGeneratorExpression.h
  91. 10 8
      Source/cmGeneratorExpressionDAGChecker.cxx
  92. 9 3
      Source/cmGeneratorExpressionDAGChecker.h
  93. 168 13
      Source/cmGeneratorExpressionEvaluator.cxx
  94. 12 2
      Source/cmGeneratorExpressionEvaluator.h
  95. 9 1
      Source/cmGeneratorExpressionParser.cxx
  96. 3 79
      Source/cmGeneratorTarget.cxx
  97. 0 6
      Source/cmGeneratorTarget.h
  98. 18 1
      Source/cmGlobalGenerator.cxx
  99. 1 2
      Source/cmGlobalVisualStudio10Generator.cxx
  100. 9 0
      Source/cmGlobalVisualStudio11Generator.cxx

+ 24 - 0
CMakeCPackOptions.cmake.in

@@ -51,3 +51,27 @@ if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
     set(CPACK_PACKAGE_DEFAULT_LOCATION "/usr")
   endif()
 endif()
+
+if("${CPACK_GENERATOR}" STREQUAL "WIX")
+  # Reset CPACK_PACKAGE_VERSION to deal with WiX restriction.
+  # But the file names still use the full CMake_VERSION value:
+  set(CPACK_PACKAGE_FILE_NAME
+    "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-${CPACK_SYSTEM_NAME}")
+  set(CPACK_SOURCE_PACKAGE_FILE_NAME
+    "${CPACK_PACKAGE_NAME}-@CMake_VERSION@-Source")
+
+  if(NOT CPACK_WIX_SIZEOF_VOID_P)
+    set(CPACK_WIX_SIZEOF_VOID_P "@CMAKE_SIZEOF_VOID_P@")
+  endif()
+
+  set(CPACK_PACKAGE_VERSION
+    "@CMake_VERSION_MAJOR@.@CMake_VERSION_MINOR@.@CMake_VERSION_PATCH@")
+  # WIX installers require at most a 4 component version number, where
+  # each component is an integer between 0 and 65534 inclusive
+  set(tweak "@CMake_VERSION_TWEAK@")
+  if(tweak MATCHES "^[0-9]+$")
+    if(tweak GREATER 0 AND tweak LESS 65535)
+      set(CPACK_PACKAGE_VERSION "${CPACK_PACKAGE_VERSION}.${tweak}")
+    endif()
+  endif()
+endif()

+ 2 - 4
CMakeLists.txt

@@ -234,8 +234,6 @@ macro (CMAKE_BUILD_UTILITIES)
   set(kwsys_folder "Utilities/KWSys")
   CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE} "${kwsys_folder}")
   CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}_c "${kwsys_folder}")
-  CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}EncodeExecutable "${kwsys_folder}")
-  CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}ProcessFwd9x "${kwsys_folder}")
   if(BUILD_TESTING)
     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestDynload "${kwsys_folder}")
     CMAKE_SET_TARGET_FOLDER(${KWSYS_NAMESPACE}TestProcess "${kwsys_folder}")
@@ -590,10 +588,10 @@ if(NOT CMake_VERSION_IS_RELEASE)
       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
+                     -Wmissing-format-attribute -fno-common -Wundef
     )
     set(CXX_FLAGS_LIST -Wnon-virtual-dtor -Wcast-align -Wchar-subscripts -Wall -W
-                       -Wshadow -Wpointer-arith -Wformat-security
+                       -Wshadow -Wpointer-arith -Wformat-security -Wundef
     )
 
     foreach(FLAG_LANG  C CXX)

+ 14 - 0
ChangeLog.manual

@@ -1,3 +1,17 @@
+Changes in CMake 2.8.10.2 (since 2.8.10.1)
+----------------------------------------------
+Alex Neundorf (1):
+      Automoc: fix regression #13667, broken build in phonon
+
+Brad King (1):
+      Initialize IMPORTED GLOBAL targets on reconfigure (#13702)
+
+David Cole (1):
+      CMake: Fix infinite loop untarring corrupt tar file
+
+Rolf Eike Beer (1):
+      FindGettext: fix overwriting result with empty variable (#13691)
+
 Changes in CMake 2.8.10.1 (since 2.8.10)
 ----------------------------------------------
 Brad King (5):

+ 1 - 0
Modules/CMakeCCompiler.cmake.in

@@ -50,6 +50,7 @@ endif()
 
 set(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@")
 set(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@")
+set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
 
 @SET_CMAKE_CMCLDEPS_EXECUTABLE@
 @SET_CMAKE_CL_SHOWINCLUDE_PREFIX@

+ 1 - 0
Modules/CMakeCXXCompiler.cmake.in

@@ -51,6 +51,7 @@ endif()
 
 set(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@")
 set(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@")
+set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")
 
 @SET_CMAKE_CMCLDEPS_EXECUTABLE@
 @SET_CMAKE_CL_SHOWINCLUDE_PREFIX@

+ 12 - 13
Modules/CMakeDetermineCompilerABI.cmake

@@ -72,19 +72,9 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
       # Parse implicit linker information for this language, if available.
       set(implicit_dirs "")
       set(implicit_libs "")
-      set(MULTI_ARCH FALSE)
-      if(DEFINED CMAKE_OSX_ARCHITECTURES)
-        if( "${CMAKE_OSX_ARCHITECTURES}" MATCHES ";" )
-          set(MULTI_ARCH TRUE)
-        endif()
-      endif()
-      if(CMAKE_${lang}_VERBOSE_FLAG
-          # Implicit link information cannot be used explicitly for
-          # multiple OS X architectures, so we skip it.
-          AND NOT MULTI_ARCH
-          # Skip this with Xcode for now.
-          AND NOT "${CMAKE_GENERATOR}" MATCHES Xcode)
-        CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs log
+      set(implicit_fwks "")
+      if(CMAKE_${lang}_VERBOSE_FLAG)
+        CMAKE_PARSE_IMPLICIT_LINK_INFO("${OUTPUT}" implicit_libs implicit_dirs implicit_fwks log
           "${CMAKE_${lang}_IMPLICIT_OBJECT_REGEX}")
         file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
           "Parsed ${lang} implicit link information from above output:\n${log}\n\n")
@@ -112,8 +102,17 @@ function(CMAKE_DETERMINE_COMPILER_ABI lang src)
         message(STATUS "${_desc}")
       endif()
 
+      # Implicit link libraries cannot be used explicitly for multiple
+      # OS X architectures, so we skip it.
+      if(DEFINED CMAKE_OSX_ARCHITECTURES)
+        if("${CMAKE_OSX_ARCHITECTURES}" MATCHES ";")
+          set(implicit_libs "")
+        endif()
+      endif()
+
       set(CMAKE_${lang}_IMPLICIT_LINK_LIBRARIES "${implicit_libs}" PARENT_SCOPE)
       set(CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES "${implicit_dirs}" PARENT_SCOPE)
+      set(CMAKE_${lang}_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "${implicit_fwks}" PARENT_SCOPE)
 
       # Detect library architecture directory name.
       if(CMAKE_LIBRARY_ARCHITECTURE_REGEX)

+ 13 - 9
Modules/CMakeDetermineCompilerId.cmake

@@ -107,11 +107,14 @@ Id flags: ${testflags}
 ")
 
   # Compile the compiler identification source.
-  if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)( .NET)?( 200[358])? *((Win64|IA64|ARM))?")
+  if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([0-9]+)")
     set(vs_version ${CMAKE_MATCH_1})
-    set(vs_arch ${CMAKE_MATCH_4})
+    set(id_arch ${CMAKE_VS_PLATFORM_NAME})
     set(id_lang "${lang}")
     set(id_cl cl.exe)
+    if(NOT id_arch)
+      set(id_arch Win32)
+    endif()
     if(NOT "${vs_version}" VERSION_LESS 10)
       set(v 10)
       set(ext vcxproj)
@@ -123,25 +126,26 @@ Id flags: ${testflags}
       set(v 6)
       set(ext dsp)
     endif()
-    if("${vs_arch}" STREQUAL "Win64")
-      set(id_machine_7 17)
+    if("${id_arch}" STREQUAL "x64")
       set(id_machine_10 MachineX64)
-      set(id_arch x64)
-    elseif("${vs_arch}" STREQUAL "IA64")
-      set(id_machine_7 5)
+    elseif("${id_arch}" STREQUAL "Itanium")
       set(id_machine_10 MachineIA64)
       set(id_arch ia64)
     else()
       set(id_machine_6 x86)
-      set(id_machine_7 1)
       set(id_machine_10 MachineX86)
-      set(id_arch Win32)
     endif()
     if(CMAKE_VS_PLATFORM_TOOLSET)
       set(id_toolset "<PlatformToolset>${CMAKE_VS_PLATFORM_TOOLSET}</PlatformToolset>")
     else()
       set(id_toolset "")
     endif()
+    if(CMAKE_VS_WINCE_VERSION)
+      set(id_entrypoint "mainACRTStartup")
+      set(id_subsystem 9)
+    else()
+      set(id_subsystem 1)
+    endif()
     if("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Bb][Uu][Ii][Ll][Dd]")
       set(build /p:Configuration=Debug /p:Platform=@id_arch@ /p:VisualStudioVersion=${vs_version}.0)
     elseif("${CMAKE_MAKE_PROGRAM}" MATCHES "[Mm][Ss][Dd][Ee][Vv]")

+ 2 - 0
Modules/CMakeDetermineJavaCompiler.cmake

@@ -63,6 +63,8 @@ if(NOT CMAKE_Java_COMPILER)
     /usr/java/j2sdk1.4.2_09/bin
     /usr/lib/j2sdk1.5-sun/bin
     /opt/sun-jdk-1.5.0.04/bin
+    /usr/local/jdk-1.7.0/bin
+    /usr/local/jdk-1.6.0/bin
     )
   # if no compiler has been specified yet, then look for one
   if(CMAKE_Java_COMPILER_INIT)

+ 6 - 0
Modules/CMakeDetermineSystem.cmake

@@ -106,6 +106,12 @@ if(CMAKE_SYSTEM_NAME)
     set(CMAKE_CROSSCOMPILING TRUE)
   endif()
   set(PRESET_CMAKE_SYSTEM_NAME TRUE)
+elseif(CMAKE_VS_WINCE_VERSION)
+  set(CMAKE_SYSTEM_NAME      "WindowsCE")
+  set(CMAKE_SYSTEM_VERSION   "${CMAKE_VS_WINCE_VERSION}")
+  set(CMAKE_SYSTEM_PROCESSOR "${MSVC_C_ARCHITECTURE_ID}")
+  set(CMAKE_CROSSCOMPILING TRUE)
+  set(PRESET_CMAKE_SYSTEM_NAME TRUE)
 else()
   set(CMAKE_SYSTEM_NAME      "${CMAKE_HOST_SYSTEM_NAME}")
   set(CMAKE_SYSTEM_VERSION   "${CMAKE_HOST_SYSTEM_VERSION}")

+ 1 - 0
Modules/CMakeFortranCompiler.cmake.in

@@ -52,3 +52,4 @@ endif()
 
 set(CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES "@CMAKE_Fortran_IMPLICIT_LINK_LIBRARIES@")
 set(CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_DIRECTORIES@")
+set(CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_Fortran_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@")

+ 1 - 5
Modules/CMakeFortranCompilerId.F.in

@@ -74,12 +74,8 @@
         PRINT *, 'INFO:platform[IRIX]'
 #elif defined(__hpux) || defined(__hpux__)
         PRINT *, 'INFO:platform[HP-UX]'
-#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
+#elif defined(__HAIKU__)
         PRINT *, 'INFO:platform[Haiku]'
-#       if 0
-!       Haiku also defines __BEOS__ so we must
-!       put it prior to the check for __BEOS__
-#       endif
 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
         PRINT *, 'INFO:platform[BeOS]'
 #elif defined(__QNX__) || defined(__QNXNTO__)

+ 5 - 0
Modules/CMakePackageConfigHelpers.cmake

@@ -188,8 +188,13 @@ function(CONFIGURE_PACKAGE_CONFIG_FILE _inputFile _outputFile)
     endif()
   endforeach()
 
+  get_filename_component(inputFileName "${_inputFile}" NAME)
+
   set(PACKAGE_INIT "
 ####### Expanded from @PACKAGE_INIT@ by configure_package_config_file() #######
+####### Any changes to this file will be overwritten by the next CMake run ####
+####### The input file was ${inputFileName}                            ########
+
 get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE_RELATIVE_PATH}\" ABSOLUTE)
 ")
 

+ 43 - 8
Modules/CMakeParseImplicitLinkInfo.cmake

@@ -16,9 +16,10 @@
 # This is used internally by CMake and should not be included by user
 # code.
 
-function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex)
+function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj_regex)
   set(implicit_libs_tmp "")
   set(implicit_dirs_tmp)
+  set(implicit_fwks_tmp)
   set(log "")
 
   # Parse implicit linker arguments.
@@ -36,6 +37,16 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex)
     set(cmd)
     if("${line}" MATCHES "${linker_regex}" AND
         NOT "${line}" MATCHES "${linker_exclude_regex}")
+      if(XCODE)
+        # Xcode unconditionally adds a path under the project build tree and
+        # on older versions it is not reported with proper quotes.  Remove it.
+        string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _dir_regex "${CMAKE_BINARY_DIR}")
+        string(REGEX REPLACE " -[FL]${_dir_regex}/([^ ]| [^-])+( |$)" " " xline "${line}")
+        if(NOT "x${xline}" STREQUAL "x${line}")
+          set(log "${log}  reduced line: [${line}]\n            to: [${xline}]\n")
+          set(line "${xline}")
+        endif()
+      endif()
       if(UNIX)
         separate_arguments(args UNIX_COMMAND "${line}")
       else()
@@ -97,6 +108,18 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex)
     endif()
   endforeach()
 
+  # Look for library search paths reported by linker.
+  if("${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)")
+    string(REPLACE ";\t" ";" implicit_dirs_match "${CMAKE_MATCH_1}")
+    set(log "${log}  Library search paths: [${implicit_dirs_match}]\n")
+    list(APPEND implicit_dirs_tmp ${implicit_dirs_match})
+  endif()
+  if("${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)")
+    string(REPLACE ";\t" ";" implicit_fwks_match "${CMAKE_MATCH_1}")
+    set(log "${log}  Framework search paths: [${implicit_fwks_match}]\n")
+    list(APPEND implicit_fwks_tmp ${implicit_fwks_match})
+  endif()
+
   # Cleanup list of libraries and flags.
   # We remove items that are not language-specific.
   set(implicit_libs "")
@@ -108,21 +131,33 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var log_var obj_regex)
     endif()
   endforeach()
 
-  # Cleanup list of directories.
-  set(implicit_dirs "")
-  foreach(d IN LISTS implicit_dirs_tmp)
-    get_filename_component(dir "${d}" ABSOLUTE)
-    list(APPEND implicit_dirs "${dir}")
-    set(log "${log}  collapse dir [${d}] ==> [${dir}]\n")
+  # Cleanup list of library and framework directories.
+  set(desc_dirs "library")
+  set(desc_fwks "framework")
+  foreach(t dirs fwks)
+    set(implicit_${t} "")
+    foreach(d IN LISTS implicit_${t}_tmp)
+      get_filename_component(dir "${d}" ABSOLUTE)
+      string(FIND "${dir}" "${CMAKE_FILES_DIRECTORY}/" pos)
+      if(NOT pos LESS 0)
+        set(msg ", skipping non-system directory")
+      else()
+        set(msg "")
+        list(APPEND implicit_${t} "${dir}")
+      endif()
+      set(log "${log}  collapse ${desc_${t}} dir [${d}] ==> [${dir}]${msg}\n")
+    endforeach()
+    list(REMOVE_DUPLICATES implicit_${t})
   endforeach()
-  list(REMOVE_DUPLICATES implicit_dirs)
 
   # Log results.
   set(log "${log}  implicit libs: [${implicit_libs}]\n")
   set(log "${log}  implicit dirs: [${implicit_dirs}]\n")
+  set(log "${log}  implicit fwks: [${implicit_fwks}]\n")
 
   # Return results.
   set(${lib_var} "${implicit_libs}" PARENT_SCOPE)
   set(${dir_var} "${implicit_dirs}" PARENT_SCOPE)
+  set(${fwk_var} "${implicit_fwks}" PARENT_SCOPE)
   set(${log_var} "${log}" PARENT_SCOPE)
 endfunction()

+ 1 - 4
Modules/CMakePlatformId.h.in

@@ -35,11 +35,8 @@
 #elif defined(__hpux) || defined(__hpux__)
 # define PLATFORM_ID "HP-UX"
 
-#elif defined(__HAIKU) || defined(__HAIKU__) || defined(_HAIKU)
+#elif defined(__HAIKU__)
 # define PLATFORM_ID "Haiku"
-/* Haiku also defines __BEOS__ so we must
-   put it prior to the check for __BEOS__
-*/
 
 #elif defined(__BeOS) || defined(__BEOS__) || defined(_BEOS)
 # define PLATFORM_ID "BeOS"

+ 6 - 1
Modules/CPack.cmake

@@ -438,6 +438,7 @@ if(NOT CPACK_GENERATOR)
     endif()
   else()
     option(CPACK_BINARY_NSIS "Enable to build NSIS packages" ON)
+    option(CPACK_BINARY_WIX  "Enable to build WiX packages" OFF)
     option(CPACK_BINARY_ZIP  "Enable to build ZIP packages" OFF)
   endif()
 
@@ -453,6 +454,7 @@ if(NOT CPACK_GENERATOR)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TGZ          TGZ)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TBZ2         TBZ2)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_TZ           TZ)
+  cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_WIX          WIX)
   cpack_optional_append(CPACK_GENERATOR  CPACK_BINARY_ZIP          ZIP)
 
 endif()
@@ -483,7 +485,7 @@ endif()
 mark_as_advanced(CPACK_BINARY_CYGWIN CPACK_BINARY_PACKAGEMAKER CPACK_BINARY_OSXX11
                  CPACK_BINARY_STGZ   CPACK_BINARY_TGZ          CPACK_BINARY_TBZ2
                  CPACK_BINARY_DEB    CPACK_BINARY_RPM          CPACK_BINARY_TZ
-                 CPACK_BINARY_NSIS CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
+                 CPACK_BINARY_NSIS CPACK_BINARY_WIX CPACK_BINARY_ZIP CPACK_BINARY_BUNDLE
                  CPACK_SOURCE_CYGWIN CPACK_SOURCE_TBZ2 CPACK_SOURCE_TGZ
                  CPACK_SOURCE_TZ CPACK_SOURCE_ZIP CPACK_BINARY_DRAGNDROP)
 
@@ -522,6 +524,9 @@ cpack_set_if_not_set(CPACK_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}")
 cpack_set_if_not_set(CPACK_NSIS_INSTALLER_ICON_CODE "")
 cpack_set_if_not_set(CPACK_NSIS_INSTALLER_MUI_ICON_CODE "")
 
+# WiX specific variables
+cpack_set_if_not_set(CPACK_WIX_SIZEOF_VOID_P "${CMAKE_SIZEOF_VOID_P}")
+
 if(DEFINED CPACK_COMPONENTS_ALL)
   if(CPACK_MONOLITHIC_INSTALL)
     message("CPack warning: both CPACK_COMPONENTS_ALL and CPACK_MONOLITHIC_INSTALL have been set.\nDefaulting to a monolithic installation.")

+ 109 - 0
Modules/CPackWIX.cmake

@@ -0,0 +1,109 @@
+##section Variables specific to CPack WiX generator
+##end
+##module
+# - CPack WiX generator specific options
+#
+# The following variables are specific to the installers built
+# on Windows using WiX.
+##end
+##variable
+#  CPACK_WIX_UPGRADE_GUID - Upgrade GUID (Product/@UpgradeCode)
+#
+# Will be automatically generated unless explicitly provided.
+#
+# It should be explicitly set to a constant generated
+# gloabally unique identifier (GUID) to allow your installers
+# to replace existing installations that use the same GUID.
+#
+# You may for example explicitly set this variable in
+# your CMakeLists.txt to the value that has been generated per default.
+# You should not use GUIDs that you did not generate yourself or which may
+# belong to other projects.
+#
+# A GUID shall have the following fixed length syntax:
+# XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
+#  (each X represents an uppercase hexadecimal digit)
+##end
+##variable
+#  CPACK_WIX_PRODUCT_GUID - Product GUID (Product/@Id)
+#
+# Will be automatically generated unless explicitly provided.
+#
+# If explicitly provided this will set the Product Id of your installer.
+#
+# The installer will abort if it detects a pre-existing installation that uses
+# the same GUID.
+#
+# The GUID shall use the syntax described for CPACK_WIX_UPGRADE_GUID.
+##end
+##variable
+#  CPACK_WIX_LICENSE_RTF - RTF License File
+#
+# If CPACK_RESOURCE_FILE_LICENSE has an .rtf extension
+# it is used as-is.
+#
+# If CPACK_RESOURCE_FILE_LICENSE has an .txt extension
+# it is implicitly converted to RTF by the WiX Generator.
+#
+# With CPACK_WIX_LICENSE_RTF you can override the license file used
+# by the WiX Generator in case CPACK_RESOURCE_FILE_LICENSE
+# is in an unsupported format or the .txt -> .rtf
+# conversion does not work as expected.
+#
+##end
+#
+##variable
+# CPACK_WIX_PRODUCT_ICON - The Icon shown next to the program name in Add/Remove programs.
+#
+# If set, this icon is used in place of the default icon.
+#
+##end
+#
+##variable
+# CPACK_WIX_UI_BANNER - The bitmap will appear at the top of all installer pages other than the welcome and completion dialogs.
+#
+# If set, this image will replace the default banner image.
+#
+# This image must be 493 by 58 pixels.
+#
+##end
+#
+##variable
+# CPACK_WIX_UI_DIALOG - Background bitmap used on the welcome and completion dialogs.
+#
+# If this variable is set, the installer will replace the default dialog image.
+#
+# This image must be 493 by 312 pixels.
+#
+##end
+
+#=============================================================================
+# Copyright 2012 Kitware, Inc.
+#
+# Distributed under the OSI-approved BSD License (the "License");
+# see accompanying file Copyright.txt for details.
+#
+# This software is distributed WITHOUT ANY WARRANTY; without even the
+# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+# See the License for more information.
+#=============================================================================
+# (To distribute this file outside of CMake, substitute the full
+#  License text for the above reference.)
+
+if(NOT CPACK_WIX_ROOT)
+  file(TO_CMAKE_PATH "$ENV{WIX}" CPACK_WIX_ROOT)
+endif()
+
+find_program(CPACK_WIX_CANDLE_EXECUTABLE candle
+  PATHS "${CPACK_WIX_ROOT}/bin")
+
+if(NOT CPACK_WIX_CANDLE_EXECUTABLE)
+  message(FATAL_ERROR "Could not find the WiX candle executable.")
+endif()
+
+find_program(CPACK_WIX_LIGHT_EXECUTABLE light
+  PATHS "${CPACK_WIX_ROOT}/bin")
+
+if(NOT CPACK_WIX_LIGHT_EXECUTABLE)
+  message(FATAL_ERROR "Could not find the WiX light executable.")
+endif()

+ 1 - 1
Modules/CTestUseLaunchers.cmake

@@ -35,7 +35,7 @@ if(NOT DEFINED CTEST_USE_LAUNCHERS AND DEFINED ENV{CTEST_USE_LAUNCHERS_DEFAULT})
     CACHE INTERNAL "CTEST_USE_LAUNCHERS initial value from ENV")
 endif()
 
-if(NOT "${CMAKE_GENERATOR}" MATCHES "Make")
+if(NOT "${CMAKE_GENERATOR}" MATCHES "Make|Ninja")
   set(CTEST_USE_LAUNCHERS 0)
 endif()
 

+ 1 - 1
Modules/CheckForPthreads.c

@@ -16,7 +16,7 @@ int main(int ac, char*av[]){
   pthread_create(&tid[0], 0, runner, (void*)1);
   pthread_create(&tid[1], 0, runner, (void*)2);
 
-#if defined(__BEOS__) && !defined(__ZETA__)  && !defined(__HAIKU__) // (no usleep on BeOS 5.)
+#if defined(__BEOS__) && !defined(__ZETA__) // (no usleep on BeOS 5.)
   usleep(1); // for strange behavior on single-processor sun
 #endif
 

+ 3 - 3
Modules/CompilerId/VS-7.vcproj.in

@@ -24,7 +24,6 @@
 			<Tool
 				Name="VCCLCompilerTool"
 				Optimization="0"
-				PreprocessorDefinitions=""
 				MinimalRebuild="false"
 				BasicRuntimeChecks="3"
 				RuntimeLibrary="3"
@@ -35,9 +34,10 @@
 			<Tool
 				Name="VCLinkerTool"
 				LinkIncremental="1"
+				IgnoreDefaultLibraryNames="libc"
 				GenerateDebugInformation="false"
-				SubSystem="1"
-				TargetMachine="@id_machine_7@"
+				SubSystem="@id_subsystem@"
+				EntryPointSymbol="@id_entrypoint@"
 			/>
 			<Tool
 				Name="VCPostBuildEventTool"

+ 1 - 1
Modules/FindBISON.cmake

@@ -47,7 +47,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-find_program(BISON_EXECUTABLE bison DOC "path to the bison executable")
+find_program(BISON_EXECUTABLE NAMES bison win_bison DOC "path to the bison executable")
 mark_as_advanced(BISON_EXECUTABLE)
 
 if(BISON_EXECUTABLE)

+ 2 - 0
Modules/FindBullet.cmake

@@ -33,6 +33,8 @@ macro(_FIND_BULLET_LIBRARY _var)
         ${ARGN}
      HINTS
         ${BULLET_ROOT}
+        ${BULLET_ROOT}/lib/Release
+        ${BULLET_ROOT}/lib/Debug
         ${BULLET_ROOT}/out/release8/libs
         ${BULLET_ROOT}/out/debug8/libs
      PATH_SUFFIXES lib

+ 6 - 4
Modules/FindFLEX.cmake

@@ -63,7 +63,7 @@
 # (To distribute this file outside of CMake, substitute the full
 #  License text for the above reference.)
 
-find_program(FLEX_EXECUTABLE flex DOC "path to the flex executable")
+find_program(FLEX_EXECUTABLE NAMES flex win_flex DOC "path to the flex executable")
 mark_as_advanced(FLEX_EXECUTABLE)
 
 find_library(FL_LIBRARY NAMES fl
@@ -93,10 +93,12 @@ if(FLEX_EXECUTABLE)
   else()
     # older versions of flex printed "/full/path/to/executable version X.Y"
     # newer versions use "basename(executable) X.Y"
-    get_filename_component(FLEX_EXE_NAME "${FLEX_EXECUTABLE}" NAME)
-    string(REGEX REPLACE "^.*${FLEX_EXE_NAME}\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\2"
+    get_filename_component(FLEX_EXE_NAME_WE "${FLEX_EXECUTABLE}" NAME_WE)
+    get_filename_component(FLEX_EXE_EXT "${FLEX_EXECUTABLE}" EXT)
+    string(REGEX REPLACE "^.*${FLEX_EXE_NAME_WE}(${FLEX_EXE_EXT})?\"? (version )?([0-9]+[^ ]*)( .*)?$" "\\3"
       FLEX_VERSION "${FLEX_version_output}")
-    unset(FLEX_EXE_NAME)
+    unset(FLEX_EXE_EXT)
+    unset(FLEX_EXE_NAME_WE)
   endif()
 
   #============================================================

+ 3 - 0
Modules/FindFreetype.cmake

@@ -46,6 +46,7 @@ find_path(FREETYPE_INCLUDE_DIR_ft2build ft2build.h
   HINTS
     ENV FREETYPE_DIR
   PATHS
+    /usr/X11R6
     /usr/local/X11R6
     /usr/local/X11
     /usr/freeware
@@ -56,6 +57,7 @@ find_path(FREETYPE_INCLUDE_DIR_freetype2 freetype/config/ftheader.h
   HINTS
     ENV FREETYPE_DIR
   PATHS
+    /usr/X11R6
     /usr/local/X11R6
     /usr/local/X11
     /usr/freeware
@@ -68,6 +70,7 @@ find_library(FREETYPE_LIBRARY
     ENV FREETYPE_DIR
   PATH_SUFFIXES lib
   PATHS
+  /usr/X11R6
   /usr/local/X11R6
   /usr/local/X11
   /usr/freeware

+ 21 - 7
Modules/FindGLUT.cmake

@@ -40,25 +40,39 @@ else ()
     set(GLUT_cocoa_LIBRARY "-framework Cocoa" CACHE STRING "Cocoa framework for OSX")
   else ()
 
+    if (BEOS)
+
+      set(_GLUT_INC_DIR /boot/develop/headers/os/opengl)
+      set(_GLUT_glut_LIB_DIR /boot/develop/lib/x86)
+
+    else()
+
+      find_library( GLUT_Xi_LIBRARY Xi
+        /usr/openwin/lib
+        )
+
+      find_library( GLUT_Xmu_LIBRARY Xmu
+        /usr/openwin/lib
+        )
+
+    endif ()
+
     find_path( GLUT_INCLUDE_DIR GL/glut.h
       /usr/include/GL
       /usr/openwin/share/include
       /usr/openwin/include
       /opt/graphics/OpenGL/include
       /opt/graphics/OpenGL/contrib/libglut
+      ${_GLUT_INC_DIR}
       )
 
     find_library( GLUT_glut_LIBRARY glut
       /usr/openwin/lib
+      ${_GLUT_glut_LIB_DIR}
       )
 
-    find_library( GLUT_Xi_LIBRARY Xi
-      /usr/openwin/lib
-      )
-
-    find_library( GLUT_Xmu_LIBRARY Xmu
-      /usr/openwin/lib
-      )
+    unset(_GLUT_INC_DIR)
+    unset(_GLUT_glut_LIB_DIR)
 
   endif ()
 

+ 0 - 2
Modules/FindGettext.cmake

@@ -209,5 +209,3 @@ function(GETTEXT_PROCESS_PO_FILES _lang)
    add_dependencies(pofiles ${uniqueTargetName})
 
 endfunction()
-
-set(GETTEXT_FOUND ${Gettext_FOUND})

+ 9 - 0
Modules/FindJNI.cmake

@@ -120,6 +120,11 @@ JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
   /usr/lib/jvm/default-java/jre/lib/{libarch}
   /usr/lib/jvm/default-java/jre/lib
   /usr/lib/jvm/default-java/lib
+  # OpenBSD specific paths for default JVM
+  /usr/local/jdk-1.7.0/jre/lib/{libarch}
+  /usr/local/jre-1.7.0/lib/{libarch}
+  /usr/local/jdk-1.6.0/jre/lib/{libarch}
+  /usr/local/jre-1.6.0/lib/{libarch}
   )
 
 set(JAVA_JVM_LIBRARY_DIRECTORIES)
@@ -153,6 +158,9 @@ set(JAVA_AWT_INCLUDE_DIRECTORIES
   /opt/sun-jdk-1.5.0.04/include
   # Debian specific path for default JVM
   /usr/lib/jvm/default-java/include
+  # OpenBSD specific path for default JVM
+  /usr/local/jdk-1.7.0/include
+  /usr/local/jdk-1.6.0/include
   )
 
 foreach(JAVA_PROG "${JAVA_RUNTIME}" "${JAVA_COMPILE}" "${JAVA_ARCHIVE}")
@@ -227,6 +235,7 @@ find_path(JAVA_INCLUDE_PATH2 jni_md.h
   ${JAVA_INCLUDE_PATH}/win32
   ${JAVA_INCLUDE_PATH}/linux
   ${JAVA_INCLUDE_PATH}/freebsd
+  ${JAVA_INCLUDE_PATH}/openbsd
   ${JAVA_INCLUDE_PATH}/solaris
   ${JAVA_INCLUDE_PATH}/hp-ux
   ${JAVA_INCLUDE_PATH}/alpha

+ 7 - 0
Modules/FindJava.cmake

@@ -80,6 +80,8 @@ set(_JAVA_PATHS
   /usr/java/j2sdk1.4.2_09/bin
   /usr/lib/j2sdk1.5-sun/bin
   /opt/sun-jdk-1.5.0.04/bin
+  /usr/local/jdk-1.7.0/bin
+  /usr/local/jdk-1.6.0/bin
   )
 find_program(Java_JAVA_EXECUTABLE
   NAMES java
@@ -107,6 +109,7 @@ if(Java_JAVA_EXECUTABLE)
       # 2. OpenJDK 1.6
       # 3. GCJ 1.5
       # 4. Kaffe 1.4.2
+      # 5. OpenJDK 1.7.x on OpenBSD
       if(var MATCHES "java version \"[0-9]+\\.[0-9]+\\.[0-9_.]+.*\".*")
         # This is most likely Sun / OpenJDK, or maybe GCJ-java compat layer
         string( REGEX REPLACE ".* version \"([0-9]+\\.[0-9]+\\.[0-9_.]+.*)\".*"
@@ -115,6 +118,10 @@ if(Java_JAVA_EXECUTABLE)
         # Kaffe style
         string( REGEX REPLACE "java full version \"kaffe-([0-9]+\\.[0-9]+\\.[0-9_]+).*"
                 "\\1" Java_VERSION_STRING "${var}" )
+      elseif(var MATCHES "openjdk version \"[0-9]+\\.[0-9]+\\.[0-9_]+\".*")
+        # OpenJDK ver 1.7.x on OpenBSD
+        string( REGEX REPLACE "openjdk version \"([0-9]+\\.[0-9]+\\.[0-9_]+).*"
+                "\\1" Java_VERSION_STRING "${var}" )
       else()
         if(NOT Java_FIND_QUIETLY)
           message(WARNING "regex not supported: ${var}. Please report")

+ 2 - 2
Modules/FindLua51.cmake

@@ -28,7 +28,7 @@
 find_path(LUA_INCLUDE_DIR lua.h
   HINTS
     ENV LUA_DIR
-  PATH_SUFFIXES include/lua51 include/lua5.1 include/lua include
+  PATH_SUFFIXES include/lua51 include/lua5.1 include/lua-5.1 include/lua include
   PATHS
   ~/Library/Frameworks
   /Library/Frameworks
@@ -54,7 +54,7 @@ find_library(LUA_LIBRARY
 
 if(LUA_LIBRARY)
   # include the math library for Unix
-  if(UNIX AND NOT APPLE)
+  if(UNIX AND NOT APPLE AND NOT BEOS)
     find_library(LUA_MATH_LIBRARY m)
     set( LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}" CACHE STRING "Lua Libraries")
   # For Windows and Mac, don't need to explicitly include the math library

+ 21 - 9
Modules/FindOpenGL.cmake

@@ -58,14 +58,22 @@ else ()
     find_path(OPENGL_INCLUDE_DIR OpenGL/gl.h DOC "Include for OpenGL on OSX")
 
   else()
-    # Handle HP-UX cases where we only want to find OpenGL in either hpux64
-    # or hpux32 depending on if we're doing a 64 bit build.
-    if(CMAKE_SIZEOF_VOID_P EQUAL 4)
-      set(HPUX_IA_OPENGL_LIB_PATH /opt/graphics/OpenGL/lib/hpux32/)
-    else()
-      set(HPUX_IA_OPENGL_LIB_PATH
-        /opt/graphics/OpenGL/lib/hpux64/
-        /opt/graphics/OpenGL/lib/pa20_64)
+    if (CMAKE_SYSTEM_NAME MATCHES "HP-UX")
+      # Handle HP-UX cases where we only want to find OpenGL in either hpux64
+      # or hpux32 depending on if we're doing a 64 bit build.
+      if(CMAKE_SIZEOF_VOID_P EQUAL 4)
+        set(_OPENGL_LIB_PATH
+          /opt/graphics/OpenGL/lib/hpux32/)
+      else()
+        set(_OPENGL_LIB_PATH
+          /opt/graphics/OpenGL/lib/hpux64/
+          /opt/graphics/OpenGL/lib/pa20_64)
+      endif()
+    elseif(CMAKE_SYSTEM_NAME STREQUAL Haiku)
+      set(_OPENGL_LIB_PATH
+        /boot/develop/lib/x86)
+      set(_OPENGL_INCLUDE_PATH
+        /boot/develop/headers/os/opengl)
     endif()
 
     # The first line below is to make sure that the proper headers
@@ -80,6 +88,7 @@ else ()
       /usr/share/doc/NVIDIA_GLX-1.0/include
       /usr/openwin/share/include
       /opt/graphics/OpenGL/include /usr/X11R6/include
+      ${_OPENGL_INCLUDE_PATH}
     )
 
     find_path(OPENGL_xmesa_INCLUDE_DIR GL/xmesa.h
@@ -93,9 +102,12 @@ else ()
       PATHS /opt/graphics/OpenGL/lib
             /usr/openwin/lib
             /usr/shlib /usr/X11R6/lib
-            ${HPUX_IA_OPENGL_LIB_PATH}
+            ${_OPENGL_LIB_PATH}
     )
 
+    unset(_OPENGL_INCLUDE_PATH)
+    unset(_OPENGL_LIB_PATH)
+
     # On Unix OpenGL most certainly always requires X11.
     # Feel free to tighten up these conditions if you don't
     # think this is always true.

+ 4 - 1
Modules/FindPackageHandleStandardArgs.cmake

@@ -187,8 +187,8 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
   # user knows better what went wrong (#6375)
   set(MISSING_VARS "")
   set(DETAILS "")
-  set(${_NAME_UPPER}_FOUND TRUE)
   # check if all passed variables are valid
+  unset(${_NAME_UPPER}_FOUND)
   foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS})
     if(NOT ${_CURRENT_VAR})
       set(${_NAME_UPPER}_FOUND FALSE)
@@ -197,6 +197,9 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG)
       set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]")
     endif()
   endforeach()
+  if(NOT "${${_NAME_UPPER}_FOUND}" STREQUAL "FALSE")
+    set(${_NAME_UPPER}_FOUND TRUE)
+  endif()
 
   # component handling
   unset(FOUND_COMPONENTS_MSG)

+ 14 - 0
Modules/FindQt.cmake

@@ -43,6 +43,12 @@ if(GLOB_TEMP_VAR)
 endif()
 set(GLOB_TEMP_VAR)
 
+file(GLOB GLOB_TEMP_VAR /usr/local/lib/qt3/bin/qmake)
+if(GLOB_TEMP_VAR)
+  set(QT3_INSTALLED TRUE)
+endif()
+set(GLOB_TEMP_VAR)
+
 # look for qt4 installations
 file(GLOB GLOB_TEMP_VAR /usr/local/qt-x11-commercial-4*/bin/qmake)
 if(GLOB_TEMP_VAR)
@@ -56,6 +62,12 @@ if(GLOB_TEMP_VAR)
 endif()
 set(GLOB_TEMP_VAR)
 
+file(GLOB GLOB_TEMP_VAR /usr/local/lib/qt4/bin/qmake)
+if(GLOB_TEMP_VAR)
+  set(QT4_INSTALLED TRUE)
+endif()
+set(GLOB_TEMP_VAR)
+
 if (Qt_FIND_VERSION)
   set(DESIRED_QT_VERSION "${Qt_FIND_VERSION}")
 endif ()
@@ -91,6 +103,7 @@ find_file( QT4_QGLOBAL_H_FILE qglobal.h
   /usr/lib/qt/include/Qt
   /usr/include/Qt
   /usr/share/qt4/include/Qt
+  /usr/local/include/X11/qt4/Qt
   C:/Progra~1/qt/include/Qt )
 
 if(QT4_QGLOBAL_H_FILE)
@@ -110,6 +123,7 @@ find_file( QT3_QGLOBAL_H_FILE qglobal.h
   /usr/lib/qt/include
   /usr/include
   /usr/share/qt3/include
+  /usr/local/include/X11/qt3
   C:/Progra~1/qt/include
   /usr/include/qt3 )
 

+ 4 - 2
Modules/FindQt3.cmake

@@ -64,6 +64,7 @@ find_path(QT_INCLUDE_DIR qt.h
   /usr/share/qt3/include
   C:/Progra~1/qt/include
   /usr/include/qt3
+  /usr/local/include/X11/qt3
   )
 
 # if qglobal.h is not in the qt_include_dir then set
@@ -146,7 +147,7 @@ find_library(QT_QASSISTANTCLIENT_LIBRARY
 
 # Qt 3 should prefer QTDIR over the PATH
 find_program(QT_MOC_EXECUTABLE
-  NAMES moc-qt3 moc
+  NAMES moc-qt3 moc moc3 moc3-mt
   HINTS
     ENV QTDIR
   PATHS
@@ -154,6 +155,7 @@ find_program(QT_MOC_EXECUTABLE
   "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.2.0;InstallDir]/include/Qt"
   "[HKEY_CURRENT_USER\\Software\\Trolltech\\Qt3Versions\\3.1.0;InstallDir]/include/Qt"
   ${GLOB_PATHS_BIN}
+    /usr/local/lib/qt3
     /usr/local/qt
     /usr/lib/qt
     /usr/lib/qt3
@@ -170,7 +172,7 @@ endif()
 
 # Qt 3 should prefer QTDIR over the PATH
 find_program(QT_UIC_EXECUTABLE
-  NAMES uic-qt3 uic
+  NAMES uic-qt3 uic uic3 uic3-mt
   HINTS
     ENV QTDIR
   PATHS

+ 96 - 11
Modules/FindQt4.cmake

@@ -65,6 +65,10 @@
 #       is much more flexible, but requires that FindQt4.cmake is executed before
 #       such an exported dependency file is processed.
 #
+#  QT_INCLUDE_DIRS_NO_SYSTEM
+#        If this variable is set to TRUE, the Qt include directories
+#        in the QT_USE_FILE will NOT have the SYSTEM keyword set.
+#
 # There are also some files that need processing by some Qt tools such as moc
 # and uic.  Listed below are macros that may be used to process those files.
 #
@@ -414,6 +418,15 @@ macro (_QT4_ADJUST_LIB_VARS _camelCaseBasename)
           set_property(TARGET Qt4::${_camelCaseBasename}        PROPERTY IMPORTED_LOCATION_DEBUG "${QT_${basename}_LIBRARY_DEBUG}" )
         endif()
       endif ()
+      set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY
+        INTERFACE_INCLUDE_DIRECTORIES
+          "${QT_${basename}_INCLUDE_DIR}"
+      )
+      string(REGEX REPLACE "^QT" "" _stemname ${basename})
+      set_property(TARGET Qt4::${_camelCaseBasename} PROPERTY
+        INTERFACE_COMPILE_DEFINITIONS
+          "QT_${_stemname}_LIB"
+      )
     endif()
 
     # If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these
@@ -534,6 +547,11 @@ endif ()
 
 if (QT_QMAKE_EXECUTABLE AND QTVERSION)
 
+  # set version variables
+  string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}")
+  string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}")
+  string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}")
+
   # ask qmake for the mkspecs directory
   # we do this first because QT_LIBINFIX might be set
   if (NOT QT_MKSPECS_DIR  OR  QT_QMAKE_CHANGED)
@@ -938,12 +956,49 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
   ############################################
 
 
+  macro(_qt4_add_target_depends_internal _QT_MODULE _PROPERTY)
+    if (TARGET Qt4::${_QT_MODULE})
+      foreach(_DEPEND ${ARGN})
+        if (NOT TARGET Qt4::Qt${_DEPEND})
+          message(FATAL_ERROR "_qt4_add_target_depends invoked with invalid arguments")
+        endif()
+        set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY
+          ${_PROPERTY}
+          "Qt4::Qt${_DEPEND}"
+        )
+        set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY
+          INTERFACE_INCLUDE_DIRECTORIES
+            "$<TARGET_PROPERTY:Qt4::Qt${_DEPEND},INTERFACE_INCLUDE_DIRECTORIES>"
+        )
+        set_property(TARGET Qt4::${_QT_MODULE} APPEND PROPERTY
+          INTERFACE_COMPILE_DEFINITIONS
+            "$<TARGET_PROPERTY:Qt4::Qt${_DEPEND},INTERFACE_COMPILE_DEFINITIONS>"
+        )
+      endforeach()
+    endif()
+  endmacro()
+
+  macro(_qt4_add_target_depends _QT_MODULE)
+    _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_INTERFACE_LIBRARIES ${ARGN})
+  endmacro()
+
+  macro(_qt4_add_target_private_depends _QT_MODULE)
+    _qt4_add_target_depends_internal(${_QT_MODULE} IMPORTED_LINK_DEPENDENT_LIBRARIES ${ARGN})
+  endmacro()
+
+
   # Set QT_xyz_LIBRARY variable and add
   # library include path to QT_INCLUDES
   _QT4_ADJUST_LIB_VARS(QtCore)
+  set_property(TARGET Qt4::QtCore APPEND PROPERTY
+    INTERFACE_INCLUDE_DIRECTORIES
+      "${QT_MKSPECS_DIR}/default"
+      ${QT_INCLUDE_DIR}
+  )
 
   foreach(QT_MODULE ${QT_MODULES})
     _QT4_ADJUST_LIB_VARS(${QT_MODULE})
+    _qt4_add_target_depends(${QT_MODULE} Core)
   endforeach()
 
   _QT4_ADJUST_LIB_VARS(QtAssistant)
@@ -958,6 +1013,41 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
     _QT4_ADJUST_LIB_VARS(QAxContainer)
   endif()
 
+  # Only public dependencies are listed here.
+  # Eg, QtDBus links to QtXml, but users of QtDBus do not need to
+  # link to QtXml because QtDBus only uses it internally, not in public
+  # headers.
+  # Everything depends on QtCore, but that is covered above already
+  _qt4_add_target_depends(Qt3Support Sql Gui Network)
+  if (TARGET Qt4::Qt3Support)
+    # An additional define is required for QT3_SUPPORT
+    set_property(TARGET Qt4::Qt3Support APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT3_SUPPORT)
+  endif()
+  _qt4_add_target_depends(QtDeclarative Script Gui)
+  _qt4_add_target_depends(QtDesigner Gui)
+  _qt4_add_target_depends(QtHelp Gui)
+  _qt4_add_target_depends(QtMultimedia Gui)
+  _qt4_add_target_depends(QtOpenGL Gui)
+  _qt4_add_target_depends(QtSvg Gui)
+  _qt4_add_target_depends(QtWebKit Gui Network)
+
+  _qt4_add_target_private_depends(Qt3Support Xml)
+  _qt4_add_target_private_depends(QtSvg Xml)
+  _qt4_add_target_private_depends(QtDBus Xml)
+  _qt4_add_target_private_depends(QtUiTools Xml Gui)
+  _qt4_add_target_private_depends(QtHelp Sql Xml Network)
+  _qt4_add_target_private_depends(QtXmlPatterns Network)
+  _qt4_add_target_private_depends(QtScriptTools Gui)
+  _qt4_add_target_private_depends(QtWebKit XmlPatterns)
+  _qt4_add_target_private_depends(QtDeclarative XmlPatterns Svg Sql Gui)
+  _qt4_add_target_private_depends(QtMultimedia Gui)
+  _qt4_add_target_private_depends(QtOpenGL Gui)
+  _qt4_add_target_private_depends(QAxServer Gui)
+  _qt4_add_target_private_depends(QAxContainer Gui)
+  _qt4_add_target_private_depends(phonon Gui)
+  if(QT_QTDBUS_FOUND)
+    _qt4_add_target_private_depends(phonon DBus)
+  endif()
 
   #######################################
   #
@@ -982,13 +1072,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
   endif()
 
   find_program(QT_MOC_EXECUTABLE
-    NAMES moc-qt4 moc
+    NAMES moc-qt4 moc moc4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
 
   find_program(QT_UIC_EXECUTABLE
-    NAMES uic-qt4 uic
+    NAMES uic-qt4 uic uic4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
@@ -1018,13 +1108,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
     )
 
   find_program(QT_LUPDATE_EXECUTABLE
-    NAMES lupdate-qt4 lupdate
+    NAMES lupdate-qt4 lupdate lupdate4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
 
   find_program(QT_LRELEASE_EXECUTABLE
-    NAMES lrelease-qt4 lrelease
+    NAMES lrelease-qt4 lrelease lrelease4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
@@ -1036,13 +1126,13 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
     )
 
   find_program(QT_DESIGNER_EXECUTABLE
-    NAMES designer-qt4 designer
+    NAMES designer-qt4 designer designer4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
 
   find_program(QT_LINGUIST_EXECUTABLE
-    NAMES linguist-qt4 linguist
+    NAMES linguist-qt4 linguist linguist4
     PATHS ${QT_BINARY_DIR}
     NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH
     )
@@ -1170,11 +1260,6 @@ if (QT_QMAKE_EXECUTABLE AND QTVERSION)
 
   include("${_qt4_current_dir}/Qt4Macros.cmake")
 
-  # set version variables
-  string(REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}")
-  string(REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}")
-  string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}")
-
 endif()
 
 #support old QT_MIN_VERSION if set, but not if version is supplied by find_package()

+ 1 - 1
Modules/FindSDL.cmake

@@ -122,7 +122,7 @@ if(SDL_LIBRARY_TEMP)
   if(SDLMAIN_LIBRARY AND NOT SDL_BUILDING_LIBRARY)
     list(FIND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" _SDL_MAIN_INDEX)
     if(_SDL_MAIN_INDEX EQUAL -1)
-      list(APPEND SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}")
+      set(SDL_LIBRARY_TEMP "${SDLMAIN_LIBRARY}" ${SDL_LIBRARY_TEMP})
     endif()
     unset(_SDL_MAIN_INDEX)
   endif()

+ 2 - 1
Modules/FindSDL_image.cmake

@@ -40,7 +40,7 @@ find_path(SDL_IMAGE_INCLUDE_DIR SDL_image.h
   HINTS
     ENV SDLIMAGEDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
 )
 
 if(NOT SDL_IMAGE_LIBRARY AND SDLIMAGE_LIBRARY)
@@ -52,6 +52,7 @@ find_library(SDL_IMAGE_LIBRARY
   HINTS
     ENV SDLIMAGEDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
 )
 
 if(SDL_IMAGE_INCLUDE_DIR AND EXISTS "${SDL_IMAGE_INCLUDE_DIR}/SDL_image.h")

+ 2 - 1
Modules/FindSDL_mixer.cmake

@@ -40,7 +40,7 @@ find_path(SDL_MIXER_INCLUDE_DIR SDL_mixer.h
   HINTS
     ENV SDLMIXERDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
 )
 
 if(NOT SDL_MIXER_LIBRARY AND SDLMIXER_LIBRARY)
@@ -52,6 +52,7 @@ find_library(SDL_MIXER_LIBRARY
   HINTS
     ENV SDLMIXERDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
 )
 
 if(SDL_MIXER_INCLUDE_DIR AND EXISTS "${SDL_MIXER_INCLUDE_DIR}/SDL_mixer.h")

+ 2 - 1
Modules/FindSDL_net.cmake

@@ -40,7 +40,7 @@ find_path(SDL_NET_INCLUDE_DIR SDL_net.h
   HINTS
     ENV SDLNETDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
 )
 
 if(NOT SDL_NET_LIBRARY AND SDLNET_LIBRARY)
@@ -52,6 +52,7 @@ find_library(SDL_NET_LIBRARY
   HINTS
     ENV SDLNETDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
 )
 
 if(SDL_NET_INCLUDE_DIR AND EXISTS "${SDL_NET_INCLUDE_DIR}/SDL_net.h")

+ 2 - 1
Modules/FindSDL_sound.cmake

@@ -77,7 +77,7 @@ find_path(SDL_SOUND_INCLUDE_DIR SDL_sound.h
   HINTS
     ENV SDLSOUNDDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
   )
 
 find_library(SDL_SOUND_LIBRARY
@@ -85,6 +85,7 @@ find_library(SDL_SOUND_LIBRARY
   HINTS
     ENV SDLSOUNDDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
   )
 
 if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY)

+ 2 - 1
Modules/FindSDL_ttf.cmake

@@ -40,7 +40,7 @@ find_path(SDL_TTF_INCLUDE_DIR SDL_ttf.h
   HINTS
     ENV SDLTTFDIR
     ENV SDLDIR
-  PATH_SUFFIXES SDL SDL12 SDL11
+  PATH_SUFFIXES include/SDL include/SDL12 include/SDL11 include
 )
 
 if(NOT SDL_TTF_LIBRARY AND SDLTTF_LIBRARY)
@@ -52,6 +52,7 @@ find_library(SDL_TTF_LIBRARY
   HINTS
     ENV SDLTTFDIR
     ENV SDLDIR
+  PATH_SUFFIXES lib
 )
 
 if(SDL_TTF_INCLUDE_DIR AND EXISTS "${SDL_TTF_INCLUDE_DIR}/SDL_ttf.h")

+ 8 - 0
Modules/FindTCL.cmake

@@ -82,6 +82,10 @@ set(TCLTK_POSSIBLE_LIB_PATHS
   "${TK_LIBRARY_PATH}"
   "${TCL_TCLSH_PATH_PARENT}/lib"
   "${TK_WISH_PATH_PARENT}/lib"
+  /usr/local/lib/tcl/tcl8.5
+  /usr/local/lib/tcl/tk8.5
+  /usr/local/lib/tcl/tcl8.4
+  /usr/local/lib/tcl/tk8.4
   )
 
 if(WIN32)
@@ -168,6 +172,10 @@ set(TCLTK_POSSIBLE_INCLUDE_PATHS
   /usr/include/tcl8.3
   /usr/include/tcl8.2
   /usr/include/tcl8.0
+  /usr/local/include/tcl8.5
+  /usr/local/include/tk8.5
+  /usr/local/include/tcl8.4
+  /usr/local/include/tk8.4
   )
 
 if(WIN32)

+ 5 - 2
Modules/NSIS.template.in

@@ -37,6 +37,9 @@
   ;Set compression
   SetCompressor @CPACK_NSIS_COMPRESSOR@
 
+  ;Require administrator access
+  RequestExecutionLevel admin
+
 @CPACK_NSIS_DEFINES@
 
   !include Sections.nsh
@@ -119,7 +122,7 @@ Var AR_RegFlags
  "exit_${SecName}:"
 !macroend
 
-!macro RemoveSection SecName
+!macro RemoveSection_CPack SecName
   ;  This macro is used to call section's Remove_... macro
   ;from the uninstaller.
   ;Input: section index constant name specified in Section command.
@@ -841,7 +844,7 @@ Section "Uninstall"
   DeleteRegKey SHCTX "Software\@CPACK_PACKAGE_VENDOR@\@CPACK_PACKAGE_INSTALL_REGISTRY_KEY@"
 
   ; Removes all optional components
-  !insertmacro SectionList "RemoveSection"
+  !insertmacro SectionList "RemoveSection_CPack"
 
   !insertmacro MUI_STARTMENU_GETFOLDER Application $MUI_TEMP
 

+ 1 - 0
Modules/Platform/Darwin-Clang.cmake

@@ -19,6 +19,7 @@ endif()
 set(__DARWIN_COMPILER_CLANG 1)
 
 macro(__darwin_compiler_clang lang)
+  set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
   set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
   set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")
   set(CMAKE_${lang}_SYSROOT_FLAG "-isysroot")

+ 1 - 0
Modules/Platform/Darwin-GNU.cmake

@@ -19,6 +19,7 @@ endif()
 set(__DARWIN_COMPILER_GNU 1)
 
 macro(__darwin_compiler_gnu lang)
+  set(CMAKE_${lang}_VERBOSE_FLAG "-v -Wl,-v") # also tell linker to print verbose output
   # GNU does not have -shared on OS X
   set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "-dynamiclib -Wl,-headerpad_max_install_names")
   set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "-bundle -Wl,-headerpad_max_install_names")

+ 18 - 0
Modules/Platform/Darwin.cmake

@@ -256,6 +256,24 @@ set(CMAKE_CXX_CREATE_MACOSX_FRAMEWORK
 if(NOT DEFINED CMAKE_FIND_FRAMEWORK)
   set(CMAKE_FIND_FRAMEWORK FIRST)
 endif()
+
+# Older OS X linkers do not report their framework search path
+# with -v but "man ld" documents the following locations.
+set(CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+  ${_CMAKE_OSX_SYSROOT_PATH}/Library/Frameworks
+  ${_CMAKE_OSX_SYSROOT_PATH}/System/Library/Frameworks
+  )
+if(_CMAKE_OSX_SYSROOT_PATH)
+  # Treat some paths as implicit so we do not override the SDK versions.
+  list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+    /System/Library/Frameworks)
+endif()
+if("${_CURRENT_OSX_VERSION}" VERSION_LESS "10.5")
+  # Older OS X tools had more implicit paths.
+  list(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES
+    ${_CMAKE_OSX_SYSROOT_PATH}/Network/Library/Frameworks)
+endif()
+
 # set up the default search directories for frameworks
 set(CMAKE_SYSTEM_FRAMEWORK_PATH
   ~/Library/Frameworks

+ 4 - 0
Modules/Platform/OpenBSD.cmake

@@ -16,3 +16,7 @@ if(NOT CMAKE_PLATFORM_RUNTIME_PATH)
 endif()
 
 set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_OPENBSD_VERSIONING 1)
+
+# OpenBSD policy requires that shared libraries be installed without
+# executable permission.
+set(CMAKE_INSTALL_SO_NO_EXE 1)

+ 1 - 1
Modules/Platform/Windows-Intel.cmake

@@ -50,7 +50,7 @@ elseif(MSVC_CXX_ARCHITECTURE_ID)
 elseif(MSVC_Fortran_ARCHITECTURE_ID)
   set(_MACHINE_ARCH_FLAG "/machine:${MSVC_Fortran_ARCHITECTURE_ID}")
 endif()
-set (CMAKE_EXE_LINKER_FLAGS_INIT "/STACK:10000000 /INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}")
+set (CMAKE_EXE_LINKER_FLAGS_INIT "/INCREMENTAL:YES ${_MACHINE_ARCH_FLAG}")
 set (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "/debug")
 set (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "/debug")
 

+ 2 - 2
Modules/Platform/Windows-MSVC.cmake

@@ -165,7 +165,7 @@ set(CMAKE_CXX_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT}")
 
 # executable linker flags
 set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:")
-# set the stack size and the machine type
+# set the machine type
 set(_MACHINE_ARCH_FLAG ${MSVC_C_ARCHITECTURE_ID})
 if(NOT _MACHINE_ARCH_FLAG)
   set(_MACHINE_ARCH_FLAG ${MSVC_CXX_ARCHITECTURE_ID})
@@ -178,7 +178,7 @@ if(CMAKE_SYSTEM_NAME MATCHES "WindowsCE")
   endif()
 endif()
 set (CMAKE_EXE_LINKER_FLAGS_INIT
-    "${CMAKE_EXE_LINKER_FLAGS_INIT} /STACK:10000000 /machine:${_MACHINE_ARCH_FLAG}")
+    "${CMAKE_EXE_LINKER_FLAGS_INIT} /machine:${_MACHINE_ARCH_FLAG}")
 
 # add /debug and /INCREMENTAL:YES to DEBUG and RELWITHDEBINFO also add pdbtype
 # on versions that support it

+ 10 - 2
Modules/UseQt4.cmake

@@ -25,7 +25,11 @@ if(NOT CMAKE_CONFIGURATION_TYPES AND NOT CMAKE_BUILD_TYPE)
   set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS QT_NO_DEBUG)
 endif()
 
-include_directories(${QT_INCLUDE_DIR})
+if(QT_INCLUDE_DIRS_NO_SYSTEM)
+  include_directories(${QT_INCLUDE_DIR})
+else(QT_INCLUDE_DIRS_NO_SYSTEM)
+  include_directories(SYSTEM ${QT_INCLUDE_DIR})
+endif(QT_INCLUDE_DIRS_NO_SYSTEM)
 
 set(QT_LIBRARIES "")
 set(QT_LIBRARIES_PLUGINS "")
@@ -89,7 +93,11 @@ foreach(module QT3SUPPORT QTOPENGL QTASSISTANT QTDESIGNER QTMOTIF QTNSPLUGIN
       if(QT_USE_${module})
         string(REPLACE "QT" "" qt_module_def "${module}")
         add_definitions(-DQT_${qt_module_def}_LIB)
-        include_directories(${QT_${module}_INCLUDE_DIR})
+        if(QT_INCLUDE_DIRS_NO_SYSTEM)
+          include_directories(${QT_${module}_INCLUDE_DIR})
+        else(QT_INCLUDE_DIRS_NO_SYSTEM)
+          include_directories(SYSTEM ${QT_${module}_INCLUDE_DIR})
+        endif(QT_INCLUDE_DIRS_NO_SYSTEM)
       endif()
       set(QT_LIBRARIES ${QT_LIBRARIES} ${QT_${module}_LIBRARY})
       set(QT_LIBRARIES_PLUGINS ${QT_LIBRARIES_PLUGINS} ${QT_${module}_PLUGINS})

+ 44 - 0
Modules/WIX.template.in

@@ -0,0 +1,44 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<?include "cpack_variables.wxi"?>
+
+<Wix xmlns="http://schemas.microsoft.com/wix/2006/wi"
+    RequiredVersion="3.6.3303.0">
+
+    <Product Id="$(var.CPACK_WIX_PRODUCT_GUID)"
+        Name="$(var.CPACK_PACKAGE_NAME)"
+        Language="1033"
+        Version="$(var.CPACK_PACKAGE_VERSION)"
+        Manufacturer="$(var.CPACK_PACKAGE_VENDOR)"
+        UpgradeCode="$(var.CPACK_WIX_UPGRADE_GUID)">
+
+        <Package InstallerVersion="301" Compressed="yes"/>
+
+        <Media Id="1" Cabinet="media1.cab" EmbedCab="yes"/>
+
+        <MajorUpgrade
+            Schedule="afterInstallInitialize"
+            AllowSameVersionUpgrades="yes"
+            DowngradeErrorMessage="A later version of [ProductName] is already installed. Setup will now exit."/>
+
+        <WixVariable Id="WixUILicenseRtf" Value="$(var.CPACK_WIX_LICENSE_RTF)"/>
+        <Property Id="WIXUI_INSTALLDIR" Value="INSTALL_ROOT"/>
+
+        <?ifdef CPACK_WIX_PRODUCT_ICON?>
+        <Property Id="ARPPRODUCTICON">ProductIcon.ico</Property>
+        <Icon Id="ProductIcon.ico" SourceFile="$(var.CPACK_WIX_PRODUCT_ICON)"/>
+        <?endif?>
+
+        <?ifdef CPACK_WIX_UI_BANNER?>
+        <WixVariable Id="WixUIBannerBmp" Value="$(var.CPACK_WIX_UI_BANNER)"/>
+        <?endif?>
+
+        <?ifdef CPACK_WIX_UI_DIALOG?>
+        <WixVariable Id="WixUIDialogBmp" Value="$(var.CPACK_WIX_UI_DIALOG)"/>
+        <?endif?>
+
+        <FeatureRef Id="ProductFeature"/>
+
+        <UIRef Id="WixUI_InstallDir" />
+    </Product>
+</Wix>

+ 10 - 0
Source/CMakeLists.txt

@@ -355,6 +355,8 @@ if (WIN32)
       cmLocalVisualStudio7Generator.h
       cmLocalVisualStudioGenerator.cxx
       cmLocalVisualStudioGenerator.h
+      cmVisualStudioWCEPlatformParser.h
+      cmVisualStudioWCEPlatformParser.cxx
       cmWin32ProcessExecution.cxx
       cmWin32ProcessExecution.h
       )
@@ -499,6 +501,14 @@ if(UNIX)
     )
 endif()
 
+if(WIN32)
+  set(CPACK_SRCS ${CPACK_SRCS}
+    CPack/WiX/cmCPackWIXGenerator.cxx
+    CPack/WiX/cmWIXSourceWriter.cxx
+    CPack/WiX/cmWIXRichTextFormatWriter.cxx
+  )
+endif()
+
 if(APPLE)
   set(CPACK_SRCS ${CPACK_SRCS}
     CPack/cmCPackBundleGenerator.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 20121124)
+set(CMake_VERSION_TWEAK 20130110)
 #set(CMake_VERSION_RC 1)

+ 571 - 0
Source/CPack/WiX/cmCPackWIXGenerator.cxx

@@ -0,0 +1,571 @@
+/*============================================================================
+  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.
+============================================================================*/
+
+#include "cmCPackWIXGenerator.h"
+
+#include <cmSystemTools.h>
+#include <cmGeneratedFileStream.h>
+#include <CPack/cmCPackLog.h>
+#include <CPack/cmCPackComponentGroup.h>
+
+#include "cmWIXSourceWriter.h"
+#include "cmWIXRichTextFormatWriter.h"
+
+#include <cmsys/SystemTools.hxx>
+#include <cmsys/Directory.hxx>
+
+#include <rpc.h> // for GUID generation
+
+int cmCPackWIXGenerator::InitializeInternal()
+{
+  componentPackageMethod = ONE_PACKAGE;
+
+  return this->Superclass::InitializeInternal();
+}
+
+bool cmCPackWIXGenerator::RunWiXCommand(const std::string& command)
+{
+  std::string cpackTopLevel;
+  if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
+    {
+    return false;
+    }
+
+  std::string logFileName = cpackTopLevel + "/wix.log";
+
+  cmCPackLogger(cmCPackLog::LOG_DEBUG,
+    "Running WiX command: " << command << std::endl);
+
+  std::string output;
+
+  int returnValue = 0;
+  bool status = cmSystemTools::RunSingleCommand(command.c_str(), &output,
+    &returnValue, 0, cmSystemTools::OUTPUT_NONE);
+
+  std::ofstream logFile(logFileName.c_str(), std::ios::app);
+  logFile << command << std::endl;
+  logFile << output;
+  logFile.close();
+
+  if(!status || returnValue)
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+      "Problem running WiX candle. "
+      "Please check '" << logFileName << "' for errors." << std::endl);
+
+    return false;
+    }
+
+  return true;
+}
+
+bool cmCPackWIXGenerator::RunCandleCommand(
+  const std::string& sourceFile, const std::string& objectFile)
+{
+  std::string executable;
+  if(!RequireOption("CPACK_WIX_CANDLE_EXECUTABLE", executable))
+    {
+    return false;
+    }
+
+  std::stringstream command;
+  command << QuotePath(executable);
+  command << " -nologo";
+  command << " -arch " << GetArchitecture();
+  command << " -out " << QuotePath(objectFile);
+  command << " " << QuotePath(sourceFile);
+
+  return RunWiXCommand(command.str());
+}
+
+bool cmCPackWIXGenerator::RunLightCommand(const std::string& objectFiles)
+{
+  std::string executable;
+  if(!RequireOption("CPACK_WIX_LIGHT_EXECUTABLE", executable))
+    {
+    return false;
+    }
+
+  std::stringstream command;
+  command << QuotePath(executable);
+  command << " -nologo";
+  command << " -out " << QuotePath(packageFileNames.at(0));
+  command << " -ext WixUIExtension";
+  command << " " << objectFiles;
+
+  return RunWiXCommand(command.str());
+}
+
+int cmCPackWIXGenerator::PackageFiles()
+{
+  if(!PackageFilesImpl() || cmSystemTools::GetErrorOccuredFlag())
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+      "Fatal WiX Generator Error" << std::endl);
+    return false;
+    }
+
+  return true;
+}
+
+bool cmCPackWIXGenerator::InitializeWiXConfiguration()
+{
+  if(!ReadListFile("CPackWIX.cmake"))
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+      "Error while executing CPackWIX.cmake" << std::endl);
+    return false;
+    }
+
+  if(GetOption("CPACK_WIX_PRODUCT_GUID") == 0)
+    {
+    std::string guid = GenerateGUID();
+    SetOption("CPACK_WIX_PRODUCT_GUID", guid.c_str());
+
+    cmCPackLogger(cmCPackLog::LOG_VERBOSE,
+      "CPACK_WIX_PRODUCT_GUID implicitly set to " << guid << " . "
+      << std::endl);
+    }
+
+  if(GetOption("CPACK_WIX_UPGRADE_GUID") == 0)
+    {
+    std::string guid = GenerateGUID();
+    SetOption("CPACK_WIX_UPGRADE_GUID", guid.c_str());
+
+    cmCPackLogger(cmCPackLog::LOG_WARNING,
+      "CPACK_WIX_UPGRADE_GUID implicitly set to " << guid << " . "
+      "Please refer to the documentation on how and why "
+      "you might want to set this explicitly." << std::endl);
+    }
+
+  std::string cpackTopLevel;
+  if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
+    {
+    return false;
+    }
+
+  if(GetOption("CPACK_WIX_LICENSE_RTF") == 0)
+    {
+    std::string licenseFilename = cpackTopLevel + "/License.rtf";
+    SetOption("CPACK_WIX_LICENSE_RTF", licenseFilename.c_str());
+
+    if(!CreateLicenseFile())
+      {
+      return false;
+      }
+    }
+
+  return true;
+}
+
+bool cmCPackWIXGenerator::PackageFilesImpl()
+{
+  if(!InitializeWiXConfiguration())
+    {
+    return false;
+    }
+
+  if(!CreateWiXVariablesIncludeFile())
+    {
+    return false;
+    }
+
+  if(!CreateWiXSourceFiles())
+    {
+    return false;
+    }
+
+  std::stringstream objectFiles;
+  for(size_t i = 0; i < wixSources.size(); ++i)
+    {
+    const std::string& sourceFilename = wixSources[i];
+
+    std::string objectFilename =
+      cmSystemTools::GetFilenameWithoutExtension(sourceFilename) + ".wixobj";
+
+    if(!RunCandleCommand(sourceFilename, objectFilename))
+      {
+      return false;
+      }
+
+    objectFiles << " " << QuotePath(objectFilename);
+    }
+
+  return RunLightCommand(objectFiles.str());
+}
+
+bool cmCPackWIXGenerator::CreateWiXVariablesIncludeFile()
+{
+  std::string cpackTopLevel;
+  if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
+    {
+    return false;
+    }
+
+  std::string includeFilename =
+    cpackTopLevel + "/cpack_variables.wxi";
+
+  cmWIXSourceWriter includeFile(Logger, includeFilename, true);
+  CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_GUID");
+  CopyDefinition(includeFile, "CPACK_WIX_UPGRADE_GUID");
+  CopyDefinition(includeFile, "CPACK_PACKAGE_VENDOR");
+  CopyDefinition(includeFile, "CPACK_PACKAGE_NAME");
+  CopyDefinition(includeFile, "CPACK_PACKAGE_VERSION");
+  CopyDefinition(includeFile, "CPACK_WIX_LICENSE_RTF");
+  CopyDefinition(includeFile, "CPACK_WIX_PRODUCT_ICON");
+  CopyDefinition(includeFile, "CPACK_WIX_UI_BANNER");
+  CopyDefinition(includeFile, "CPACK_WIX_UI_DIALOG");
+
+  return true;
+}
+
+void cmCPackWIXGenerator::CopyDefinition(
+  cmWIXSourceWriter &source, const std::string &name)
+{
+  const char* value = GetOption(name.c_str());
+  if(value)
+    {
+    AddDefinition(source, name, value);
+    }
+}
+
+void cmCPackWIXGenerator::AddDefinition(cmWIXSourceWriter& source,
+  const std::string& name, const std::string& value)
+{
+  std::stringstream tmp;
+  tmp << name << "=\"" << value << '"';
+
+  source.AddProcessingInstruction("define",
+    cmWIXSourceWriter::WindowsCodepageToUtf8(tmp.str()));
+}
+
+bool cmCPackWIXGenerator::CreateWiXSourceFiles()
+{
+  std::string cpackTopLevel;
+  if(!RequireOption("CPACK_TOPLEVEL_DIRECTORY", cpackTopLevel))
+    {
+    return false;
+    }
+
+  std::string directoryDefinitionsFilename =
+    cpackTopLevel + "/directories.wxs";
+
+  wixSources.push_back(directoryDefinitionsFilename);
+
+  cmWIXSourceWriter directoryDefinitions(Logger, directoryDefinitionsFilename);
+  directoryDefinitions.BeginElement("Fragment");
+
+  directoryDefinitions.BeginElement("Directory");
+  directoryDefinitions.AddAttribute("Id", "TARGETDIR");
+  directoryDefinitions.AddAttribute("Name", "SourceDir");
+
+  directoryDefinitions.BeginElement("Directory");
+  if(GetArchitecture() == "x86")
+    {
+    directoryDefinitions.AddAttribute("Id", "ProgramFilesFolder");
+    }
+  else
+    {
+    directoryDefinitions.AddAttribute("Id", "ProgramFiles64Folder");
+    }
+
+  std::vector<std::string> install_root;
+
+  std::string tmp;
+  if(!RequireOption("CPACK_PACKAGE_INSTALL_DIRECTORY", tmp))
+    {
+    return false;
+    }
+
+  cmSystemTools::SplitPath(tmp.c_str(), install_root);
+
+  if(!install_root.empty() && install_root.back().empty())
+    {
+    install_root.pop_back();
+    }
+
+  for(size_t i = 1; i < install_root.size(); ++i)
+    {
+    directoryDefinitions.BeginElement("Directory");
+
+    if(i == install_root.size() - 1)
+      {
+      directoryDefinitions.AddAttribute("Id", "INSTALL_ROOT");
+      }
+    else
+      {
+      std::stringstream ss;
+      ss << "INSTALL_PREFIX_" << i;
+      directoryDefinitions.AddAttribute("Id", ss.str());
+      }
+
+    directoryDefinitions.AddAttribute("Name", install_root[i]);
+  }
+
+  size_t directoryCounter = 0;
+  size_t fileCounter = 0;
+
+  std::string fileDefinitionsFilename =
+    cpackTopLevel + "/files.wxs";
+
+  wixSources.push_back(fileDefinitionsFilename);
+
+  cmWIXSourceWriter fileDefinitions(Logger, fileDefinitionsFilename);
+  fileDefinitions.BeginElement("Fragment");
+
+  std::string featureDefinitionsFilename =
+      cpackTopLevel +"/features.wxs";
+
+  wixSources.push_back(featureDefinitionsFilename);
+
+  cmWIXSourceWriter featureDefinitions(Logger, featureDefinitionsFilename);
+  featureDefinitions.BeginElement("Fragment");
+
+  featureDefinitions.BeginElement("Feature");
+  featureDefinitions.AddAttribute("Id", "ProductFeature");
+  featureDefinitions.AddAttribute("Title", Name);
+  featureDefinitions.AddAttribute("Level", "1");
+  featureDefinitions.EndElement();
+
+  featureDefinitions.BeginElement("FeatureRef");
+  featureDefinitions.AddAttribute("Id", "ProductFeature");
+
+  AddDirectoryAndFileDefinitons(
+    toplevel, "INSTALL_ROOT",
+    directoryDefinitions, fileDefinitions, featureDefinitions,
+    directoryCounter, fileCounter);
+
+  featureDefinitions.EndElement();
+  featureDefinitions.EndElement();
+  fileDefinitions.EndElement();
+
+  for(size_t i = 1; i < install_root.size(); ++i)
+    {
+    directoryDefinitions.EndElement();
+    }
+
+  directoryDefinitions.EndElement();
+  directoryDefinitions.EndElement();
+  directoryDefinitions.EndElement();
+
+  std::string wixTemplate = FindTemplate("WIX.template.in");
+  if(wixTemplate.empty())
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+      "Could not find CPack WiX template file WIX.template.in" << std::endl);
+    return false;
+    }
+
+  std::string mainSourceFilePath = cpackTopLevel + "/main.wxs";
+
+  if(!ConfigureFile(wixTemplate.c_str(), mainSourceFilePath .c_str()))
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+      "Failed creating '" << mainSourceFilePath  <<
+      "'' from template." << std::endl);
+
+    return false;
+    }
+
+  wixSources.push_back(mainSourceFilePath);
+
+  return true;
+}
+
+bool cmCPackWIXGenerator::CreateLicenseFile()
+{
+  std::string licenseSourceFilename;
+  if(!RequireOption("CPACK_RESOURCE_FILE_LICENSE", licenseSourceFilename))
+    {
+    return false;
+    }
+
+  std::string licenseDestinationFilename;
+  if(!RequireOption("CPACK_WIX_LICENSE_RTF", licenseDestinationFilename))
+    {
+    return false;
+    }
+
+  std::string extension = GetRightmostExtension(licenseSourceFilename);
+
+  if(extension == ".rtf")
+    {
+    cmSystemTools::CopyAFile(
+      licenseSourceFilename.c_str(),
+      licenseDestinationFilename.c_str());
+    }
+  else if(extension == ".txt")
+    {
+    cmWIXRichTextFormatWriter rtfWriter(licenseDestinationFilename);
+
+    std::ifstream licenseSource(licenseSourceFilename.c_str());
+
+    std::string line;
+    while(std::getline(licenseSource, line))
+      {
+      rtfWriter.AddText(line);
+      rtfWriter.AddText("\n");
+      }
+    }
+  else
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+      "unsupported WiX License file extension '" <<
+      extension << "'" << std::endl);
+
+    return false;
+    }
+
+  return true;
+}
+
+void cmCPackWIXGenerator::AddDirectoryAndFileDefinitons(
+  const std::string& topdir,
+  const std::string& directoryId,
+  cmWIXSourceWriter& directoryDefinitions,
+  cmWIXSourceWriter& fileDefinitions,
+  cmWIXSourceWriter& featureDefinitions,
+  size_t& directoryCounter,
+  size_t& fileCounter)
+{
+  cmsys::Directory dir;
+  dir.Load(topdir.c_str());
+
+  for(size_t i = 0; i < dir.GetNumberOfFiles(); ++i)
+    {
+    std::string fileName = dir.GetFile(static_cast<unsigned long>(i));
+
+    if(fileName == "." || fileName == "..")
+      {
+      continue;
+      }
+
+    std::string fullPath = topdir + "/" + fileName;
+
+    if(cmSystemTools::FileIsDirectory(fullPath.c_str()))
+      {
+      std::stringstream tmp;
+      tmp << "DIR_ID_" << ++directoryCounter;
+      std::string subDirectoryId = tmp.str();
+
+      directoryDefinitions.BeginElement("Directory");
+      directoryDefinitions.AddAttribute("Id", subDirectoryId);
+      directoryDefinitions.AddAttribute("Name", fileName);
+
+      AddDirectoryAndFileDefinitons(
+        fullPath, subDirectoryId,
+        directoryDefinitions,
+        fileDefinitions,
+        featureDefinitions,
+        directoryCounter,
+        fileCounter);
+
+      directoryDefinitions.EndElement();
+      }
+    else
+      {
+      std::stringstream tmp;
+      tmp << "_ID_" << ++fileCounter;
+      std::string idSuffix = tmp.str();
+
+      std::string componentId = std::string("CMP") + idSuffix;
+      std::string fileId = std::string("FILE") + idSuffix;
+
+      fileDefinitions.BeginElement("DirectoryRef");
+      fileDefinitions.AddAttribute("Id", directoryId);
+
+      fileDefinitions.BeginElement("Component");
+      fileDefinitions.AddAttribute("Id", componentId);
+      fileDefinitions.AddAttribute("Guid", "*");
+
+      fileDefinitions.BeginElement("File");
+      fileDefinitions.AddAttribute("Id", fileId);
+      fileDefinitions.AddAttribute("Source", fullPath);
+      fileDefinitions.AddAttribute("KeyPath", "yes");
+
+      fileDefinitions.EndElement();
+      fileDefinitions.EndElement();
+      fileDefinitions.EndElement();
+
+      featureDefinitions.BeginElement("ComponentRef");
+      featureDefinitions.AddAttribute("Id", componentId);
+      featureDefinitions.EndElement();
+      }
+    }
+}
+
+bool cmCPackWIXGenerator::RequireOption(
+  const std::string& name, std::string &value) const
+{
+  const char* tmp = GetOption(name.c_str());
+  if(tmp)
+    {
+    value = tmp;
+
+    return true;
+    }
+  else
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+      "Required variable " << name << " not set" << std::endl);
+
+    return false;
+    }
+}
+
+std::string cmCPackWIXGenerator::GetArchitecture() const
+{
+  std::string void_p_size;
+  RequireOption("CPACK_WIX_SIZEOF_VOID_P", void_p_size);
+
+  if(void_p_size == "8")
+    {
+    return "x64";
+    }
+  else
+    {
+    return "x86";
+    }
+}
+
+std::string cmCPackWIXGenerator::GenerateGUID()
+{
+  UUID guid;
+  UuidCreate(&guid);
+
+  unsigned char *tmp = 0;
+  UuidToString(&guid, &tmp);
+
+  std::string result(reinterpret_cast<char*>(tmp));
+  RpcStringFree(&tmp);
+
+  return cmSystemTools::UpperCase(result);
+}
+
+std::string cmCPackWIXGenerator::QuotePath(const std::string& path)
+{
+  return std::string("\"") + path + '"';
+}
+
+std::string cmCPackWIXGenerator::GetRightmostExtension(
+  const std::string& filename)
+{
+  std::string extension;
+
+  std::string::size_type i = filename.rfind(".");
+  if(i != std::string::npos)
+    {
+    extension = filename.substr(i);
+    }
+
+  return cmSystemTools::LowerCase(extension);
+}

+ 101 - 0
Source/CPack/WiX/cmCPackWIXGenerator.h

@@ -0,0 +1,101 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2012 Kitware, Inc.
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmCPackWIXGenerator_h
+#define cmCPackWIXGenerator_h
+
+#include <CPack/cmCPackGenerator.h>
+
+#include <string>
+#include <map>
+
+class cmWIXSourceWriter;
+
+/** \class cmCPackWIXGenerator
+ * \brief A generator for WIX files
+ */
+class cmCPackWIXGenerator : public cmCPackGenerator
+{
+public:
+  cmCPackTypeMacro(cmCPackWIXGenerator, cmCPackGenerator);
+
+protected:
+  virtual int InitializeInternal();
+
+  virtual int PackageFiles();
+
+  virtual const char* GetOutputExtension()
+    {
+    return ".msi";
+    }
+
+  virtual enum CPackSetDestdirSupport SupportsSetDestdir() const
+    {
+    return SETDESTDIR_UNSUPPORTED;
+    }
+
+  virtual bool SupportsAbsoluteDestination() const
+    {
+    return false;
+    }
+
+  virtual bool SupportsComponentInstallation() const
+    {
+    return false;
+    }
+
+private:
+  bool InitializeWiXConfiguration();
+
+  bool PackageFilesImpl();
+
+  bool CreateWiXVariablesIncludeFile();
+
+  void CopyDefinition(
+    cmWIXSourceWriter &source, const std::string &name);
+
+  void AddDefinition(cmWIXSourceWriter& source,
+    const std::string& name, const std::string& value);
+
+  bool CreateWiXSourceFiles();
+
+  bool CreateLicenseFile();
+
+  bool RunWiXCommand(const std::string& command);
+
+  bool RunCandleCommand(
+    const std::string& sourceFile, const std::string& objectFile);
+
+  bool RunLightCommand(const std::string& objectFiles);
+
+  void AddDirectoryAndFileDefinitons(const std::string& topdir,
+    const std::string& directoryId,
+    cmWIXSourceWriter& directoryDefinitions,
+    cmWIXSourceWriter& fileDefinitions,
+    cmWIXSourceWriter& featureDefinitions,
+    size_t& directoryCounter,
+    size_t& fileCounter);
+
+  bool RequireOption(const std::string& name, std::string& value) const;
+
+  std::string GetArchitecture() const;
+
+  static std::string GenerateGUID();
+
+  static std::string QuotePath(const std::string& path);
+
+  static std::string GetRightmostExtension(const std::string& filename);
+
+  std::vector<std::string> wixSources;
+};
+
+#endif

+ 137 - 0
Source/CPack/WiX/cmWIXRichTextFormatWriter.cxx

@@ -0,0 +1,137 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2012 Kitware, Inc.
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#include "cmWIXRichTextFormatWriter.h"
+
+#include <cmVersion.h>
+
+cmWIXRichTextFormatWriter::cmWIXRichTextFormatWriter(
+  const std::string& filename):
+    file(filename.c_str(), std::ios::binary)
+{
+  StartGroup();
+  WriteHeader();
+  WriteDocumentPrefix();
+}
+
+cmWIXRichTextFormatWriter::~cmWIXRichTextFormatWriter()
+{
+  EndGroup();
+
+  /* I haven't seen this in the RTF spec but
+   *  wordpad terminates its RTF like this */
+  file << "\r\n";
+  file.put(0);
+}
+
+void cmWIXRichTextFormatWriter::AddText(const std::string& text)
+{
+  typedef unsigned char rtf_byte_t;
+
+  for(size_t i = 0; i < text.size(); ++i)
+    {
+    rtf_byte_t c = rtf_byte_t(text[i]);
+
+    switch(c)
+      {
+    case '\\':
+      file << "\\\\";
+      break;
+    case '{':
+      file << "\\{";
+      break;
+    case '}':
+      file << "\\}";
+      break;
+    case '\n':
+      file << "\\par\r\n";
+      break;
+    case '\r':
+      continue;
+    default:
+        {
+        if(c <= 0x7F)
+          {
+          file << c;
+          }
+        else
+          {
+          file << "[NON-ASCII-" << int(c) << "]";
+          }
+        }
+      break;
+      }
+    }
+}
+
+void cmWIXRichTextFormatWriter::WriteHeader()
+{
+  ControlWord("rtf1");
+  ControlWord("ansi");
+  ControlWord("ansicpg1252");
+  ControlWord("deff0");
+  ControlWord("deflang1031");
+
+  WriteFontTable();
+  WriteGenerator();
+}
+
+void cmWIXRichTextFormatWriter::WriteFontTable()
+{
+  StartGroup();
+  ControlWord("fonttbl");
+
+  StartGroup();
+  ControlWord("f0");
+  ControlWord("fswiss");
+  ControlWord("fcharset0 Arial;");
+  EndGroup();
+
+  EndGroup();
+}
+
+void cmWIXRichTextFormatWriter::WriteGenerator()
+{
+  StartGroup();
+  NewControlWord("generator");
+  file << " CPack WiX Generator (" << cmVersion::GetCMakeVersion() << ");";
+  EndGroup();
+}
+
+void cmWIXRichTextFormatWriter::WriteDocumentPrefix()
+{
+  ControlWord("viewkind4");
+  ControlWord("uc1");
+  ControlWord("pard");
+  ControlWord("f0");
+  ControlWord("fs20");
+}
+
+void cmWIXRichTextFormatWriter::ControlWord(const std::string& keyword)
+{
+  file << "\\" << keyword;
+}
+
+void cmWIXRichTextFormatWriter::NewControlWord(const std::string& keyword)
+{
+  file << "\\*\\" << keyword;
+}
+
+void cmWIXRichTextFormatWriter::StartGroup()
+{
+  file.put('{');
+}
+
+void cmWIXRichTextFormatWriter::EndGroup()
+{
+  file.put('}');
+}

+ 46 - 0
Source/CPack/WiX/cmWIXRichTextFormatWriter.h

@@ -0,0 +1,46 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2000-2012 Kitware, Inc.
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmWIXRichTextFormatWriter_h
+#define cmWIXRichTextFormatWriter_h
+
+#include <fstream>
+
+/** \class cmWIXRichtTextFormatWriter
+ * \brief Helper class to generate Rich Text Format (RTF) documents
+ * from plain text (e.g. for license and welcome text)
+ */
+class cmWIXRichTextFormatWriter
+{
+public:
+  cmWIXRichTextFormatWriter(const std::string& filename);
+  ~cmWIXRichTextFormatWriter();
+
+  void AddText(const std::string& text);
+
+private:
+  void WriteHeader();
+  void WriteFontTable();
+  void WriteGenerator();
+
+  void WriteDocumentPrefix();
+
+  void ControlWord(const std::string& keyword);
+  void NewControlWord(const std::string& keyword);
+
+  void StartGroup();
+  void EndGroup();
+
+  std::ofstream file;
+};
+
+#endif

+ 189 - 0
Source/CPack/WiX/cmWIXSourceWriter.cxx

@@ -0,0 +1,189 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2012 Kitware, Inc.
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#include "cmWIXSourceWriter.h"
+
+#include <CPack/cmCPackGenerator.h>
+
+#include <windows.h>
+
+cmWIXSourceWriter::cmWIXSourceWriter(cmCPackLog* logger,
+  const std::string& filename,
+  bool isIncludeFile):
+    Logger(logger),
+    file(filename.c_str()),
+    state(DEFAULT)
+{
+  WriteXMLDeclaration();
+
+  if(isIncludeFile)
+    {
+    BeginElement("Include");
+    }
+  else
+    {
+    BeginElement("Wix");
+    }
+
+  AddAttribute("xmlns", "http://schemas.microsoft.com/wix/2006/wi");
+}
+
+cmWIXSourceWriter::~cmWIXSourceWriter()
+{
+  while(elements.size())
+    {
+    EndElement();
+    }
+}
+
+void cmWIXSourceWriter::BeginElement(const std::string& name)
+{
+  if(state == BEGIN)
+    {
+    file << ">";
+    }
+
+  file << "\n";
+  Indent(elements.size());
+  file << "<" << name;
+
+  elements.push_back(name);
+  state = BEGIN;
+}
+
+void cmWIXSourceWriter::EndElement()
+{
+  if(elements.empty())
+    {
+    cmCPackLogger(cmCPackLog::LOG_ERROR,
+      "can not end WiX element with no open elements" << std::endl);
+    return;
+    }
+
+  if(state == DEFAULT)
+    {
+    file << "\n";
+    Indent(elements.size()-1);
+    file << "</" << elements.back() << ">";
+    }
+  else
+    {
+    file << "/>";
+    }
+
+  elements.pop_back();
+  state = DEFAULT;
+}
+
+void cmWIXSourceWriter::AddProcessingInstruction(
+  const std::string& target, const std::string& content)
+{
+  if(state == BEGIN)
+    {
+    file << ">";
+    }
+
+  file << "\n";
+  Indent(elements.size());
+  file << "<?" << target << " " << content << "?>";
+
+  state = DEFAULT;
+}
+
+void cmWIXSourceWriter::AddAttribute(
+  const std::string& key, const std::string& value)
+{
+  std::string utf8 = WindowsCodepageToUtf8(value);
+
+  file << " " << key << "=\"" << EscapeAttributeValue(utf8) << '"';
+}
+
+std::string cmWIXSourceWriter::WindowsCodepageToUtf8(const std::string& value)
+{
+  if(value.empty())
+    {
+    return std::string();
+    }
+
+  int characterCount = MultiByteToWideChar(
+    CP_ACP, 0, value.c_str(), static_cast<int>(value.size()), 0, 0);
+
+  if(characterCount == 0)
+    {
+    return std::string();
+    }
+
+  std::vector<wchar_t> utf16(characterCount);
+
+  MultiByteToWideChar(
+    CP_ACP, 0, value.c_str(), static_cast<int>(value.size()),
+    &utf16[0], static_cast<int>(utf16.size()));
+
+  int utf8ByteCount = WideCharToMultiByte(
+    CP_UTF8, 0, &utf16[0], static_cast<int>(utf16.size()), 0, 0, 0, 0);
+
+  if(utf8ByteCount == 0)
+    {
+    return std::string();
+    }
+
+  std::vector<char> utf8(utf8ByteCount);
+
+  WideCharToMultiByte(CP_UTF8, 0, &utf16[0], static_cast<int>(utf16.size()),
+    &utf8[0], static_cast<int>(utf8.size()), 0, 0);
+
+  return std::string(&utf8[0], utf8.size());
+}
+
+
+void cmWIXSourceWriter::WriteXMLDeclaration()
+{
+  file << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << std::endl;
+}
+
+void cmWIXSourceWriter::Indent(size_t count)
+{
+  for(size_t i = 0; i < count; ++i)
+    {
+    file << "    ";
+    }
+}
+
+std::string cmWIXSourceWriter::EscapeAttributeValue(
+  const std::string& value)
+{
+  std::string result;
+  result.reserve(value.size());
+
+  char c = 0;
+  for(size_t i = 0 ; i < value.size(); ++i)
+    {
+    c = value[i];
+    switch(c)
+      {
+    case '<':
+      result += "&lt;";
+      break;
+    case '&':
+      result +="&amp;";
+      break;
+    case '"':
+      result += "&quot;";
+      break;
+    default:
+      result += c;
+      break;
+      }
+    }
+
+  return result;
+}

+ 67 - 0
Source/CPack/WiX/cmWIXSourceWriter.h

@@ -0,0 +1,67 @@
+/*============================================================================
+  CMake - Cross Platform Makefile Generator
+  Copyright 2012 Kitware, Inc.
+
+  Distributed under the OSI-approved BSD License (the "License");
+  see accompanying file Copyright.txt for details.
+
+  This software is distributed WITHOUT ANY WARRANTY; without even the
+  implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+  See the License for more information.
+============================================================================*/
+
+#ifndef cmWIXSourceWriter_h
+#define cmWIXSourceWriter_h
+
+#include <vector>
+#include <string>
+#include <fstream>
+
+#include <CPack/cmCPackLog.h>
+
+/** \class cmWIXSourceWriter
+ * \brief Helper class to generate XML WiX source files
+ */
+class cmWIXSourceWriter
+{
+public:
+  cmWIXSourceWriter(cmCPackLog* logger,
+    const std::string& filename, bool isIncludeFile = false);
+
+  ~cmWIXSourceWriter();
+
+  void BeginElement(const std::string& name);
+
+  void EndElement();
+
+  void AddProcessingInstruction(
+    const std::string& target, const std::string& content);
+
+  void AddAttribute(
+    const std::string& key, const std::string& value);
+
+  static std::string WindowsCodepageToUtf8(const std::string& value);
+
+private:
+  enum State
+  {
+    DEFAULT,
+    BEGIN
+  };
+
+  void WriteXMLDeclaration();
+
+  void Indent(size_t count);
+
+  static std::string EscapeAttributeValue(const std::string& value);
+
+  cmCPackLog* Logger;
+
+  std::ofstream file;
+
+  State state;
+
+  std::vector<std::string> elements;
+};
+
+#endif

+ 1 - 2
Source/CPack/cmCPackGenerator.cxx

@@ -23,7 +23,6 @@
 
 #include <cmsys/SystemTools.hxx>
 #include <cmsys/Glob.hxx>
-#include <memory> // auto_ptr
 #include <algorithm>
 
 #if defined(__HAIKU__)
@@ -696,7 +695,7 @@ int cmCPackGenerator::InstallProjectViaInstallCMakeProjects(
         cm.SetProgressCallback(cmCPackGeneratorProgress, this);
         cmGlobalGenerator gg;
         gg.SetCMakeInstance(&cm);
-        std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
+        cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
         cmMakefile *mf = lg->GetMakefile();
         std::string realInstallDirectory = tempInstallDirectory;
         if ( !installSubDirectory.empty() && installSubDirectory != "/" )

+ 15 - 2
Source/CPack/cmCPackGeneratorFactory.cxx

@@ -19,6 +19,7 @@
 #include "cmCPackZIPGenerator.h"
 #include "cmCPackSTGZGenerator.h"
 #include "cmCPackNSISGenerator.h"
+
 #ifdef __APPLE__
 #  include "cmCPackDragNDropGenerator.h"
 #  include "cmCPackBundleGenerator.h"
@@ -32,11 +33,14 @@
 #endif
 
 #if !defined(_WIN32) \
- && !defined(__QNXNTO__) && !defined(__BEOS__)
+ && !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__HAIKU__)
 #  include "cmCPackDebGenerator.h"
 #  include "cmCPackRPMGenerator.h"
 #endif
 
+#ifdef _WIN32
+#  include "WiX/cmCPackWIXGenerator.h"
+#endif
 
 #include "cmCPackLog.h"
 
@@ -61,6 +65,8 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
     {
     this->RegisterGenerator("NSIS", "Null Soft Installer",
       cmCPackNSISGenerator::CreateGenerator);
+    this->RegisterGenerator("NSIS64", "Null Soft Installer (64-bit)",
+      cmCPackNSISGenerator::CreateGenerator64);
     }
 #ifdef __CYGWIN__
   if (cmCPackCygwinBinaryGenerator::CanGenerate())
@@ -80,6 +86,13 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
     this->RegisterGenerator("ZIP", "ZIP file format",
       cmCPackZIPGenerator::CreateGenerator);
     }
+#ifdef _WIN32
+  if (cmCPackWIXGenerator::CanGenerate())
+    {
+    this->RegisterGenerator("WIX", "MSI file format via WiX tools",
+      cmCPackWIXGenerator::CreateGenerator);
+    }
+#endif
   if (cmCPackTarBZip2Generator::CanGenerate())
     {
     this->RegisterGenerator("TBZ2", "Tar BZip2 compression",
@@ -113,7 +126,7 @@ cmCPackGeneratorFactory::cmCPackGeneratorFactory()
     }
 #endif
 #if !defined(_WIN32) \
-  && !defined(__QNXNTO__) && !defined(__BEOS__)
+  && !defined(__QNXNTO__) && !defined(__BEOS__) && !defined(__HAIKU__)
   if (cmCPackDebGenerator::CanGenerate())
     {
     this->RegisterGenerator("DEB", "Debian packages",

+ 17 - 1
Source/CPack/cmCPackNSISGenerator.cxx

@@ -33,8 +33,9 @@
 #endif
 
 //----------------------------------------------------------------------
-cmCPackNSISGenerator::cmCPackNSISGenerator()
+cmCPackNSISGenerator::cmCPackNSISGenerator(bool nsis64)
 {
+  Nsis64 = nsis64;
 }
 
 //----------------------------------------------------------------------
@@ -359,6 +360,21 @@ int cmCPackNSISGenerator::InitializeInternal()
   bool gotRegValue = false;
 
 #ifdef _WIN32
+  if (Nsis64)
+    {
+    if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
+      "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath,
+      cmsys::SystemTools::KeyWOW64_64) )
+      {
+      gotRegValue = true;
+      }
+    if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
+      "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS", nsisPath,
+      cmsys::SystemTools::KeyWOW64_64) )
+      {
+      gotRegValue = true;
+      }
+    }
   if ( !gotRegValue && cmsys::SystemTools::ReadRegistryValue(
       "HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS\\Unicode", nsisPath,
       cmsys::SystemTools::KeyWOW64_32) )

+ 6 - 1
Source/CPack/cmCPackNSISGenerator.h

@@ -27,10 +27,13 @@ class cmCPackNSISGenerator : public cmCPackGenerator
 public:
   cmCPackTypeMacro(cmCPackNSISGenerator, cmCPackGenerator);
 
+  static cmCPackGenerator* CreateGenerator64()
+    { return new cmCPackNSISGenerator(true); }
+
   /**
    * Construct generator
    */
-  cmCPackNSISGenerator();
+  cmCPackNSISGenerator(bool nsis64 = false);
   virtual ~cmCPackNSISGenerator();
 
 protected:
@@ -77,6 +80,8 @@ protected:
   /// Translations any newlines found in the string into \\r\\n, so that the
   /// resulting string can be used within NSIS.
   static std::string TranslateNewlines(std::string str);
+
+  bool Nsis64;
 };
 
 #endif

+ 1 - 2
Source/CPack/cpack.cxx

@@ -27,7 +27,6 @@
 
 #include <cmsys/CommandLineArguments.hxx>
 #include <cmsys/SystemTools.hxx>
-#include <memory> // auto_ptr
 
 //----------------------------------------------------------------------------
 static const char * cmDocumentationName[][3] =
@@ -276,7 +275,7 @@ int main (int argc, char *argv[])
   cminst.RemoveUnscriptableCommands();
   cmGlobalGenerator cmgg;
   cmgg.SetCMakeInstance(&cminst);
-  std::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
+  cmsys::auto_ptr<cmLocalGenerator> cmlg(cmgg.CreateLocalGenerator());
   cmMakefile* globalMF = cmlg->GetMakefile();
 
   bool cpackConfigFileSpecified = true;

+ 11 - 4
Source/CTest/cmCTestCoverageHandler.cxx

@@ -1097,10 +1097,17 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
         }
       else
         {
-        cmCTestLog(this->CTest, ERROR_MESSAGE,
-          "Unknown gcov output line: [" << line->c_str() << "]" << std::endl);
-        cont->Error ++;
-        //abort();
+        // gcov 4.7 can have output lines saying "No executable lines" and
+        // "Removing 'filename.gcov'"... Don't log those as "errors."
+        if(*line != "No executable lines" &&
+           !cmSystemTools::StringStartsWith(line->c_str(), "Removing "))
+          {
+          cmCTestLog(this->CTest, ERROR_MESSAGE,
+            "Unknown gcov output line: [" << line->c_str() << "]"
+            << std::endl);
+          cont->Error ++;
+          //abort();
+          }
         }
 
 

+ 6 - 1
Source/CTest/cmCTestMultiProcessHandler.cxx

@@ -248,7 +248,12 @@ bool cmCTestMultiProcessHandler::StartTest(int test)
 //---------------------------------------------------------
 void cmCTestMultiProcessHandler::StartNextTests()
 {
-  size_t numToStart = this->ParallelLevel - this->RunningCount;
+  size_t numToStart = 0;
+  if(this->RunningCount < this->ParallelLevel)
+    {
+    numToStart = this->ParallelLevel - this->RunningCount;
+    }
+
   if(numToStart == 0)
     {
     return;

+ 1 - 2
Source/CTest/cmCTestTestHandler.cxx

@@ -32,7 +32,6 @@
 #include <math.h>
 #include <float.h>
 
-#include <memory> // auto_ptr
 #include <set>
 
 //----------------------------------------------------------------------
@@ -1547,7 +1546,7 @@ void cmCTestTestHandler::GetListOfTests()
   cmake cm;
   cmGlobalGenerator gg;
   gg.SetCMakeInstance(&cm);
-  std::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
+  cmsys::auto_ptr<cmLocalGenerator> lg(gg.CreateLocalGenerator());
   cmMakefile *mf = lg->GetMakefile();
   mf->AddDefinition("CTEST_CONFIGURATION_TYPE",
     this->CTest->GetConfigType().c_str());

+ 4 - 0
Source/cmAddLibraryCommand.h

@@ -134,6 +134,10 @@ public:
       "They may contain custom commands generating such sources, but not "
       "PRE_BUILD, PRE_LINK, or POST_BUILD commands.  "
       "Object libraries cannot be imported, exported, installed, or linked."
+      "  "
+      "Some native build systems may not like targets that have only "
+      "object files, so consider adding at least one real source file "
+      "to any target that references $<TARGET_OBJECTS:objlib>."
       ;
     }
 

+ 1 - 0
Source/cmBootstrapCommands.cxx

@@ -89,6 +89,7 @@
 #include "cmStringCommand.cxx"
 #include "cmSubdirCommand.cxx"
 #include "cmTargetLinkLibrariesCommand.cxx"
+#include "cmTimestamp.cxx"
 #include "cmTryCompileCommand.cxx"
 #include "cmTryRunCommand.cxx"
 #include "cmUnsetCommand.cxx"

+ 1 - 1
Source/cmCTest.cxx

@@ -53,7 +53,7 @@
 #include <cm_zlib.h>
 #include <cmsys/Base64.h>
 
-#if defined(__BEOS__) && !defined(__HAIKU__)
+#if defined(__BEOS__)
 #include <be/kernel/OS.h>   /* disable_debugger() API. */
 #endif
 

+ 2 - 2
Source/cmCommandArgumentParser.cxx

@@ -279,7 +279,7 @@ typedef short int yytype_int16;
 #define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
 
 #ifndef YY_
-# if YYENABLE_NLS
+# if defined YYENABLE_NLS && YYENABLE_NLS
 #  if ENABLE_NLS
 #   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
 #   define YY_(msgid) dgettext ("bison-runtime", msgid)
@@ -701,7 +701,7 @@ while (YYID (0))
    we won't break user code: when these are the locations we know.  */
 
 #ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
+# if defined YYLTYPE_IS_TRIVIAL && YYLTYPE_IS_TRIVIAL
 #  define YY_LOCATION_PRINT(File, Loc)                  \
      fprintf (File, "%d.%d-%d.%d",                      \
               (Loc).first_line, (Loc).first_column,     \

+ 5 - 0
Source/cmCommands.cxx

@@ -28,6 +28,9 @@
 #include "cmRemoveDefinitionsCommand.cxx"
 #include "cmSourceGroupCommand.cxx"
 #include "cmSubdirDependsCommand.cxx"
+#include "cmTargetCompileDefinitionsCommand.cxx"
+#include "cmTargetIncludeDirectoriesCommand.cxx"
+#include "cmTargetPropCommandBase.cxx"
 #include "cmUseMangledMesaCommand.cxx"
 #include "cmUtilitySourceCommand.cxx"
 #include "cmVariableRequiresCommand.cxx"
@@ -66,6 +69,8 @@ void GetPredefinedCommands(std::list<cmCommand*>&
   commands.push_back(new cmRemoveDefinitionsCommand);
   commands.push_back(new cmSourceGroupCommand);
   commands.push_back(new cmSubdirDependsCommand);
+  commands.push_back(new cmTargetIncludeDirectoriesCommand);
+  commands.push_back(new cmTargetCompileDefinitionsCommand);
   commands.push_back(new cmUseMangledMesaCommand);
   commands.push_back(new cmUtilitySourceCommand);
   commands.push_back(new cmVariableRequiresCommand);

+ 6 - 5
Source/cmComputeLinkDepends.cxx

@@ -172,10 +172,11 @@ satisfy dependencies.
 
 //----------------------------------------------------------------------------
 cmComputeLinkDepends
-::cmComputeLinkDepends(cmTarget* target, const char* config)
+::cmComputeLinkDepends(cmTarget* target, const char* config, cmTarget* head)
 {
   // Store context information.
   this->Target = target;
+  this->HeadTarget = head;
   this->Makefile = this->Target->GetMakefile();
   this->LocalGenerator = this->Makefile->GetLocalGenerator();
   this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
@@ -352,7 +353,7 @@ void cmComputeLinkDepends::FollowLinkEntry(BFSEntry const& qe)
     {
     // Follow the target dependencies.
     if(cmTarget::LinkInterface const* iface =
-       entry.Target->GetLinkInterface(this->Config))
+       entry.Target->GetLinkInterface(this->Config, this->HeadTarget))
       {
       // This target provides its own link interface information.
       this->AddLinkEntries(depender_index, iface->Libraries);
@@ -444,7 +445,7 @@ void cmComputeLinkDepends::HandleSharedDependency(SharedDepEntry const& dep)
   if(entry.Target)
     {
     if(cmTarget::LinkInterface const* iface =
-       entry.Target->GetLinkInterface(this->Config))
+       entry.Target->GetLinkInterface(this->Config, this->HeadTarget))
       {
       // Follow public and private dependencies transitively.
       this->FollowSharedDeps(index, iface, true);
@@ -533,7 +534,7 @@ void cmComputeLinkDepends::AddDirectLinkEntries()
 {
   // Add direct link dependencies in this configuration.
   cmTarget::LinkImplementation const* impl =
-    this->Target->GetLinkImplementation(this->Config);
+    this->Target->GetLinkImplementation(this->Config, this->HeadTarget);
   this->AddLinkEntries(-1, impl->Libraries);
   for(std::vector<std::string>::const_iterator
         wi = impl->WrongConfigLibraries.begin();
@@ -944,7 +945,7 @@ int cmComputeLinkDepends::ComputeComponentCount(NodeList const& nl)
     if(cmTarget* target = this->EntryList[*ni].Target)
       {
       if(cmTarget::LinkInterface const* iface =
-         target->GetLinkInterface(this->Config))
+         target->GetLinkInterface(this->Config, this->HeadTarget))
         {
         if(iface->Multiplicity > count)
           {

+ 2 - 1
Source/cmComputeLinkDepends.h

@@ -32,7 +32,7 @@ class cmake;
 class cmComputeLinkDepends
 {
 public:
-  cmComputeLinkDepends(cmTarget* target, const char* config);
+  cmComputeLinkDepends(cmTarget* target, const char* config, cmTarget *head);
   ~cmComputeLinkDepends();
 
   // Basic information about each link item.
@@ -59,6 +59,7 @@ private:
 
   // Context information.
   cmTarget* Target;
+  cmTarget* HeadTarget;
   cmMakefile* Makefile;
   cmLocalGenerator* LocalGenerator;
   cmGlobalGenerator* GlobalGenerator;

+ 32 - 8
Source/cmComputeLinkInformation.cxx

@@ -239,10 +239,12 @@ because this need be done only for shared libraries without soname-s.
 
 //----------------------------------------------------------------------------
 cmComputeLinkInformation
-::cmComputeLinkInformation(cmTarget* target, const char* config)
+::cmComputeLinkInformation(cmTarget* target, const char* config,
+                           cmTarget *headTarget)
 {
   // Store context information.
   this->Target = target;
+  this->HeadTarget = headTarget;
   this->Makefile = this->Target->GetMakefile();
   this->LocalGenerator = this->Makefile->GetLocalGenerator();
   this->GlobalGenerator = this->LocalGenerator->GetGlobalGenerator();
@@ -265,7 +267,7 @@ cmComputeLinkInformation
   this->OrderDependentRPath = 0;
 
   // Get the language used for linking this target.
-  this->LinkLanguage = this->Target->GetLinkerLanguage(config);
+  this->LinkLanguage = this->Target->GetLinkerLanguage(config, headTarget);
   if(!this->LinkLanguage)
     {
     // The Compute method will do nothing, so skip the rest of the
@@ -503,7 +505,7 @@ bool cmComputeLinkInformation::Compute()
     }
 
   // Compute the ordered link line items.
-  cmComputeLinkDepends cld(this->Target, this->Config);
+  cmComputeLinkDepends cld(this->Target, this->Config, this->HeadTarget);
   cld.SetOldLinkDirMode(this->OldLinkDirMode);
   cmComputeLinkDepends::EntryVector const& linkEntries = cld.Compute();
 
@@ -569,7 +571,8 @@ bool cmComputeLinkInformation::Compute()
 void cmComputeLinkInformation::AddImplicitLinkInfo()
 {
   // The link closure lists all languages whose implicit info is needed.
-  cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config);
+  cmTarget::LinkClosure const* lc=this->Target->GetLinkClosure(this->Config,
+                                                          this->HeadTarget);
   for(std::vector<std::string>::const_iterator li = lc->Languages.begin();
       li != lc->Languages.end(); ++li)
     {
@@ -1376,10 +1379,31 @@ void cmComputeLinkInformation::DropDirectoryItem(std::string const& item)
 //----------------------------------------------------------------------------
 void cmComputeLinkInformation::ComputeFrameworkInfo()
 {
-  // Avoid adding system framework paths.  See "man ld" on OS X.
-  this->FrameworkPathsEmmitted.insert("/Library/Frameworks");
-  this->FrameworkPathsEmmitted.insert("/Network/Library/Frameworks");
-  this->FrameworkPathsEmmitted.insert("/System/Library/Frameworks");
+  // Avoid adding implicit framework paths.
+  std::vector<std::string> implicitDirVec;
+
+  // Get platform-wide implicit directories.
+  if(const char* implicitLinks = this->Makefile->GetDefinition
+     ("CMAKE_PLATFORM_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES"))
+    {
+    cmSystemTools::ExpandListArgument(implicitLinks, implicitDirVec);
+    }
+
+  // Get language-specific implicit directories.
+  std::string implicitDirVar = "CMAKE_";
+  implicitDirVar += this->LinkLanguage;
+  implicitDirVar += "_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES";
+  if(const char* implicitDirs =
+     this->Makefile->GetDefinition(implicitDirVar.c_str()))
+    {
+    cmSystemTools::ExpandListArgument(implicitDirs, implicitDirVec);
+    }
+
+  for(std::vector<std::string>::const_iterator i = implicitDirVec.begin();
+      i != implicitDirVec.end(); ++i)
+    {
+    this->FrameworkPathsEmmitted.insert(*i);
+    }
 
   // Regular expression to extract a framework path and name.
   this->SplitFramework.compile("(.*)/(.*)\\.framework$");

+ 3 - 1
Source/cmComputeLinkInformation.h

@@ -29,7 +29,8 @@ class cmOrderDirectories;
 class cmComputeLinkInformation
 {
 public:
-  cmComputeLinkInformation(cmTarget* target, const char* config);
+  cmComputeLinkInformation(cmTarget* target, const char* config,
+                           cmTarget* headTarget);
   ~cmComputeLinkInformation();
   bool Compute();
 
@@ -74,6 +75,7 @@ private:
 
   // Context information.
   cmTarget* Target;
+  cmTarget* HeadTarget;
   cmMakefile* Makefile;
   cmLocalGenerator* LocalGenerator;
   cmGlobalGenerator* GlobalGenerator;

+ 92 - 6
Source/cmComputeTargetDepends.cxx

@@ -200,20 +200,48 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
   // Get the depender.
   cmTarget* depender = this->Targets[depender_index];
 
-  // Loop over all targets linked directly.
+  // Loop over all targets linked directly in all configs.
+  // We need to make targets depend on the union of all config-specific
+  // dependencies in all targets, because the generated build-systems can't
+  // deal with config-specific dependencies.
   {
-  cmTarget::LinkLibraryVectorType const& tlibs =
-    depender->GetOriginalLinkLibraries();
   std::set<cmStdString> emitted;
+  {
+  std::vector<std::string> tlibs;
+  depender->GetDirectLinkLibraries(0, tlibs, depender);
   // A target should not depend on itself.
   emitted.insert(depender->GetName());
-  for(cmTarget::LinkLibraryVectorType::const_iterator lib = tlibs.begin();
+  for(std::vector<std::string>::const_iterator lib = tlibs.begin();
       lib != tlibs.end(); ++lib)
     {
     // Don't emit the same library twice for this target.
-    if(emitted.insert(lib->first).second)
+    if(emitted.insert(*lib).second)
       {
-      this->AddTargetDepend(depender_index, lib->first.c_str(), true);
+      this->AddTargetDepend(depender_index, lib->c_str(), true);
+      this->AddInterfaceDepends(depender_index, lib->c_str(),
+                                true, emitted);
+      }
+    }
+  }
+  std::vector<std::string> configs;
+  depender->GetMakefile()->GetConfigurations(configs);
+  for (std::vector<std::string>::const_iterator it = configs.begin();
+    it != configs.end(); ++it)
+    {
+    std::vector<std::string> tlibs;
+    depender->GetDirectLinkLibraries(it->c_str(), tlibs, depender);
+    // A target should not depend on itself.
+    emitted.insert(depender->GetName());
+    for(std::vector<std::string>::const_iterator lib = tlibs.begin();
+        lib != tlibs.end(); ++lib)
+      {
+      // Don't emit the same library twice for this target.
+      if(emitted.insert(*lib).second)
+        {
+        this->AddTargetDepend(depender_index, lib->c_str(), true);
+        this->AddInterfaceDepends(depender_index, lib->c_str(),
+                                  true, emitted);
+        }
       }
     }
   }
@@ -236,6 +264,64 @@ void cmComputeTargetDepends::CollectTargetDepends(int depender_index)
   }
 }
 
+//----------------------------------------------------------------------------
+void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
+                                                 cmTarget* dependee,
+                                                 const char *config,
+                                               std::set<cmStdString> &emitted)
+{
+  cmTarget* depender = this->Targets[depender_index];
+  if(cmTarget::LinkInterface const* iface =
+                                dependee->GetLinkInterface(config, depender))
+    {
+    for(std::vector<std::string>::const_iterator
+        lib = iface->Libraries.begin();
+        lib != iface->Libraries.end(); ++lib)
+      {
+      // Don't emit the same library twice for this target.
+      if(emitted.insert(*lib).second)
+        {
+        this->AddTargetDepend(depender_index, lib->c_str(), true);
+        }
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmComputeTargetDepends::AddInterfaceDepends(int depender_index,
+                                             const char* dependee_name,
+                                             bool linking,
+                                             std::set<cmStdString> &emitted)
+{
+  cmTarget* depender = this->Targets[depender_index];
+  cmTarget* dependee =
+    depender->GetMakefile()->FindTargetToUse(dependee_name);
+  // Skip targets that will not really be linked.  This is probably a
+  // name conflict between an external library and an executable
+  // within the project.
+  if(linking && dependee &&
+     dependee->GetType() == cmTarget::EXECUTABLE &&
+     !dependee->IsExecutableWithExports())
+    {
+    dependee = 0;
+    }
+
+  if(dependee)
+    {
+    this->AddInterfaceDepends(depender_index, dependee, 0, emitted);
+    std::vector<std::string> configs;
+    depender->GetMakefile()->GetConfigurations(configs);
+    for (std::vector<std::string>::const_iterator it = configs.begin();
+      it != configs.end(); ++it)
+      {
+      // A target should not depend on itself.
+      emitted.insert(depender->GetName());
+      this->AddInterfaceDepends(depender_index, dependee,
+                                it->c_str(), emitted);
+      }
+    }
+}
+
 //----------------------------------------------------------------------------
 void cmComputeTargetDepends::AddTargetDepend(int depender_index,
                                              const char* dependee_name,

+ 5 - 1
Source/cmComputeTargetDepends.h

@@ -48,7 +48,11 @@ private:
                        bool linking);
   void AddTargetDepend(int depender_index, cmTarget* dependee, bool linking);
   bool ComputeFinalDepends(cmComputeComponentGraph const& ccg);
-
+  void AddInterfaceDepends(int depender_index, const char* dependee_name,
+                           bool linking, std::set<cmStdString> &emitted);
+  void AddInterfaceDepends(int depender_index, cmTarget* dependee,
+                           const char *config,
+                           std::set<cmStdString> &emitted);
   cmGlobalGenerator* GlobalGenerator;
   bool DebugMode;
   bool NoCycles;

+ 2 - 2
Source/cmCustomCommandGenerator.cxx

@@ -47,7 +47,7 @@ std::string cmCustomCommandGenerator::GetCommand(unsigned int c) const
     {
     return target->GetLocation(this->Config);
     }
-  return this->GE->Parse(argv0).Evaluate(this->Makefile, this->Config);
+  return this->GE->Parse(argv0)->Evaluate(this->Makefile, this->Config);
 }
 
 //----------------------------------------------------------------------------
@@ -58,7 +58,7 @@ cmCustomCommandGenerator
   cmCustomCommandLine const& commandLine = this->CC.GetCommandLines()[c];
   for(unsigned int j=1;j < commandLine.size(); ++j)
     {
-    std::string arg = this->GE->Parse(commandLine[j]).Evaluate(this->Makefile,
+    std::string arg = this->GE->Parse(commandLine[j])->Evaluate(this->Makefile,
                                                                this->Config);
     cmd += " ";
     if(this->OldStyle)

+ 10 - 0
Source/cmDocumentGeneratorExpressions.h

@@ -26,6 +26,16 @@
   "strings which contain a '>' for example.\n"                          \
   "  $<COMMA>                  = A literal ','. Used to compare "       \
   "strings which contain a ',' for example.\n"                          \
+  "  $<TARGET_NAME:...>        = Marks ... as being the name of a "     \
+  "target.  This is required if exporting targets to multiple "         \
+  "dependent export sets.  The '...' must be a literal name of a "      \
+  "target- it may not contain generator expressions.\n"                 \
+  "  $<INSTALL_INTERFACE:...>  = content of \"...\" when the property " \
+  "is exported using install(EXPORT), and empty otherwise.\n"           \
+  "  $<BUILD_INTERFACE:...>    = content of \"...\" when the property " \
+  "is exported using export(), or when the target is used by another "  \
+  "target in the same buildsystem. Expands to the empty string "        \
+  "otherwise.\n"                                                        \
   "  $<TARGET_FILE:tgt>        = main file (.exe, .so.1.2, .a)\n"       \
   "  $<TARGET_LINKER_FILE:tgt> = file used to link (.a, .lib, .so)\n"   \
   "  $<TARGET_SONAME_FILE:tgt> = file with soname (.so.3)\n"            \

+ 36 - 0
Source/cmDocumentVariables.cxx

@@ -896,6 +896,14 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
       " script, it may get fatal error messages from the script.",false,
       "Variables That Change Behavior");
 
+  cm->DefineProperty
+    ("CMAKE_DEBUG_TARGET_PROPERTIES", cmProperty::VARIABLE,
+     "Enables tracing output for target properties.",
+     "This variable can be populated with a list of properties to generate "
+     "debug output for when evaluating target properties.  Currently it can "
+     "only be used when evaluating the INCLUDE_DIRECTORIES target property.  "
+     "In that case, it outputs a backtrace for each include directory in "
+     "the build.  Default is unset.",false,"Variables That Change Behavior");
   cm->DefineProperty
     ("CMAKE_SUBLIMECLANG_DISABLED", cmProperty::VARIABLE,
      "Used by the Sublime Text 2 generator to disable SublimeClang in "
@@ -1146,6 +1154,17 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      false,
      "Variables that Control the Build");
 
+  cm->DefineProperty
+    ("CMAKE_BUILD_INTERFACE_INCLUDES", cmProperty::VARIABLE,
+     "Automatically add the current source- and build directories "
+     "to the INTERFACE_INCLUDE_DIRECTORIES.",
+     "If this variable is enabled, CMake automatically adds for each "
+     "target ${CMAKE_CURRENT_SOURCE_DIR} and ${CMAKE_CURRENT_BINARY_DIR} "
+     "to the INTERFACE_INCLUDE_DIRECTORIES."
+     "By default CMAKE_BUILD_INTERFACE_INCLUDES is OFF.",
+     false,
+     "Variables that Control the Build");
+
   cm->DefineProperty
     ("CMAKE_INSTALL_RPATH", cmProperty::VARIABLE,
      "The rpath to use for installed targets.",
@@ -1630,6 +1649,23 @@ void cmDocumentVariables::DefineVariables(cmake* cm)
      "These paths are implicit linker search directories for the compiler's "
      "language.  "
      "CMake automatically detects these directories for each language and "
+     "reports the results in this variable."
+     "\n"
+     "When a library in one of these directories is given by full path to "
+     "target_link_libraries() CMake will generate the -l<name> form on "
+     "link lines to ensure the linker searches its implicit directories "
+     "for the library.  "
+     "Note that some toolchains read implicit directories from an "
+     "environment variable such as LIBRARY_PATH so keep its value "
+     "consistent when operating in a given build tree.",false,
+     "Variables for Languages");
+
+  cm->DefineProperty
+    ("CMAKE_<LANG>_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES", cmProperty::VARIABLE,
+     "Implicit linker framework search path detected for language <LANG>.",
+     "These paths are implicit linker framework search directories for "
+     "the compiler's language.  "
+     "CMake automatically detects these directories for each language and "
      "reports the results in this variable.", false,
      "Variables for Languages");
 

+ 34 - 2
Source/cmExportBuildFileGenerator.cxx

@@ -22,15 +22,20 @@ cmExportBuildFileGenerator::cmExportBuildFileGenerator()
 //----------------------------------------------------------------------------
 bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
 {
-  // Create all the imported targets.
+  std::vector<cmTarget*> allTargets;
+  {
+  std::string expectedTargets;
+  std::string sep;
   for(std::vector<cmTarget*>::const_iterator
         tei = this->Exports->begin();
       tei != this->Exports->end(); ++tei)
     {
+    expectedTargets += sep + this->Namespace + (*tei)->GetName();
+    sep = " ";
     cmTarget* te = *tei;
     if(this->ExportedTargets.insert(te).second)
       {
-      this->GenerateImportTargetCode(os, te);
+      allTargets.push_back(te);
       }
     else
       {
@@ -44,6 +49,33 @@ bool cmExportBuildFileGenerator::GenerateMainFile(std::ostream& os)
       }
     }
 
+  this->GenerateExpectedTargetsCode(os, expectedTargets);
+  }
+
+  std::vector<std::string> missingTargets;
+
+  // Create all the imported targets.
+  for(std::vector<cmTarget*>::const_iterator
+        tei = allTargets.begin();
+      tei != allTargets.end(); ++tei)
+    {
+    cmTarget* te = *tei;
+    this->GenerateImportTargetCode(os, te);
+
+    ImportPropertyMap properties;
+
+    this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES", te,
+                                    cmGeneratorExpression::BuildInterface,
+                                    properties, missingTargets);
+    this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS", te,
+                                    cmGeneratorExpression::BuildInterface,
+                                    properties, missingTargets);
+
+    this->GenerateInterfaceProperties(te, os, properties);
+    }
+
+  this->GenerateMissingTargetsCheckCode(os, missingTargets);
+
   // Generate import file content for each configuration.
   for(std::vector<std::string>::const_iterator
         ci = this->Configurations.begin();

+ 228 - 1
Source/cmExportFileGenerator.cxx

@@ -124,6 +124,201 @@ void cmExportFileGenerator::GenerateImportConfig(std::ostream& os,
   this->GenerateImportTargetsConfig(os, config, suffix);
 }
 
+//----------------------------------------------------------------------------
+void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
+                      const char *outputName,
+                      cmTarget *target,
+                      cmGeneratorExpression::PreprocessContext preprocessRule,
+                      ImportPropertyMap &properties,
+                      std::vector<std::string> &missingTargets)
+{
+  const char *input = target->GetProperty(propName);
+  if (input)
+    {
+    if (!*input)
+      {
+      // Set to empty
+      properties[outputName] = "";
+      return;
+      }
+
+    std::string prepro = cmGeneratorExpression::Preprocess(input,
+                                                           preprocessRule);
+    if (!prepro.empty())
+      {
+      this->ResolveTargetsInGeneratorExpressions(prepro, target,
+                                                 missingTargets);
+      properties[outputName] = prepro;
+      }
+    }
+}
+
+//----------------------------------------------------------------------------
+void cmExportFileGenerator::PopulateInterfaceProperty(const char *propName,
+                      cmTarget *target,
+                      cmGeneratorExpression::PreprocessContext preprocessRule,
+                      ImportPropertyMap &properties,
+                      std::vector<std::string> &missingTargets)
+{
+  this->PopulateInterfaceProperty(propName, propName, target, preprocessRule,
+                            properties, missingTargets);
+}
+
+//----------------------------------------------------------------------------
+void cmExportFileGenerator::GenerateInterfaceProperties(cmTarget *target,
+                                        std::ostream& os,
+                                        const ImportPropertyMap &properties)
+{
+  if (!properties.empty())
+    {
+    std::string targetName = this->Namespace;
+    targetName += target->GetName();
+    os << "SET_TARGET_PROPERTIES(" << targetName << " PROPERTIES\n";
+    for(ImportPropertyMap::const_iterator pi = properties.begin();
+        pi != properties.end(); ++pi)
+      {
+      os << "  " << pi->first << " \"" << pi->second << "\"\n";
+      }
+    os << ")\n\n";
+    }
+}
+
+//----------------------------------------------------------------------------
+void
+cmExportFileGenerator::ResolveTargetsInGeneratorExpressions(
+                                    std::string &input,
+                                    cmTarget* target,
+                                    std::vector<std::string> &missingTargets)
+{
+  std::string::size_type pos = 0;
+  std::string::size_type lastPos = pos;
+
+  cmMakefile *mf = target->GetMakefile();
+  std::string errorString;
+
+  while((pos = input.find("$<TARGET_PROPERTY:", lastPos)) != input.npos)
+    {
+    std::string::size_type nameStartPos = pos +
+                                            sizeof("$<TARGET_PROPERTY:") - 1;
+    std::string::size_type closePos = input.find(">", nameStartPos);
+    std::string::size_type commaPos = input.find(",", nameStartPos);
+    std::string::size_type nextOpenPos = input.find("$<", nameStartPos);
+    if (commaPos == input.npos // Implied 'this' target
+        || closePos == input.npos // Imcomplete expression.
+        || closePos < commaPos // Implied 'this' target
+        || nextOpenPos < commaPos) // Non-literal
+      {
+      lastPos = nameStartPos;
+      continue;
+      }
+
+    const std::string targetName = input.substr(nameStartPos,
+                                                commaPos - nameStartPos);
+
+    pos = nameStartPos; // We're not going to replace the entire expression,
+                        // but only the target parameter.
+    if (cmTarget *tgt = mf->FindTargetToUse(targetName.c_str()))
+      {
+      if(tgt->IsImported())
+        {
+        pos += targetName.size();
+        }
+      else if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end())
+        {
+        input.replace(pos, targetName.size(),
+                      this->Namespace + targetName);
+        pos += this->Namespace.size() + targetName.size();
+        }
+      else
+        {
+        std::string namespacedTarget;
+        this->HandleMissingTarget(namespacedTarget, missingTargets,
+                                  mf, target, tgt);
+        if (!namespacedTarget.empty())
+          {
+          input.replace(pos, targetName.size(), namespacedTarget);
+          pos += namespacedTarget.size();
+          }
+        }
+      }
+    else
+      {
+      errorString = "$<TARGET_PROPERTY:" + targetName + ",prop> requires "
+                    "its first parameter to be a reachable target.";
+      }
+    lastPos = pos;
+    if (!errorString.empty())
+      {
+      break;
+      }
+    }
+  if (!errorString.empty())
+    {
+    mf->IssueMessage(cmake::FATAL_ERROR, errorString);
+    return;
+    }
+
+  pos = 0;
+  lastPos = pos;
+  while((pos = input.find("$<TARGET_NAME:", lastPos)) != input.npos)
+    {
+    std::string::size_type nameStartPos = pos + sizeof("$<TARGET_NAME:") - 1;
+    std::string::size_type endPos = input.find(">", nameStartPos);
+    if (endPos == input.npos)
+      {
+      errorString = "$<TARGET_NAME:...> expression incomplete";
+      }
+    const std::string targetName = input.substr(nameStartPos,
+                                                endPos - nameStartPos);
+    if(targetName.find("$<", lastPos) != input.npos)
+      {
+      errorString = "$<TARGET_NAME:...> requires its parameter to be a "
+                    "literal.";
+      }
+    if (cmTarget *tgt = mf->FindTargetToUse(targetName.c_str()))
+      {
+      if(tgt->IsImported())
+        {
+        input.replace(pos, sizeof("$<TARGET_NAME:") + targetName.size(),
+                      targetName);
+        pos += sizeof("$<TARGET_NAME:") + targetName.size();
+        }
+      else if(this->ExportedTargets.find(tgt) != this->ExportedTargets.end())
+        {
+        input.replace(pos, sizeof("$<TARGET_NAME:") + targetName.size(),
+                      this->Namespace + targetName);
+        pos += sizeof("$<TARGET_NAME:") + targetName.size();
+        }
+      else
+        {
+        std::string namespacedTarget;
+        this->HandleMissingTarget(namespacedTarget, missingTargets,
+                                  mf, target, tgt);
+        if (!namespacedTarget.empty())
+          {
+          input.replace(pos, sizeof("$<TARGET_NAME:") + targetName.size(),
+                        namespacedTarget);
+          pos += sizeof("$<TARGET_NAME:") + targetName.size();
+          }
+        }
+      }
+    else
+      {
+      errorString = "$<TARGET_NAME:...> requires its parameter to be a "
+                    "reachable target.";
+      }
+    lastPos = pos;
+    if (!errorString.empty())
+      {
+      break;
+      }
+    }
+  if (!errorString.empty())
+    {
+    mf->IssueMessage(cmake::FATAL_ERROR, errorString);
+    }
+}
+
 //----------------------------------------------------------------------------
 void
 cmExportFileGenerator
@@ -162,7 +357,8 @@ cmExportFileGenerator
     }
 
   // Add the transitive link dependencies for this configuration.
-  if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config))
+  if(cmTarget::LinkInterface const* iface = target->GetLinkInterface(config,
+                                                                     target))
     {
     this->SetImportLinkProperty(suffix, target,
                                 "IMPORTED_LINK_INTERFACE_LANGUAGES",
@@ -286,6 +482,37 @@ void cmExportFileGenerator::GenerateImportVersionCode(std::ostream& os)
      << "\n";
 }
 
+//----------------------------------------------------------------------------
+void cmExportFileGenerator::GenerateExpectedTargetsCode(std::ostream& os,
+                                            const std::string &expectedTargets)
+{
+  os << "SET(_targetsDefined)\n"
+        "SET(_targetsNotDefined)\n"
+        "SET(_expectedTargets)\n"
+        "FOREACH(_expectedTarget " << expectedTargets << ")\n"
+        "  LIST(APPEND _expectedTargets ${_expectedTarget})\n"
+        "  IF(NOT TARGET ${_expectedTarget})\n"
+        "    LIST(APPEND _targetsNotDefined ${_expectedTarget})\n"
+        "  ENDIF(NOT TARGET ${_expectedTarget})\n"
+        "  IF(TARGET ${_expectedTarget})\n"
+        "    LIST(APPEND _targetsDefined ${_expectedTarget})\n"
+        "  ENDIF(TARGET ${_expectedTarget})\n"
+        "ENDFOREACH(_expectedTarget)\n"
+        "IF(\"${_targetsDefined}\" STREQUAL \"${_expectedTargets}\")\n"
+        "  SET(CMAKE_IMPORT_FILE_VERSION)\n"
+        "  CMAKE_POLICY(POP)\n"
+        "  RETURN()\n"
+        "ENDIF(\"${_targetsDefined}\" STREQUAL \"${_expectedTargets}\")\n"
+        "IF(NOT \"${_targetsDefined}\" STREQUAL \"\")\n"
+        "  MESSAGE(FATAL_ERROR \"Some (but not all) targets in this export "
+        "set were already defined.\\nTargets Defined: ${_targetsDefined}\\n"
+        "Targets not yet defined: ${_targetsNotDefined}\\n\")\n"
+        "ENDIF(NOT \"${_targetsDefined}\" STREQUAL \"\")\n"
+        "UNSET(_targetsDefined)\n"
+        "UNSET(_targetsNotDefined)\n"
+        "UNSET(_expectedTargets)\n"
+        "\n\n";
+}
 //----------------------------------------------------------------------------
 void
 cmExportFileGenerator

+ 21 - 0
Source/cmExportFileGenerator.h

@@ -13,6 +13,7 @@
 #define cmExportFileGenerator_h
 
 #include "cmCommand.h"
+#include "cmGeneratorExpression.h"
 
 /** \class cmExportFileGenerator
  * \brief Generate a file exporting targets from a build or install tree.
@@ -63,6 +64,8 @@ protected:
   void GenerateMissingTargetsCheckCode(std::ostream& os,
                                const std::vector<std::string>& missingTargets);
 
+  void GenerateExpectedTargetsCode(std::ostream& os,
+                                          const std::string &expectedTargets);
 
   // Collect properties with detailed information about targets beyond
   // their location on disk.
@@ -91,6 +94,17 @@ protected:
                                    cmMakefile* mf,
                                    cmTarget* depender,
                                    cmTarget* dependee) = 0;
+  void PopulateInterfaceProperty(const char *,
+                                 cmTarget *target,
+                                 cmGeneratorExpression::PreprocessContext,
+                                 ImportPropertyMap &properties,
+                                 std::vector<std::string> &missingTargets);
+  void GenerateInterfaceProperties(cmTarget *target, std::ostream& os,
+                                   const ImportPropertyMap &properties);
+
+  void ResolveTargetsInGeneratorExpressions(std::string &input,
+                                    cmTarget* target,
+                                    std::vector<std::string> &missingTargets);
 
   // The namespace in which the exports are placed in the generated file.
   std::string Namespace;
@@ -107,6 +121,13 @@ protected:
 
   // The set of targets included in the export.
   std::set<cmTarget*> ExportedTargets;
+
+private:
+  void PopulateInterfaceProperty(const char *, const char *,
+                                 cmTarget *target,
+                                 cmGeneratorExpression::PreprocessContext,
+                                 ImportPropertyMap &properties,
+                                 std::vector<std::string> &missingTargets);
 };
 
 #endif

+ 36 - 2
Source/cmExportInstallFileGenerator.cxx

@@ -39,15 +39,20 @@ std::string cmExportInstallFileGenerator::GetConfigImportFileGlob()
 //----------------------------------------------------------------------------
 bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
 {
-  // Create all the imported targets.
+  std::vector<cmTarget*> allTargets;
+  {
+  std::string expectedTargets;
+  std::string sep;
   for(std::vector<cmTargetExport*>::const_iterator
         tei = this->IEGen->GetExportSet()->GetTargetExports()->begin();
       tei != this->IEGen->GetExportSet()->GetTargetExports()->end(); ++tei)
     {
+    expectedTargets += sep + this->Namespace + (*tei)->Target->GetName();
+    sep = " ";
     cmTargetExport const* te = *tei;
     if(this->ExportedTargets.insert(te->Target).second)
       {
-      this->GenerateImportTargetCode(os, te->Target);
+      allTargets.push_back(te->Target);
       }
     else
       {
@@ -61,6 +66,35 @@ bool cmExportInstallFileGenerator::GenerateMainFile(std::ostream& os)
       }
     }
 
+  this->GenerateExpectedTargetsCode(os, expectedTargets);
+  }
+
+  std::vector<std::string> missingTargets;
+
+  // Create all the imported targets.
+  for(std::vector<cmTarget*>::const_iterator
+        tei = allTargets.begin();
+      tei != allTargets.end(); ++tei)
+    {
+    cmTarget* te = *tei;
+    this->GenerateImportTargetCode(os, te);
+
+    ImportPropertyMap properties;
+
+    this->PopulateInterfaceProperty("INTERFACE_INCLUDE_DIRECTORIES",
+                                  te,
+                                  cmGeneratorExpression::InstallInterface,
+                                  properties, missingTargets);
+    this->PopulateInterfaceProperty("INTERFACE_COMPILE_DEFINITIONS",
+                                  te,
+                                  cmGeneratorExpression::InstallInterface,
+                                  properties, missingTargets);
+
+    this->GenerateInterfaceProperties(te, os, properties);
+    }
+
+  this->GenerateMissingTargetsCheckCode(os, missingTargets);
+
   // Now load per-configuration properties for them.
   os << "# Load information for each installed configuration.\n"
      << "GET_FILENAME_COMPONENT(_DIR \"${CMAKE_CURRENT_LIST_FILE}\" PATH)\n"

+ 5 - 0
Source/cmExtraCodeBlocksGenerator.cxx

@@ -811,6 +811,11 @@ std::string cmExtraCodeBlocksGenerator::BuildMakeCommand(
     command += " VERBOSE=1 ";
     command += target;
     }
+  else if (strcmp(this->GlobalGenerator->GetName(), "Ninja")==0)
+    {
+    command += " -v ";
+    command += target;
+    }
   else
     {
     std::string makefileName = cmSystemTools::ConvertToOutputPath(makefile);

+ 57 - 0
Source/cmFileCommand.cxx

@@ -17,6 +17,8 @@
 #include "cmFileTimeComparison.h"
 #include "cmCryptoHash.h"
 
+#include "cmTimestamp.h"
+
 #if defined(CMAKE_BUILD_WITH_CMAKE)
 #include "cm_curl.h"
 #endif
@@ -161,6 +163,10 @@ bool cmFileCommand
     {
     return this->HandleCMakePathCommand(args, true);
     }
+  else if ( subCommand == "TIMESTAMP" )
+    {
+    return this->HandleTimestampCommand(args);
+    }
 
   std::string e = "does not recognize sub-command "+subCommand;
   this->SetError(e.c_str());
@@ -3241,3 +3247,54 @@ cmFileCommand::HandleUploadCommand(std::vector<std::string> const& args)
   return false;
 #endif
 }
+
+//----------------------------------------------------------------------------
+bool cmFileCommand::HandleTimestampCommand(
+  std::vector<std::string> const& args)
+{
+  if(args.size() < 3)
+    {
+    this->SetError("sub-command TIMESTAMP requires at least two arguments.");
+    return false;
+    }
+  else if(args.size() > 5)
+    {
+    this->SetError("sub-command TIMESTAMP takes at most four arguments.");
+    return false;
+    }
+
+  unsigned int argsIndex = 1;
+
+  const std::string& filename = args[argsIndex++];
+
+  const std::string& outputVariable = args[argsIndex++];
+
+  std::string formatString;
+  if(args.size() > argsIndex && args[argsIndex] != "UTC")
+    {
+    formatString = args[argsIndex++];
+    }
+
+  bool utcFlag = false;
+  if(args.size() > argsIndex)
+    {
+    if(args[argsIndex] == "UTC")
+      {
+      utcFlag = true;
+      }
+    else
+      {
+      std::string e = " TIMESTAMP sub-command does not recognize option " +
+          args[argsIndex] + ".";
+      this->SetError(e.c_str());
+      return false;
+      }
+    }
+
+  cmTimestamp timestamp;
+  std::string result = timestamp.FileModificationTime(
+    filename.c_str(), formatString, utcFlag);
+  this->Makefile->AddDefinition(outputVariable.c_str(), result.c_str());
+
+  return true;
+}

+ 9 - 0
Source/cmFileCommand.h

@@ -87,6 +87,7 @@ public:
       "       [TLS_VERIFY on|off] [TLS_CAINFO file])\n"
       "  file(UPLOAD filename url [INACTIVITY_TIMEOUT timeout]\n"
       "       [TIMEOUT timeout] [STATUS status] [LOG log] [SHOW_PROGRESS])\n"
+      "  file(TIMESTAMP filename variable [<format string>] [UTC])\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. (If the file is a build input, use "
@@ -200,6 +201,12 @@ public:
       "If SHOW_PROGRESS is specified, progress information will be printed "
       "as status messages until the operation is complete."
       "\n"
+      "TIMESTAMP will write a string representation of "
+      "the modification time of filename to variable.\n"
+      "Should the command be unable to obtain a timestamp "
+      "variable will be set to the empty string \"\".\n"
+      "See documentation of the string TIMESTAMP sub-command for more details."
+      "\n"
       "The file() command also provides COPY and INSTALL signatures:\n"
       "  file(<COPY|INSTALL> files... DESTINATION <dir>\n"
       "       [FILE_PERMISSIONS permissions...]\n"
@@ -260,6 +267,8 @@ protected:
   bool HandleInstallCommand(std::vector<std::string> const& args);
   bool HandleDownloadCommand(std::vector<std::string> const& args);
   bool HandleUploadCommand(std::vector<std::string> const& args);
+
+  bool HandleTimestampCommand(std::vector<std::string> const& args);
 };
 
 

+ 2 - 2
Source/cmFindBase.cxx

@@ -360,13 +360,13 @@ void cmFindBase::AddPrefixPaths(std::vector<std::string> const& in_paths,
       {
       dir += "/";
       }
-    if(subdir == "lib")
+    if(subdir == "include" || subdir == "lib")
       {
       const char* arch =
         this->Makefile->GetDefinition("CMAKE_LIBRARY_ARCHITECTURE");
       if(arch && *arch)
         {
-        this->AddPathInternal(dir+"lib/"+arch, pathType);
+        this->AddPathInternal(dir+subdir+"/"+arch, pathType);
         }
       }
     std::string add = dir + subdir;

+ 4 - 2
Source/cmFindPathCommand.cxx

@@ -45,8 +45,10 @@ void cmFindPathCommand::GenerateDocumentation()
                                "SEARCH_XXX", "file in a directory");
   cmSystemTools::ReplaceString(this->GenericDocumentation,
                                "XXX_SUBDIR", "include");
-  cmSystemTools::ReplaceString(this->GenericDocumentation,
-                               "XXX_EXTRA_PREFIX_ENTRY", "");
+  cmSystemTools::ReplaceString(
+    this->GenericDocumentation,
+    "XXX_EXTRA_PREFIX_ENTRY",
+    "   <prefix>/include/<arch> if CMAKE_LIBRARY_ARCHITECTURE is set, and\n");
   cmSystemTools::ReplaceString(this->GenericDocumentation,
                                "CMAKE_FIND_ROOT_PATH_MODE_XXX",
                                "CMAKE_FIND_ROOT_PATH_MODE_INCLUDE");

+ 126 - 38
Source/cmGeneratorExpression.cxx

@@ -25,55 +25,55 @@
 //----------------------------------------------------------------------------
 cmGeneratorExpression::cmGeneratorExpression(
   cmListFileBacktrace const& backtrace):
-  Backtrace(backtrace), CompiledExpression(0)
+  Backtrace(backtrace)
 {
 }
 
 //----------------------------------------------------------------------------
-const cmCompiledGeneratorExpression &
+cmsys::auto_ptr<cmCompiledGeneratorExpression>
 cmGeneratorExpression::Parse(std::string const& input)
 {
   return this->Parse(input.c_str());
 }
 
 //----------------------------------------------------------------------------
-const cmCompiledGeneratorExpression &
+cmsys::auto_ptr<cmCompiledGeneratorExpression>
 cmGeneratorExpression::Parse(const char* input)
 {
-  cmGeneratorExpressionLexer l;
-  std::vector<cmGeneratorExpressionToken> tokens = l.Tokenize(input);
-  bool needsParsing = l.GetSawGeneratorExpression();
-  std::vector<cmGeneratorExpressionEvaluator*> evaluators;
-
-  if (needsParsing)
-    {
-    cmGeneratorExpressionParser p(tokens);
-    p.Parse(evaluators);
-    }
-
-  delete this->CompiledExpression;
-  this->CompiledExpression = new cmCompiledGeneratorExpression(
-                                      this->Backtrace,
-                                      evaluators,
-                                      input,
-                                      needsParsing);
-  return *this->CompiledExpression;
+  return cmsys::auto_ptr<cmCompiledGeneratorExpression>(
+                                      new cmCompiledGeneratorExpression(
+                                        this->Backtrace,
+                                        input));
 }
 
 cmGeneratorExpression::~cmGeneratorExpression()
 {
-  delete this->CompiledExpression;
 }
 
 //----------------------------------------------------------------------------
 const char *cmCompiledGeneratorExpression::Evaluate(
   cmMakefile* mf, const char* config, bool quiet,
-  cmGeneratorTarget *target,
+  cmTarget *headTarget,
+  cmGeneratorExpressionDAGChecker *dagChecker) const
+{
+  return this->Evaluate(mf,
+                        config,
+                        quiet,
+                        headTarget,
+                        headTarget,
+                        dagChecker);
+}
+
+//----------------------------------------------------------------------------
+const char *cmCompiledGeneratorExpression::Evaluate(
+  cmMakefile* mf, const char* config, bool quiet,
+  cmTarget *headTarget,
+  cmTarget *currentTarget,
   cmGeneratorExpressionDAGChecker *dagChecker) const
 {
   if (!this->NeedsParsing)
     {
-    return this->Input;
+    return this->Input.c_str();
     }
 
   this->Output = "";
@@ -88,12 +88,21 @@ const char *cmCompiledGeneratorExpression::Evaluate(
   context.Config = config;
   context.Quiet = quiet;
   context.HadError = false;
-  context.Target = target;
+  context.HeadTarget = headTarget;
+  context.CurrentTarget = currentTarget ? currentTarget : headTarget;
   context.Backtrace = this->Backtrace;
 
   for ( ; it != end; ++it)
     {
-    this->Output += (*it)->Evaluate(&context, dagChecker);
+    const std::string result = (*it)->Evaluate(&context, dagChecker);
+    this->Output += result;
+
+    for(std::set<cmStdString>::const_iterator
+          p = context.SeenTargetProperties.begin();
+          p != context.SeenTargetProperties.end(); ++p)
+      {
+      this->SeenTargetProperties[*p] += result + ";";
+      }
     if (context.HadError)
       {
       this->Output = "";
@@ -108,12 +117,19 @@ const char *cmCompiledGeneratorExpression::Evaluate(
 
 cmCompiledGeneratorExpression::cmCompiledGeneratorExpression(
               cmListFileBacktrace const& backtrace,
-              const std::vector<cmGeneratorExpressionEvaluator*> &evaluators,
-              const char *input, bool needsParsing)
-  : Backtrace(backtrace), Evaluators(evaluators), Input(input),
-    NeedsParsing(needsParsing)
+              const char *input)
+  : Backtrace(backtrace), Input(input ? input : "")
 {
+  cmGeneratorExpressionLexer l;
+  std::vector<cmGeneratorExpressionToken> tokens =
+                                              l.Tokenize(this->Input.c_str());
+  this->NeedsParsing = l.GetSawGeneratorExpression();
 
+  if (this->NeedsParsing)
+    {
+    cmGeneratorExpressionParser p(tokens);
+    p.Parse(this->Evaluators);
+    }
 }
 
 
@@ -131,15 +147,9 @@ cmCompiledGeneratorExpression::~cmCompiledGeneratorExpression()
     }
 }
 
-std::string cmGeneratorExpression::Preprocess(const std::string &input,
-                                              PreprocessContext context)
+//----------------------------------------------------------------------------
+static std::string stripAllGeneratorExpressions(const std::string &input)
 {
-  if (context != StripAllGeneratorExpressions)
-  {
-    assert(!"cmGeneratorExpression::Preprocess called with invalid args");
-    return std::string();
-  }
-
   std::string result;
   std::string::size_type pos = 0;
   std::string::size_type lastPos = pos;
@@ -178,3 +188,81 @@ std::string cmGeneratorExpression::Preprocess(const std::string &input,
   result += input.substr(lastPos);
   return result;
 }
+
+//----------------------------------------------------------------------------
+static std::string stripExportInterface(const std::string &input,
+                          cmGeneratorExpression::PreprocessContext context)
+{
+  std::string result;
+
+  std::string::size_type pos = 0;
+  std::string::size_type lastPos = pos;
+  while((pos = input.find("$<BUILD_INTERFACE:", lastPos)) != input.npos
+    || (pos = input.find("$<INSTALL_INTERFACE:", lastPos)) != input.npos)
+    {
+    result += input.substr(lastPos, pos - lastPos);
+    const bool gotInstallInterface = input[pos + 2] == 'I';
+    pos += gotInstallInterface ? sizeof("$<INSTALL_INTERFACE:") - 1
+                               : sizeof("$<BUILD_INTERFACE:") - 1;
+    int nestingLevel = 1;
+    const char *c = input.c_str() + pos;
+    const char * const cStart = c;
+    for ( ; *c; ++c)
+      {
+      if(c[0] == '$' && c[1] == '<')
+        {
+        ++nestingLevel;
+        ++c;
+        continue;
+        }
+      if(c[0] == '>')
+        {
+        --nestingLevel;
+        if (nestingLevel != 0)
+          {
+          continue;
+          }
+        if(context == cmGeneratorExpression::BuildInterface
+            && !gotInstallInterface)
+          {
+          result += input.substr(pos, c - cStart);
+          }
+        else if(context == cmGeneratorExpression::InstallInterface
+            && gotInstallInterface)
+          {
+          result += input.substr(pos, c - cStart);
+          }
+        break;
+        }
+      }
+    const std::string::size_type traversed = (c - cStart) + 1;
+    if (!*c)
+      {
+      result += std::string(gotInstallInterface ? "$<INSTALL_INTERFACE:"
+                                                : "$<BUILD_INTERFACE:")
+             + input.substr(pos, traversed);
+      }
+    pos += traversed;
+    lastPos = pos;
+    }
+  result += input.substr(lastPos);
+
+  return result;
+}
+
+//----------------------------------------------------------------------------
+std::string cmGeneratorExpression::Preprocess(const std::string &input,
+                                              PreprocessContext context)
+{
+  if (context == StripAllGeneratorExpressions)
+    {
+    return stripAllGeneratorExpressions(input);
+    }
+  else if (context == BuildInterface || context == InstallInterface)
+    {
+    return stripExportInterface(input, context);
+    }
+
+  assert(!"cmGeneratorExpression::Preprocess called with invalid args");
+  return std::string();
+}

+ 33 - 12
Source/cmGeneratorExpression.h

@@ -14,13 +14,14 @@
 #define cmGeneratorExpression_h
 
 #include "cmStandardIncludes.h"
+#include "cmListFileCache.h"
 
 #include <stack>
 
 #include <cmsys/RegularExpression.hxx>
+#include <cmsys/auto_ptr.hxx>
 
 class cmTarget;
-class cmGeneratorTarget;
 class cmMakefile;
 class cmListFileBacktrace;
 
@@ -45,11 +46,14 @@ public:
   cmGeneratorExpression(cmListFileBacktrace const& backtrace);
   ~cmGeneratorExpression();
 
-  const cmCompiledGeneratorExpression& Parse(std::string const& input);
-  const cmCompiledGeneratorExpression& Parse(const char* input);
+  cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(
+                                                std::string const& input);
+  cmsys::auto_ptr<cmCompiledGeneratorExpression> Parse(const char* input);
 
   enum PreprocessContext {
-    StripAllGeneratorExpressions
+    StripAllGeneratorExpressions,
+    BuildInterface,
+    InstallInterface
   };
 
   static std::string Preprocess(const std::string &input,
@@ -60,7 +64,6 @@ private:
   void operator=(const cmGeneratorExpression &);
 
   cmListFileBacktrace const& Backtrace;
-  cmCompiledGeneratorExpression *CompiledExpression;
 };
 
 class cmCompiledGeneratorExpression
@@ -68,31 +71,49 @@ class cmCompiledGeneratorExpression
 public:
   const char* Evaluate(cmMakefile* mf, const char* config,
                        bool quiet = false,
-                       cmGeneratorTarget *target = 0,
+                       cmTarget *headTarget = 0,
+                       cmTarget *currentTarget = 0,
                        cmGeneratorExpressionDAGChecker *dagChecker = 0) const;
+  const char* Evaluate(cmMakefile* mf, const char* config,
+                       bool quiet,
+                       cmTarget *headTarget,
+                       cmGeneratorExpressionDAGChecker *dagChecker) const;
 
   /** Get set of targets found during evaluations.  */
   std::set<cmTarget*> const& GetTargets() const
     { return this->Targets; }
 
+  std::map<cmStdString, cmStdString> const& GetSeenTargetProperties() const
+    { return this->SeenTargetProperties; }
+
   ~cmCompiledGeneratorExpression();
 
+  std::string GetInput() const
+  {
+    return this->Input;
+  }
+
+  cmListFileBacktrace GetBacktrace() const
+  {
+    return this->Backtrace;
+  }
+
 private:
   cmCompiledGeneratorExpression(cmListFileBacktrace const& backtrace,
-              const std::vector<cmGeneratorExpressionEvaluator*> &evaluators,
-              const char *input, bool needsParsing);
+              const char *input);
 
   friend class cmGeneratorExpression;
 
   cmCompiledGeneratorExpression(const cmCompiledGeneratorExpression &);
   void operator=(const cmCompiledGeneratorExpression &);
 
-  cmListFileBacktrace const& Backtrace;
-  const std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
-  const char* const Input;
-  const bool NeedsParsing;
+  cmListFileBacktrace Backtrace;
+  std::vector<cmGeneratorExpressionEvaluator*> Evaluators;
+  const std::string Input;
+  bool NeedsParsing;
 
   mutable std::set<cmTarget*> Targets;
+  mutable std::map<cmStdString, cmStdString> SeenTargetProperties;
   mutable std::string Output;
 };
 

+ 10 - 8
Source/cmGeneratorExpressionDAGChecker.cxx

@@ -24,13 +24,14 @@ cmGeneratorExpressionDAGChecker::cmGeneratorExpressionDAGChecker(
   : Parent(parent), Target(target), Property(property),
     Content(content), Backtrace(backtrace)
 {
-  this->IsDAG = this->isDAG();
+  this->CheckResult = this->checkGraph();
 }
 
 //----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::check() const
+cmGeneratorExpressionDAGChecker::Result
+cmGeneratorExpressionDAGChecker::check() const
 {
-  return this->IsDAG;
+  return this->CheckResult;
 }
 
 //----------------------------------------------------------------------------
@@ -38,7 +39,7 @@ void cmGeneratorExpressionDAGChecker::reportError(
                   cmGeneratorExpressionContext *context,
                   const std::string &expr)
 {
-  if (this->IsDAG)
+  if (this->CheckResult == DAG)
     {
     return;
     }
@@ -57,7 +58,7 @@ void cmGeneratorExpressionDAGChecker::reportError(
     e << "Error evaluating generator expression:\n"
       << "  " << expr << "\n"
       << "Self reference on target \""
-      << context->Target->GetName() << "\".\n";
+      << context->HeadTarget->GetName() << "\".\n";
     context->Makefile->GetCMakeInstance()
       ->IssueMessage(cmake::FATAL_ERROR, e.str().c_str(),
                       parent->Backtrace);
@@ -91,16 +92,17 @@ void cmGeneratorExpressionDAGChecker::reportError(
 }
 
 //----------------------------------------------------------------------------
-bool cmGeneratorExpressionDAGChecker::isDAG() const
+cmGeneratorExpressionDAGChecker::Result
+cmGeneratorExpressionDAGChecker::checkGraph() const
 {
   const cmGeneratorExpressionDAGChecker *parent = this->Parent;
   while (parent)
     {
     if (this->Target == parent->Target && this->Property == parent->Property)
       {
-      return false;
+      return parent->Parent ? CYCLIC_REFERENCE : SELF_REFERENCE;
       }
     parent = parent->Parent;
     }
-  return true;
+  return DAG;
 }

+ 9 - 3
Source/cmGeneratorExpressionDAGChecker.h

@@ -25,12 +25,18 @@ struct cmGeneratorExpressionDAGChecker
                                   const GeneratorExpressionContent *content,
                                   cmGeneratorExpressionDAGChecker *parent);
 
-  bool check() const;
+  enum Result {
+    DAG,
+    SELF_REFERENCE,
+    CYCLIC_REFERENCE
+  };
+
+  Result check() const;
 
   void reportError(cmGeneratorExpressionContext *context,
                    const std::string &expr);
 private:
-  bool isDAG() const;
+  Result checkGraph() const;
 
 private:
   const cmGeneratorExpressionDAGChecker * const Parent;
@@ -38,7 +44,7 @@ private:
   const std::string Property;
   const GeneratorExpressionContent * const Content;
   const cmListFileBacktrace Backtrace;
-  bool IsDAG;
+  Result CheckResult;
 };
 
 #endif

+ 168 - 13
Source/cmGeneratorExpressionEvaluator.cxx

@@ -18,6 +18,8 @@
 
 #include <cmsys/String.h>
 
+#include <assert.h>
+
 //----------------------------------------------------------------------------
 #if !defined(__SUNPRO_CC) || __SUNPRO_CC > 0x510
 static
@@ -47,6 +49,8 @@ struct cmGeneratorExpressionNode
 
   virtual bool GeneratesContent() const { return true; }
 
+  virtual bool RequiresLiteralInput() const { return false; }
+
   virtual bool AcceptsSingleArbitraryContentParameter() const
     { return false; }
 
@@ -66,6 +70,8 @@ static const struct ZeroNode : public cmGeneratorExpressionNode
 
   virtual bool GeneratesContent() const { return false; }
 
+  virtual bool AcceptsSingleArbitraryContentParameter() const { return true; }
+
   std::string Evaluate(const std::vector<std::string> &,
                        cmGeneratorExpressionContext *,
                        const GeneratorExpressionContent *,
@@ -93,6 +99,12 @@ static const struct OneNode : public cmGeneratorExpressionNode
   }
 } oneNode;
 
+//----------------------------------------------------------------------------
+static const struct OneNode buildInterfaceNode;
+
+//----------------------------------------------------------------------------
+static const struct ZeroNode installInterfaceNode;
+
 //----------------------------------------------------------------------------
 #define BOOLEAN_OP_NODE(OPNAME, OP, SUCCESS_VALUE, FAILURE_VALUE) \
 static const struct OP ## Node : public cmGeneratorExpressionNode \
@@ -255,11 +267,34 @@ static const struct ConfigurationTestNode : public cmGeneratorExpressionNode
       return parameters.front().empty() ? "1" : "0";
       }
 
-    return cmsysString_strcasecmp(parameters.begin()->c_str(),
-                                  context->Config) == 0 ? "1" : "0";
+    if (cmsysString_strcasecmp(parameters.begin()->c_str(),
+                                  context->Config) == 0)
+      {
+      return "1";
+      }
+
+    if (context->CurrentTarget
+        && context->CurrentTarget->IsImported())
+      {
+      const char* loc = 0;
+      const char* imp = 0;
+      std::string suffix;
+      return context->CurrentTarget->GetMappedConfig(context->Config,
+                                                  &loc,
+                                                  &imp,
+                                                  suffix) ? "1" : "0";
+      }
+    return "0";
   }
 } configurationTestNode;
 
+
+//----------------------------------------------------------------------------
+static const char* targetPropertyTransitiveWhitelist[] = {
+    "INTERFACE_INCLUDE_DIRECTORIES"
+  , "INTERFACE_COMPILE_DEFINITIONS"
+};
+
 //----------------------------------------------------------------------------
 static const struct TargetPropertyNode : public cmGeneratorExpressionNode
 {
@@ -287,8 +322,19 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
     cmsys::RegularExpression propertyNameValidator;
     propertyNameValidator.compile("^[A-Za-z0-9_]+$");
 
-    cmGeneratorTarget* target = context->Target;
+    cmTarget* target = context->HeadTarget;
     std::string propertyName = *parameters.begin();
+
+    if (!target && parameters.size() == 1)
+      {
+      reportError(context, content->GetOriginalExpression(),
+          "$<TARGET_PROPERTY:prop> may only be used with targets.  It may not "
+          "be used with add_custom_command.  Specify the target to read a "
+          "property from using the $<TARGET_PROPERTY:tgt,prop> signature "
+          "instead.");
+      return std::string();
+      }
+
     if (parameters.size() == 2)
       {
       if (parameters.begin()->empty() && parameters[1].empty())
@@ -320,7 +366,7 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
                       "Target name not supported.");
         return std::string();
         }
-      target = context->Makefile->FindGeneratorTargetToUse(
+      target = context->Makefile->FindTargetToUse(
                                                 targetName.c_str());
 
       if (!target)
@@ -334,6 +380,14 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
         }
       }
 
+    if (target == context->HeadTarget)
+      {
+      // Keep track of the properties seen while processing.
+      // The evaluation of the LINK_LIBRARIES generator expressions
+      // will check this to ensure that properties form a DAG.
+      context->SeenTargetProperties.insert(propertyName);
+      }
+
     if (propertyName.empty())
       {
       reportError(context, content->GetOriginalExpression(),
@@ -349,23 +403,74 @@ static const struct TargetPropertyNode : public cmGeneratorExpressionNode
       return std::string();
       }
 
+    assert(target);
+
     cmGeneratorExpressionDAGChecker dagChecker(context->Backtrace,
                                                target->GetName(),
                                                propertyName,
                                                content,
                                                dagCheckerParent);
 
-    if (!dagChecker.check())
+    switch (dagChecker.check())
       {
+    case cmGeneratorExpressionDAGChecker::SELF_REFERENCE:
       dagChecker.reportError(context, content->GetOriginalExpression());
       return std::string();
+    case cmGeneratorExpressionDAGChecker::CYCLIC_REFERENCE:
+      // No error. We just skip cyclic references.
+      return std::string();
+    case cmGeneratorExpressionDAGChecker::DAG:
+      break;
       }
 
     const char *prop = target->GetProperty(propertyName.c_str());
-    return prop ? prop : "";
+    if (!prop)
+      {
+      return std::string();
+      }
+
+    for (size_t i = 0;
+         i < (sizeof(targetPropertyTransitiveWhitelist) /
+              sizeof(*targetPropertyTransitiveWhitelist));
+         ++i)
+      {
+      if (targetPropertyTransitiveWhitelist[i] == propertyName)
+        {
+        cmGeneratorExpression ge(context->Backtrace);
+        return ge.Parse(prop)->Evaluate(context->Makefile,
+                            context->Config,
+                            context->Quiet,
+                            context->HeadTarget,
+                            target,
+                            &dagChecker);
+        }
+      }
+    return prop;
   }
 } targetPropertyNode;
 
+//----------------------------------------------------------------------------
+static const struct TargetNameNode : public cmGeneratorExpressionNode
+{
+  TargetNameNode() {}
+
+  virtual bool GeneratesContent() const { return true; }
+
+  virtual bool AcceptsSingleArbitraryContentParameter() const { return true; }
+  virtual bool RequiresLiteralInput() const { return true; }
+
+  std::string Evaluate(const std::vector<std::string> &parameters,
+                       cmGeneratorExpressionContext *,
+                       const GeneratorExpressionContent *,
+                       cmGeneratorExpressionDAGChecker *) const
+  {
+    return parameters.front();
+  }
+
+  virtual int NumExpectedParameters() const { return 1; }
+
+} targetNameNode;
+
 //----------------------------------------------------------------------------
 template<bool linker, bool soname>
 struct TargetFilesystemArtifactResultCreator
@@ -551,13 +656,13 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
 {
   if (identifier == "0")
     return &zeroNode;
-  if (identifier == "1")
+  else if (identifier == "1")
     return &oneNode;
-  if (identifier == "AND")
+  else if (identifier == "AND")
     return &andNode;
-  if (identifier == "OR")
+  else if (identifier == "OR")
     return &orNode;
-  if (identifier == "NOT")
+  else if (identifier == "NOT")
     return &notNode;
   else if (identifier == "CONFIGURATION")
     return &configurationNode;
@@ -591,6 +696,12 @@ cmGeneratorExpressionNode* GetNode(const std::string &identifier)
     return &commaNode;
   else if (identifier == "TARGET_PROPERTY")
     return &targetPropertyNode;
+  else if (identifier == "TARGET_NAME")
+    return &targetNameNode;
+  else if (identifier == "BUILD_INTERFACE")
+    return &buildInterfaceNode;
+  else if (identifier == "INSTALL_INTERFACE")
+    return &installInterfaceNode;
   return 0;
 
 }
@@ -642,6 +753,20 @@ std::string GeneratorExpressionContent::Evaluate(
 
   if (!node->GeneratesContent())
     {
+    if (node->AcceptsSingleArbitraryContentParameter())
+      {
+      if (this->ParamChildren.empty())
+        {
+        reportError(context, this->GetOriginalExpression(),
+                  "$<" + identifier + "> expression requires a parameter.");
+        }
+      }
+    else
+      {
+      std::vector<std::string> parameters;
+      this->EvaluateParameters(node, identifier, context, dagChecker,
+                               parameters);
+      }
     return std::string();
     }
 
@@ -666,6 +791,15 @@ std::string GeneratorExpressionContent::Evaluate(
                                                                 = pit->end();
       for ( ; it != end; ++it)
         {
+        if (node->RequiresLiteralInput())
+          {
+          if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text)
+            {
+            reportError(context, this->GetOriginalExpression(),
+                  "$<" + identifier + "> expression requires literal input.");
+            return std::string();
+            }
+          }
         result += (*it)->Evaluate(context, dagChecker);
         if (context->HadError)
           {
@@ -673,10 +807,33 @@ std::string GeneratorExpressionContent::Evaluate(
           }
         }
       }
+    if (node->RequiresLiteralInput())
+      {
+      std::vector<std::string> parameters;
+      parameters.push_back(result);
+      return node->Evaluate(parameters, context, this, dagChecker);
+      }
     return result;
     }
 
   std::vector<std::string> parameters;
+  this->EvaluateParameters(node, identifier, context, dagChecker, parameters);
+  if (context->HadError)
+    {
+    return std::string();
+    }
+
+  return node->Evaluate(parameters, context, this, dagChecker);
+}
+
+//----------------------------------------------------------------------------
+std::string GeneratorExpressionContent::EvaluateParameters(
+                                const cmGeneratorExpressionNode *node,
+                                const std::string &identifier,
+                                cmGeneratorExpressionContext *context,
+                                cmGeneratorExpressionDAGChecker *dagChecker,
+                                std::vector<std::string> &parameters) const
+{
   {
   std::vector<std::vector<cmGeneratorExpressionEvaluator*> >::const_iterator
                                         pit = this->ParamChildren.begin();
@@ -732,10 +889,8 @@ std::string GeneratorExpressionContent::Evaluate(
     {
     reportError(context, this->GetOriginalExpression(), "$<" + identifier
                       + "> expression requires at least one parameter.");
-    return std::string();
     }
-
-  return node->Evaluate(parameters, context, this, dagChecker);
+  return std::string();
 }
 
 //----------------------------------------------------------------------------

+ 12 - 2
Source/cmGeneratorExpressionEvaluator.h

@@ -18,21 +18,24 @@
 #include "cmListFileCache.h"
 
 class cmTarget;
-class cmGeneratorTarget;
 
 //----------------------------------------------------------------------------
 struct cmGeneratorExpressionContext
 {
   cmListFileBacktrace Backtrace;
   std::set<cmTarget*> Targets;
+  std::set<cmStdString> SeenTargetProperties;
   cmMakefile *Makefile;
   const char *Config;
-  cmGeneratorTarget *Target;
+  cmTarget *HeadTarget; // The target whose property is being evaluated.
+  cmTarget *CurrentTarget; // The dependent of HeadTarget which appears
+                           // directly or indirectly in the property.
   bool Quiet;
   bool HadError;
 };
 
 struct cmGeneratorExpressionDAGChecker;
+struct cmGeneratorExpressionNode;
 
 //----------------------------------------------------------------------------
 struct cmGeneratorExpressionEvaluator
@@ -117,6 +120,13 @@ struct GeneratorExpressionContent : public cmGeneratorExpressionEvaluator
 
   ~GeneratorExpressionContent();
 
+private:
+  std::string EvaluateParameters(const cmGeneratorExpressionNode *node,
+                                 const std::string &identifier,
+                                 cmGeneratorExpressionContext *context,
+                                 cmGeneratorExpressionDAGChecker *dagChecker,
+                                 std::vector<std::string> &parameters) const;
+
 private:
   std::vector<cmGeneratorExpressionEvaluator*> IdentifierChildren;
   std::vector<std::vector<cmGeneratorExpressionEvaluator*> > ParamChildren;

+ 9 - 1
Source/cmGeneratorExpressionParser.cxx

@@ -88,7 +88,15 @@ void cmGeneratorExpressionParser::ParseGeneratorExpression(
   while(this->it->TokenType != cmGeneratorExpressionToken::EndExpression
       && this->it->TokenType != cmGeneratorExpressionToken::ColonSeparator)
     {
-    this->ParseContent(identifier);
+    if (this->it->TokenType == cmGeneratorExpressionToken::CommaSeparator)
+      {
+      extendText(identifier, this->it);
+      ++this->it;
+      }
+    else
+      {
+      this->ParseContent(identifier);
+      }
     if (this->it == this->Tokens.end())
       {
       break;

+ 3 - 79
Source/cmGeneratorTarget.cxx

@@ -14,14 +14,11 @@
 #include "cmTarget.h"
 #include "cmMakefile.h"
 #include "cmLocalGenerator.h"
-#include "cmComputeLinkInformation.h"
 #include "cmGlobalGenerator.h"
 #include "cmSourceFile.h"
 #include "cmGeneratorExpression.h"
 #include "cmGeneratorExpressionDAGChecker.h"
 
-#include <assert.h>
-
 //----------------------------------------------------------------------------
 cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
 {
@@ -32,15 +29,6 @@ cmGeneratorTarget::cmGeneratorTarget(cmTarget* t): Target(t)
   this->LookupObjectLibraries();
 }
 
-cmGeneratorTarget::~cmGeneratorTarget()
-{
-  for(std::map<cmStdString, cmComputeLinkInformation*>::iterator i
-                  = LinkInformation.begin(); i != LinkInformation.end(); ++i)
-    {
-    delete i->second;
-    }
-}
-
 //----------------------------------------------------------------------------
 int cmGeneratorTarget::GetType() const
 {
@@ -220,32 +208,6 @@ void cmGeneratorTarget::UseObjectLibraries(std::vector<std::string>& objs)
     }
 }
 
-//----------------------------------------------------------------------------
-cmComputeLinkInformation*
-cmGeneratorTarget::GetLinkInformation(const char* config)
-{
-  // Lookup any existing information for this configuration.
-  std::map<cmStdString, cmComputeLinkInformation*>::iterator
-    i = this->LinkInformation.find(config?config:"");
-  if(i == this->LinkInformation.end())
-    {
-    // Compute information for this configuration.
-    cmComputeLinkInformation* info =
-      new cmComputeLinkInformation(this->Target, config);
-    if(!info || !info->Compute())
-      {
-      delete info;
-      info = 0;
-      }
-
-    // Store the information for this configuration.
-    std::map<cmStdString, cmComputeLinkInformation*>::value_type
-      entry(config?config:"", info);
-    i = this->LinkInformation.insert(entry).first;
-    }
-  return i->second;
-}
-
 //----------------------------------------------------------------------------
 void cmGeneratorTarget::GetAppleArchs(const char* config,
                              std::vector<std::string>& archVec)
@@ -290,45 +252,7 @@ const char* cmGeneratorTarget::GetCreateRuleVariable()
 std::vector<std::string> cmGeneratorTarget::GetIncludeDirectories(
                                                           const char *config)
 {
-  std::vector<std::string> includes;
-  const char *prop = this->Target->GetProperty("INCLUDE_DIRECTORIES");
-  if(!prop)
-    {
-    return includes;
-    }
-
-  cmListFileBacktrace lfbt;
-  cmGeneratorExpression ge(lfbt);
-
-  cmGeneratorExpressionDAGChecker dagChecker(lfbt,
-                                              this->GetName(),
-                                              "INCLUDE_DIRECTORIES", 0, 0);
-
-  cmSystemTools::ExpandListArgument(ge.Parse(prop)
-                                    .Evaluate(this->Makefile,
-                                              config,
-                                              false,
-                                              this,
-                                              &dagChecker),
-                                    includes);
-
-  std::set<std::string> uniqueIncludes;
-  std::vector<std::string> orderedAndUniqueIncludes;
-  for(std::vector<std::string>::const_iterator
-      li = includes.begin(); li != includes.end(); ++li)
-    {
-    std::string inc = *li;
-    if (!cmSystemTools::IsOff(inc.c_str()))
-      {
-      cmSystemTools::ConvertToUnixSlashes(inc);
-      }
-    if(uniqueIncludes.insert(inc).second)
-      {
-      orderedAndUniqueIncludes.push_back(inc);
-      }
-    }
-
-  return orderedAndUniqueIncludes;
+  return this->Target->GetIncludeDirectories(config);
 }
 
 //----------------------------------------------------------------------------
@@ -353,9 +277,9 @@ std::string cmGeneratorTarget::GetCompileDefinitions(const char *config)
   cmGeneratorExpressionDAGChecker dagChecker(lfbt,
                                              this->GetName(),
                                              defPropName, 0, 0);
-  return ge.Parse(prop).Evaluate(this->Makefile,
+  return ge.Parse(prop)->Evaluate(this->Makefile,
                                  config,
                                  false,
-                                 this,
+                                 this->Target,
                                  &dagChecker);
 }

+ 0 - 6
Source/cmGeneratorTarget.h

@@ -14,7 +14,6 @@
 
 #include "cmStandardIncludes.h"
 
-class cmComputeLinkInformation;
 class cmCustomCommand;
 class cmGlobalGenerator;
 class cmLocalGenerator;
@@ -26,7 +25,6 @@ class cmGeneratorTarget
 {
 public:
   cmGeneratorTarget(cmTarget*);
-  ~cmGeneratorTarget();
 
   int GetType() const;
   const char *GetName() const;
@@ -60,10 +58,6 @@ public:
 
   void UseObjectLibraries(std::vector<std::string>& objs);
 
-  std::map<cmStdString, cmComputeLinkInformation*> LinkInformation;
-
-  cmComputeLinkInformation* GetLinkInformation(const char* config);
-
   void GetAppleArchs(const char* config,
                      std::vector<std::string>& archVec);
 

+ 18 - 1
Source/cmGlobalGenerator.cxx

@@ -938,6 +938,23 @@ void cmGlobalGenerator::Generate()
       (*targets)[tit->first] = tit->second;
       (*targets)[tit->first].SetMakefile(mf);
       }
+
+    for ( tit = targets->begin(); tit != targets->end(); ++ tit )
+      {
+      if (mf->IsOn("CMAKE_BUILD_INTERFACE_INCLUDES"))
+        {
+        const char *binDir = mf->GetStartOutputDirectory();
+        const char *srcDir = mf->GetStartDirectory();
+        const std::string dirs = std::string(binDir ? binDir : "")
+                                + std::string(binDir ? ";" : "")
+                                + std::string(srcDir ? srcDir : "");
+        if (!dirs.empty())
+          {
+          tit->second.AppendProperty("INTERFACE_INCLUDE_DIRECTORIES",
+                                ("$<BUILD_INTERFACE:" + dirs + ">").c_str());
+          }
+        }
+      }
     }
 
   // Add generator specific helper commands
@@ -2047,7 +2064,7 @@ bool cmGlobalGenerator::UseFolderProperty()
     }
 
   // By default, this feature is OFF, since it is not supported in the
-  // Visual Studio Express editions:
+  // Visual Studio Express editions until VS11:
   //
   return false;
 }

+ 1 - 2
Source/cmGlobalVisualStudio10Generator.cxx

@@ -144,8 +144,7 @@ void cmGlobalVisualStudio10Generator
 ::EnableLanguage(std::vector<std::string>const &  lang,
                  cmMakefile *mf, bool optional)
 {
-  if(!strcmp(this->ArchitectureId, "Itanium") ||
-     !strcmp(this->ArchitectureId, "x64"))
+  if(this->ArchitectureId == "Itanium" || this->ArchitectureId == "x64")
     {
     if(this->IsExpressEdition() && !this->Find64BitTools(mf))
       {

+ 9 - 0
Source/cmGlobalVisualStudio11Generator.cxx

@@ -93,3 +93,12 @@ cmLocalGenerator *cmGlobalVisualStudio11Generator::CreateLocalGenerator()
   lg->SetGlobalGenerator(this);
   return lg;
 }
+
+//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio11Generator::UseFolderProperty()
+{
+  // Intentionally skip over the parent class implementation and call the
+  // grand-parent class's implementation. Folders are not supported by the
+  // Express editions in VS10 and earlier, but they are in VS11 Express.
+  return cmGlobalVisualStudio8Generator::UseFolderProperty();
+}

Algúns arquivos non se mostraron porque demasiados arquivos cambiaron neste cambio