summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-10-28 12:17:18 -0400
committerBill Hoffman <bill.hoffman@kitware.com>2009-10-28 12:17:18 -0400
commitb4ae8bad4b8e7810a44e2f77363de3009260a473 (patch)
tree7dd8a97d409c6339948ac4b3e0eda77cd9b7384e
parentebd0c2d3771835a1317c1fd70eafd3ebf2135b01 (diff)
downloadcmake-b4ae8bad4b8e7810a44e2f77363de3009260a473.tar.gz
RC 4 merge
-rw-r--r--CMakeLists.txt5
-rw-r--r--CTestCustom.cmake.in3
-rw-r--r--ChangeLog.manual47
-rw-r--r--CompileFlags.cmake9
-rw-r--r--Modules/CMakeFortranCompilerId.F.in2
-rw-r--r--Modules/CMakeVS10FindMake.cmake4
-rw-r--r--Modules/CMakeVerifyManifest.cmake115
-rw-r--r--Modules/Compiler/G95-Fortran.cmake7
-rw-r--r--Modules/DartConfiguration.tcl.in5
-rw-r--r--Modules/FeatureSummary.cmake16
-rw-r--r--Modules/FindBoost.cmake2
-rw-r--r--Modules/FindCUDA.cmake4
-rw-r--r--Modules/FindJNI.cmake13
-rw-r--r--Modules/FindMPI.cmake144
-rw-r--r--Modules/FindOpenSceneGraph.cmake17
-rw-r--r--Modules/FindPythonLibs.cmake2
-rw-r--r--Modules/FindSquish.cmake30
-rw-r--r--Modules/NSIS.template.in20
-rw-r--r--Modules/Platform/Linux-Intel-Fortran.cmake2
-rw-r--r--Modules/Platform/Windows-g77.cmake3
-rw-r--r--Modules/Platform/Windows-ifort.cmake4
-rw-r--r--Source/CMakeLists.txt2
-rw-r--r--Source/CPack/cmCPackTGZGenerator.cxx9
-rw-r--r--Source/CTest/cmCTestBatchTestHandler.cxx8
-rw-r--r--Source/CTest/cmCTestBuildAndTestHandler.cxx4
-rw-r--r--Source/CTest/cmCTestCoverageHandler.cxx224
-rw-r--r--Source/CTest/cmCTestMultiProcessHandler.cxx10
-rw-r--r--Source/CTest/cmCTestRunTest.cxx6
-rw-r--r--Source/QtDialog/CMakeSetup.cxx9
-rw-r--r--Source/QtDialog/QCMake.cxx21
-rw-r--r--Source/cmCTest.cxx14
-rw-r--r--Source/cmCommandArgumentParserHelper.cxx6
-rw-r--r--Source/cmCoreTryCompile.cxx3
-rw-r--r--Source/cmExtraCodeBlocksGenerator.cxx171
-rw-r--r--Source/cmExtraEclipseCDT4Generator.cxx9
-rw-r--r--Source/cmFileCommand.cxx178
-rw-r--r--Source/cmFileCommand.h2
-rw-r--r--Source/cmGlobalVisualStudio10Generator.cxx5
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.cxx37
-rw-r--r--Source/cmGlobalVisualStudio10Win64Generator.h36
-rw-r--r--Source/cmGlobalVisualStudio7Generator.cxx7
-rw-r--r--Source/cmGlobalVisualStudio7Generator.h5
-rw-r--r--Source/cmGlobalVisualStudio8Generator.cxx242
-rw-r--r--Source/cmGlobalVisualStudio8Generator.h8
-rw-r--r--Source/cmGlobalVisualStudioGenerator.h3
-rw-r--r--Source/cmGlobalXCodeGenerator.cxx24
-rw-r--r--Source/cmIfCommand.cxx203
-rw-r--r--Source/cmIfCommand.h28
-rw-r--r--Source/cmLocalVisualStudio10Generator.cxx8
-rw-r--r--Source/cmLocalVisualStudio7Generator.cxx13
-rw-r--r--Source/cmPolicies.cxx25
-rw-r--r--Source/cmPolicies.h2
-rw-r--r--Source/cmVS10CLFlagTable.h28
-rw-r--r--Source/cmVS10LinkFlagTable.h9
-rw-r--r--Source/cmVisualStudio10TargetGenerator.cxx143
-rw-r--r--Source/cmVisualStudio10TargetGenerator.h12
-rw-r--r--Source/cmake.cxx3
-rwxr-xr-xSource/cmparseMSBuildXML.py35
-rw-r--r--Source/kwsys/ProcessUNIX.c4
-rw-r--r--Source/kwsys/SystemTools.cxx15
-rw-r--r--Tests/BuildDepends/CMakeLists.txt14
-rw-r--r--Tests/CMakeLists.txt204
-rw-r--r--Tests/CMakeTestAllGenerators/RunCMake.cmake95
-rw-r--r--Tests/CMakeTestBadCommandLines/RunCMake.cmake79
-rw-r--r--Tests/CMakeTestMultipleConfigures/RunCMake.cmake165
-rw-r--r--Tests/CMakeTests/CMakeLists.txt5
-rw-r--r--Tests/CMakeTests/ELF/elf32lsb.binbin0 -> 2824 bytes
-rw-r--r--Tests/CMakeTests/ELF/elf32msb.binbin0 -> 17984 bytes
-rw-r--r--Tests/CMakeTests/ELF/elf64lsb.binbin0 -> 4320 bytes
-rw-r--r--Tests/CMakeTests/ELF/elf64msb.binbin0 -> 18704 bytes
-rw-r--r--Tests/CMakeTests/ELFTest.cmake.in48
-rw-r--r--Tests/CMakeTests/FileTest.cmake.in19
-rw-r--r--Tests/CMakeTests/FileTestScript.cmake207
-rw-r--r--Tests/CMakeTests/IfTest.cmake.in158
-rw-r--r--Tests/CPackTestAllGenerators/CMakeLists.txt5
-rw-r--r--Tests/CPackTestAllGenerators/RunCPack.cmake55
-rw-r--r--Tests/CTestTest/SmallAndFast/CMakeLists.txt15
-rw-r--r--Tests/CTestTest/SmallAndFast/intentional_compile_error.cxx1
-rw-r--r--Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx11
-rw-r--r--Tests/CTestTestFailedSubmits/test.cmake.in47
-rw-r--r--Tests/CTestTestRunScript/hello.cmake6
-rw-r--r--Tests/CTestTestRunScript/test.cmake7
-rw-r--r--Tests/CTestTestSubdir/CMakeLists.txt11
-rw-r--r--Tests/CTestTestSubdir/CTestConfig.cmake7
-rw-r--r--Tests/CTestTestSubdir/subdir/CMakeLists.txt2
-rw-r--r--Tests/CTestTestSubdir/subdir/main.c4
-rw-r--r--Tests/CTestTestSubdir/test.cmake.in32
-rw-r--r--Tests/Fortran/CMakeLists.txt19
-rw-r--r--Tests/Fortran/hello.f4
-rw-r--r--Tests/Fortran/testf.f7
-rw-r--r--Tests/Fortran/world.def2
-rw-r--r--Tests/Fortran/world.f6
-rwxr-xr-xTests/KDE4StableBranchTest/test_kde4.sh.in62
-rw-r--r--Utilities/Release/dash2win64_release.cmake2
-rw-r--r--Utilities/cmtar/compat/fnmatch.c7
-rw-r--r--Utilities/cmtar/compat/snprintf.c4
-rw-r--r--Utilities/cmtar/libtar.c4
97 files changed, 2658 insertions, 681 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 29337481c9..60a9f22b02 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -141,12 +141,13 @@ MACRO(CMAKE_SETUP_TESTING)
# cmake.
SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest")
SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake")
+ SET(CMAKE_CPACK_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cpack")
ENDIF(BUILD_TESTING)
# configure some files for testing
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
- @ONLY)
+ @ONLY)
CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
@@ -315,7 +316,7 @@ ENDMACRO (CMAKE_BUILD_UTILITIES)
SET(CMake_VERSION_MAJOR 2)
SET(CMake_VERSION_MINOR 8)
SET(CMake_VERSION_PATCH 0)
-SET(CMake_VERSION_RC 3)
+SET(CMake_VERSION_RC 4)
# We use odd minor numbers for development versions.
# Use a date for the development patch level.
diff --git a/CTestCustom.cmake.in b/CTestCustom.cmake.in
index 2a6ce06047..343f9b0adf 100644
--- a/CTestCustom.cmake.in
+++ b/CTestCustom.cmake.in
@@ -53,4 +53,7 @@ SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
# Exclude try_compile sources from coverage results:
"/CMakeFiles/CMakeTmp/"
+
+ # Exclude Qt source files from coverage results:
+ "[A-Za-z]./[Qq]t/qt-.+-opensource-src"
)
diff --git a/ChangeLog.manual b/ChangeLog.manual
index 65cb728220..bba384642d 100644
--- a/ChangeLog.manual
+++ b/ChangeLog.manual
@@ -1,3 +1,50 @@
+Changes in CMake 2.8.0 RC 4
+- Fix try_compile when file cannot be found
+- Add new module to test manifest installation issues on windows.
+- Add more test coverage
+-Improvements in finding MPI on windows. ENH: reorganized searching mpi for mpi components (include,lib,bin) using a single set of search paths instead of seperately mainted lists of paths for each.
+- Look for nvcc in the 32 bit bin directory before the 64 bin directory.
+- BUG: hardcore some values so output matches cmVS10CLFlagTable.h (addresses bug #9753)
+- Avoid Intel linker crash in BuildDepends test
+- Fix Intel Fortran SHARED libraries on Linux
+- Fix working dir issue for ctest
+- Fix if() command and CMP0012 OLD/NEW behavior
+- Allow for /D to change install directory on the command line for NSIS
+- Move SetErrorMode around calls to generate and configure instead of setting it for the whole application for cmake-gui on windows. Allows for bad installs of windows shell programs to not break file completion.
+- Fix Intel and MinGW Fortran DLL import libraries
+- Fix Xcode dylib version default
+- Fix the showing of non-cpp files in the IDE for VS 10
+- Fix optionally-valued booleans in VS 10 flag table
+- Detect and set Unicode character set in VS 10
+- Add support for the g95 Fortran compiler
+- Test all target types in Fortran
+- Add Xcode file association for Fortran
+- Fix VS 10 flag table for precompiled headers
+- Fix VS 10 .sln files for Windows Explorer
+- Fix Microsoft.Cpp.$(Platform).user.props in VS10b2
+- Fix up file(DOWNLOAD ) a bit, better error checking and uses of long not double for timeout as curl needs, bug# 9748
+- Add a VS 10 Win64 generator
+- Fix for bug#9686 convert java_home to a cmake path before using.
+- fix for bug# 9751, add check for MSVC10
+- Fix for bugs #9756, #9690 and #9755, header files were not included, and link_directories we incorrect
+- Add a module to test an install tree to verify that the MS CRT version is correct.
+- Fix seg fault for empty ENV{} call bug #9747
+- Better fix for finding the MSBuild that matches the VS 10 install.
+- make testing the CodeBlocks and Eclipse generators easier by not requiring the CMAKE_EDIT_COMMAND variable
+- Do not link library dependencies in VS solutions
+- Ctest was broken for subdirs. Restored working directory state for tests so that their executables could be found.
+- Fixes version detection using osg/Version on Mac OSX when OSG is installed as a framework
+- Avoid C++ linker language in VS Fortran project
+- Avoid duplicate ZERO_CHECK in VS solutions
+- Fixed bug 8319, search for the Python shared library in the standard locations.
+- Fix bug#9714, should not crash when version file is not where it should be...
+- Fix ctest output alignment for cases where total tests run is not the same width as max test index.
+- make it more robust wrt. #9621
+- Add another possible error message that curl might emit with an empty drop location.
+- Fix issue #5668 - use CollapseFullPath when determining if covered file is within source or binary tree. Allows gcc/gcov coverage analysis using MinGW on Windows.
+- CTest-side support for compiler name and compiler version information. Requires CDash update to show on CDash.
+- Add a bunch more testing coverage.
+
Changes in CMake 2.8.0 RC 3
- CTest Added OS Platform (cpu architecture) detection support to windows system
- Several minor FindBoost changes to address posts on mailing list
diff --git a/CompileFlags.cmake b/CompileFlags.cmake
index ed12ab2509..3b455b96fc 100644
--- a/CompileFlags.cmake
+++ b/CompileFlags.cmake
@@ -21,13 +21,18 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake)
+IF(WIN32 AND "${CMAKE_C_COMPILER_ID}" MATCHES "^(Intel)$")
+ SET(_INTEL_WINDOWS 1)
+ENDIF()
+
# Disable deprecation warnings for standard C functions.
# really only needed for newer versions of VS, but should
# not hurt other versions, and this will work into the
# future
-IF(MSVC)
+IF(MSVC OR _INTEL_WINDOWS)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
-ENDIF(MSVC)
+ELSE()
+ENDIF()
#silence duplicate symbol warnings on AIX
IF(CMAKE_SYSTEM MATCHES "AIX.*")
diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in
index 51f4e91d04..c92f127a26 100644
--- a/Modules/CMakeFortranCompilerId.F.in
+++ b/Modules/CMakeFortranCompilerId.F.in
@@ -6,6 +6,8 @@
PRINT *, 'INFO:compiler[Intel]'
#elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95)
PRINT *, 'INFO:compiler[SunPro]'
+#elif defined(__G95__)
+ PRINT *, 'INFO:compiler[G95]'
#elif defined(__GNUC__)
PRINT *, 'INFO:compiler[GNU]'
#elif defined(__IBMC__)
diff --git a/Modules/CMakeVS10FindMake.cmake b/Modules/CMakeVS10FindMake.cmake
index 4c8d619a3d..8233e520b1 100644
--- a/Modules/CMakeVS10FindMake.cmake
+++ b/Modules/CMakeVS10FindMake.cmake
@@ -21,8 +21,8 @@ ENDIF(NOT CMAKE_CROSSCOMPILING)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM
NAMES MSBuild
HINTS
- "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/v4.0.20506/"
- c:/WINDOWS/Microsoft.NET/Framework/v4.0.20506/
+ "$ENV{SYSTEMROOT}/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/"
+ "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/"
)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM
diff --git a/Modules/CMakeVerifyManifest.cmake b/Modules/CMakeVerifyManifest.cmake
new file mode 100644
index 0000000000..dbba46418a
--- /dev/null
+++ b/Modules/CMakeVerifyManifest.cmake
@@ -0,0 +1,115 @@
+# CMakeVerifyManifest.cmake
+#
+# This script is used to verify that embeded manifests and
+# side by side manifests for a project match. To run this
+# script, cd to a directory and run the script with cmake -P.
+# On the command line you can pass in versions that are OK even
+# if not found in the .manifest files. For example,
+# cmake -Dallow_versions=8.0.50608.0 -PCmakeVerifyManifest.cmake
+# could be used to allow an embeded manifest of 8.0.50608.0
+# to be used in a project even if that version was not found
+# in the .manifest file.
+
+# This script first recursively globs *.manifest files from
+# the current directory. Then globs *.exe and *.dll. Each
+# .exe and .dll is scanned for embeded manifests and the versions
+# of CRT are compared to those found in the .manifest files
+# from the first glob.
+
+#=============================================================================
+# Copyright 2008-2009 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 distributed this file outside of CMake, substitute the full
+# License text for the above reference.)
+
+
+# crt_version:
+# function to extract the CRT version from a file
+# this can be passed a .exe, .dll, or a .manifest file
+# it will put the list of versions found into the variable
+# specified by list_var
+function(crt_version file list_var)
+ file(STRINGS "${file}" strings REGEX "Microsoft.VC...CRT" NEWLINE_CONSUME)
+ foreach(s ${strings})
+ set(has_match 1)
+ string(REGEX
+ REPLACE ".*<assembly.*\"Microsoft.VC...CRT\".*version=\"([^\"]*)\".*</assembly>.*$" "\\1"
+ version "${s}")
+ if(NOT "${version}" STREQUAL "")
+ list(APPEND version_list ${version})
+ else()
+ message(FATAL_ERROR "Parse error could not find version in [${s}]")
+ endif()
+ endforeach(s)
+ if(NOT DEFINED has_match)
+ message("Information: no embeded manifest in: ${file}")
+ return()
+ endif()
+ list(APPEND version_list ${${list_var}})
+ list(REMOVE_DUPLICATES version_list)
+ if(version_list)
+ set(${list_var} ${version_list} PARENT_SCOPE)
+ endif()
+endfunction(crt_version)
+set(fatal_error FALSE)
+
+# check_version:
+#
+# test a file against the shipped manifest versions
+# for a directory
+function(check_version file manifest_versions)
+ set(manifest_versions ${manifest_versions} ${allow_versions})
+ # collect versions for a given file
+ crt_version(${file} file_versions)
+ # see if the versions
+ foreach(ver ${file_versions})
+ list(FIND manifest_versions "${ver}" found_version)
+ if("${found_version}" EQUAL -1)
+ message("ERROR: ${file} uses ${ver} not found in shipped manifests:[${manifest_versions}].")
+ set(fatal_error TRUE PARENT_SCOPE)
+ endif()
+ endforeach(ver)
+ list(LENGTH file_versions len)
+ if(${len} GREATER 1)
+ message("WARNING: found more than one version of MICROSOFT.VC80.CRT referenced in ${file}: [${file_versions}]")
+ endif()
+endfunction()
+
+# collect up the versions of CRT that are shipped
+# in .manifest files
+set(manifest_version_list )
+file(GLOB_RECURSE manifest_files "*.manifest")
+foreach(f ${manifest_files})
+ crt_version("${f}" manifest_version_list)
+endforeach(f)
+list(LENGTH manifest_version_list LEN)
+if(LEN EQUAL 0)
+ message(FATAL_ERROR "No .manifest files found, no version check can be done.")
+endif()
+message("Versions found in ${manifest_files}: ${manifest_version_list}")
+if(DEFINED allow_versions)
+ message("Extra versions allowed: ${allow_versions}")
+endif()
+
+# now find all .exe and .dll files
+# and call check_version on each of them
+file(GLOB_RECURSE exe_files "*.exe")
+file(GLOB_RECURSE dll_files "*.dll")
+set(exe_files ${exe_files} ${dll_files})
+foreach(f ${exe_files})
+ check_version(${f} "${manifest_version_list}")
+endforeach()
+
+# report a fatal error if there were any so that cmake will return
+# a non zero value
+if(fatal_error)
+ message(FATAL_ERROR "This distribution embeds dll "
+ " versions that it does not ship, and may not work on other machines.")
+endif()
diff --git a/Modules/Compiler/G95-Fortran.cmake b/Modules/Compiler/G95-Fortran.cmake
new file mode 100644
index 0000000000..cbd4661184
--- /dev/null
+++ b/Modules/Compiler/G95-Fortran.cmake
@@ -0,0 +1,7 @@
+set(CMAKE_Fortran_FLAGS_INIT "")
+set(CMAKE_Fortran_FLAGS_DEBUG_INIT "-g")
+set(CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-Os")
+set(CMAKE_Fortran_FLAGS_RELEASE_INIT "-O3")
+set(CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-O2 -g")
+set(CMAKE_Fortran_MODDIR_FLAG "-fmod=")
+set(CMAKE_Fortran_VERBOSE_FLAG "-v")
diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in
index 7b79a3dafe..2eea45cd01 100644
--- a/Modules/DartConfiguration.tcl.in
+++ b/Modules/DartConfiguration.tcl.in
@@ -45,7 +45,10 @@ UpdateCommand: @UPDATE_COMMAND@
UpdateOptions: @UPDATE_OPTIONS@
UpdateType: @UPDATE_TYPE@
-# Dynamic analisys and coverage
+# Compiler info
+Compiler: @CMAKE_CXX_COMPILER@
+
+# Dynamic analysis and coverage
PurifyCommand: @PURIFYCOMMAND@
ValgrindCommand: @VALGRIND_COMMAND@
ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@
diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake
index 5373852fab..d1d31bcebe 100644
--- a/Modules/FeatureSummary.cmake
+++ b/Modules/FeatureSummary.cmake
@@ -32,7 +32,7 @@
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
-MACRO(SET_FEATURE_INFO _name _desc)
+FUNCTION(SET_FEATURE_INFO _name _desc)
SET(_url "${ARGV2}")
SET(_comment "${ARGV3}")
SET_PROPERTY(GLOBAL PROPERTY ${_name}_DESCRIPTION "${_desc}" )
@@ -42,10 +42,10 @@ MACRO(SET_FEATURE_INFO _name _desc)
IF(_comment MATCHES ".+")
SET_PROPERTY(GLOBAL PROPERTY ${_name}_COMMENT "${_comment}" )
ENDIF(_comment MATCHES ".+")
-ENDMACRO(SET_FEATURE_INFO)
+ENDFUNCTION(SET_FEATURE_INFO)
-MACRO(_PRINT_FEATURES _property _text)
+FUNCTION(_PRINT_FEATURES _property _text)
SET(_currentFeatureText "${_text}")
GET_PROPERTY(_EnabledFeatures GLOBAL PROPERTY ${_property})
FOREACH(_currentFeature ${_EnabledFeatures})
@@ -64,15 +64,15 @@ MACRO(_PRINT_FEATURES _property _text)
ENDIF(_info)
ENDFOREACH(_currentFeature)
MESSAGE(STATUS "${_currentFeatureText}\n")
-ENDMACRO(_PRINT_FEATURES)
+ENDFUNCTION(_PRINT_FEATURES)
-MACRO(PRINT_ENABLED_FEATURES)
+FUNCTION(PRINT_ENABLED_FEATURES)
_PRINT_FEATURES( ENABLED_FEATURES "Enabled features:")
-ENDMACRO(PRINT_ENABLED_FEATURES)
+ENDFUNCTION(PRINT_ENABLED_FEATURES)
-MACRO(PRINT_DISABLED_FEATURES)
+FUNCTION(PRINT_DISABLED_FEATURES)
_PRINT_FEATURES( DISABLED_FEATURES "Disabled features:")
-ENDMACRO(PRINT_DISABLED_FEATURES)
+ENDFUNCTION(PRINT_DISABLED_FEATURES)
diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake
index 04f5d528c4..428be9e1c4 100644
--- a/Modules/FindBoost.cmake
+++ b/Modules/FindBoost.cmake
@@ -569,6 +569,8 @@ ELSE (_boost_IN_CACHE)
endif()
elseif (MSVC90)
SET (_boost_COMPILER "-vc90")
+ elseif (MSVC10)
+ SET (_boost_COMPILER "-vc100")
elseif (MSVC80)
SET (_boost_COMPILER "-vc80")
elseif (MSVC71)
diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake
index 34fcb97100..6c512983aa 100644
--- a/Modules/FindCUDA.cmake
+++ b/Modules/FindCUDA.cmake
@@ -469,8 +469,8 @@ endif (NOT CUDA_TOOLKIT_ROOT_DIR)
# CUDA_NVCC_EXECUTABLE
find_program(CUDA_NVCC_EXECUTABLE
NAMES nvcc
- PATHS "${CUDA_TOOLKIT_ROOT_DIR}/bin64"
- "${CUDA_TOOLKIT_ROOT_DIR}/bin"
+ PATHS "${CUDA_TOOLKIT_ROOT_DIR}/bin"
+ "${CUDA_TOOLKIT_ROOT_DIR}/bin64"
ENV CUDA_BIN_PATH
NO_DEFAULT_PATH
)
diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake
index 8c9523a549..707d1fa275 100644
--- a/Modules/FindJNI.cmake
+++ b/Modules/FindJNI.cmake
@@ -67,11 +67,14 @@ SET(JAVA_AWT_LIBRARY_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/lib"
)
+
+FILE(TO_CMAKE_PATH "$ENV{JAVA_HOME}" _JAVA_HOME)
+
JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
- $ENV{JAVA_HOME}/jre/lib/{libarch}
- $ENV{JAVA_HOME}/jre/lib
- $ENV{JAVA_HOME}/lib
- $ENV{JAVA_HOME}
+ ${_JAVA_HOME}/jre/lib/{libarch}
+ ${_JAVA_HOME}/jre/lib
+ ${_JAVA_HOME}/lib
+ ${_JAVA_HOME}
/usr/lib
/usr/local/lib
/usr/lib/jvm/java/lib
@@ -106,7 +109,7 @@ SET(JAVA_AWT_INCLUDE_DIRECTORIES
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
- $ENV{JAVA_HOME}/include
+ ${_JAVA_HOME}/include
/usr/include
/usr/local/include
/usr/lib/java/include
diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake
index d5014dd5b0..e945ec5de6 100644
--- a/Modules/FindMPI.cmake
+++ b/Modules/FindMPI.cmake
@@ -1,5 +1,5 @@
# - Message Passing Interface (MPI) module.
-#
+#
# The Message Passing Interface (MPI) is a library used to write
# high-performance parallel applications that use message passing, and
# is typically deployed on a cluster. MPI is a standard interface
@@ -35,7 +35,7 @@
#
# If no compiler driver is found or the compiler driver is not
# recognized, this module will then search for common include paths
-# and library names to try to detect MPI.
+# and library names to try to detect MPI.
#
# If CMake initially finds a different MPI than was intended, and you
# want to use the MPI compiler auto-detection for a different MPI
@@ -49,7 +49,7 @@
# ${MPIEXEC} ${MPIEXEC_NUMPROC_FLAG} PROCS ${MPIEXEC_PREFLAGS} EXECUTABLE
# ${MPIEXEC_POSTFLAGS} ARGS
# where PROCS is the number of processors on which to execute the program,
-# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the
+# EXECUTABLE is the MPI program, and ARGS are the arguments to pass to the
# MPI program.
#=============================================================================
@@ -65,27 +65,64 @@
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
-# Try to find the MPI driver program
-find_program(MPI_COMPILER
- NAMES mpic++ mpicxx mpiCC mpicc
- DOC "MPI compiler. Used only to detect MPI compilation flags.")
-mark_as_advanced(MPI_COMPILER)
+# This module is maintained by David Partyka <dave.partyka@kitware.com>.
+
+# A set of directories to search through in addition to the standard system paths
+# that find_program will search through.
+# Microsoft HPC SDK is automatically added to the system path
+# Argonne National Labs MPICH2 sets a registry key that we can use.
-file(TO_CMAKE_PATH "$ENV{ProgramFiles}" ProgramFiles)
+set(MPI_PACKAGE_DIR
+ mpi
+ mpich
+ openmpi
+ lib/mpi
+ lib/mpich
+ lib/openmpi
+ "MPICH/SDK"
+ "Microsoft Compute Cluster Pack"
+ )
+
+set(MPI_PREFIX_PATH)
+if(WIN32)
+ list(APPEND MPI_PREFIX_PATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\MPICH\\SMPD;binary]/..")
+endif()
+
+foreach(SystemPrefixDir ${CMAKE_SYSTEM_PREFIX_PATH})
+ foreach(MpiPackageDir ${MPI_PREFIX_PATH})
+ if(EXISTS ${SystemPrefixDir}/${MpiPackageDir})
+ list(APPEND MPI_PREFIX_PATH "${SystemPrefixDir}/${MpiPackageDir}")
+ endif()
+ endforeach(MpiPackageDir)
+endforeach(SystemPrefixDir)
+
+# Most mpi distros have some form of mpiexec which gives us something we can reliably look for.
find_program(MPIEXEC
NAMES mpiexec mpirun lamexec
- PATHS /usr/bin /usr/local/bin /usr/local/mpi/bin
- "$ENV{SystemDrive}/Program Files/MPICH/SDK/Bin"
- "${ProgramFiles}/MPICH2/Bin"
- "$ENV{SystemDrive}/Program Files/Microsoft Compute Cluster Pack/Bin"
- "$ENV{SystemDrive}/Program Files/Microsoft HPC Pack 2008 SDK/Bin"
- DOC "Executable for running MPI programs.")
+ PATHS ${MPI_PREFIX_PATH}
+ PATH_SUFFIXES bin
+ DOC "Executable for running MPI programs."
+ )
+
+# call get_filename_component twice to remove mpiexec and the directory it exists in (typically bin).
+# This gives us a fairly reliable base directory to search for /bin /lib and /include from.
+get_filename_component(MPI_BASE_DIR "${MPIEXEC}" PATH)
+get_filename_component(MPI_BASE_DIR "${MPI_BASE_DIR}" PATH)
+
+# If there is an mpi compiler find it and interogate (farther below) it for the include
+# and lib dirs otherwise we will continue to search from ${MPI_BASE_DIR}.
+find_program(MPI_COMPILER
+ NAMES mpic++ mpicxx mpiCC mpicc
+ HINTS "${MPI_BASE_DIR}"
+ PATH_SUFFIXES bin
+ DOC "MPI compiler. Used only to detect MPI compilation flags.")
+mark_as_advanced(MPI_COMPILER)
set(MPIEXEC_NUMPROC_FLAG "-np" CACHE STRING "Flag used by MPI to specify the number of processes for MPIEXEC; the next option will be the number of processes.")
set(MPIEXEC_PREFLAGS "" CACHE STRING "These flags will be directly before the executable that is being run by MPIEXEC.")
set(MPIEXEC_POSTFLAGS "" CACHE STRING "These flags will come after all flags given to MPIEXEC.")
set(MPIEXEC_MAX_NUMPROCS "2" CACHE STRING "Maximum number of processors available to run MPI applications.")
-mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS
+mark_as_advanced(MPIEXEC MPIEXEC_NUMPROC_FLAG MPIEXEC_PREFLAGS
MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
@@ -95,15 +132,16 @@ elseif (MPI_COMPILER)
# Check whether the -showme:compile option works. This indicates
# that we have either Open MPI or a newer version of LAM-MPI, and
# implies that -showme:link will also work.
- exec_program(${MPI_COMPILER}
- ARGS -showme:compile
+ # Note that Windows distros do not have an mpi compiler to interogate.
+ exec_program(${MPI_COMPILER}
+ ARGS -showme:compile
OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
RETURN_VALUE MPI_COMPILER_RETURN)
if (MPI_COMPILER_RETURN EQUAL 0)
# If we appear to have -showme:compile, then we should also have
# -showme:link. Try it.
- exec_program(${MPI_COMPILER}
+ exec_program(${MPI_COMPILER}
ARGS -showme:link
OUTPUT_VARIABLE MPI_LINK_CMDLINE
RETURN_VALUE MPI_COMPILER_RETURN)
@@ -117,21 +155,21 @@ elseif (MPI_COMPILER)
# Do nothing: we have our command lines now
else (MPI_COMPILER_RETURN EQUAL 0)
# Older versions of LAM-MPI have "-showme". Try it.
- exec_program(${MPI_COMPILER}
+ exec_program(${MPI_COMPILER}
ARGS -showme
OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
RETURN_VALUE MPI_COMPILER_RETURN)
- endif (MPI_COMPILER_RETURN EQUAL 0)
+ endif (MPI_COMPILER_RETURN EQUAL 0)
if (MPI_COMPILER_RETURN EQUAL 0)
# Do nothing: we have our command lines now
else (MPI_COMPILER_RETURN EQUAL 0)
# MPICH uses "-show". Try it.
- exec_program(${MPI_COMPILER}
+ exec_program(${MPI_COMPILER}
ARGS -show
OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
RETURN_VALUE MPI_COMPILER_RETURN)
- endif (MPI_COMPILER_RETURN EQUAL 0)
+ endif (MPI_COMPILER_RETURN EQUAL 0)
if (MPI_COMPILER_RETURN EQUAL 0)
# We have our command lines, but we might need to copy
@@ -167,12 +205,12 @@ elseif (MPI_COMPILE_CMDLINE)
string(REGEX REPLACE "//" "/" IPATH ${IPATH})
list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
endforeach(IPATH)
-
+
if (NOT MPI_INCLUDE_PATH_WORK)
if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
# The compile command line didn't have any include paths on it,
# but we may have -showme:incdirs. Use it.
- exec_program(${MPI_COMPILER}
+ exec_program(${MPI_COMPILER}
ARGS -showme:incdirs
OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK
RETURN_VALUE MPI_COMPILER_RETURN)
@@ -183,7 +221,10 @@ elseif (MPI_COMPILE_CMDLINE)
if (NOT MPI_INCLUDE_PATH_WORK)
# If all else fails, just search for mpi.h in the normal include
# paths.
- find_path(MPI_INCLUDE_PATH mpi.h)
+ find_path(MPI_INCLUDE_PATH mpi.h
+ HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH}
+ PATH_SUFFIXES include
+ )
set(MPI_INCLUDE_PATH_WORK ${MPI_INCLUDE_PATH})
endif (NOT MPI_INCLUDE_PATH_WORK)
@@ -200,7 +241,7 @@ elseif (MPI_COMPILE_CMDLINE)
if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
# The compile command line didn't have any linking paths on it,
# but we may have -showme:libdirs. Use it.
- exec_program(${MPI_COMPILER}
+ exec_program(${MPI_COMPILER}
ARGS -showme:libdirs
OUTPUT_VARIABLE MPI_LINK_PATH
RETURN_VALUE MPI_COMPILER_RETURN)
@@ -261,41 +302,29 @@ elseif (MPI_COMPILE_CMDLINE)
set(MPI_INCLUDE_PATH ${MPI_INCLUDE_PATH_WORK} CACHE STRING "MPI include path" FORCE)
set(MPI_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI linking flags" FORCE)
else (MPI_COMPILE_CMDLINE)
- find_path(MPI_INCLUDE_PATH mpi.h
- /usr/local/include
- /usr/include
- /usr/include/mpi
- /usr/local/mpi/include
- "$ENV{SystemDrive}/Program Files/MPICH/SDK/Include"
- "${ProgramFiles}/MPICH2/include"
- "$ENV{SystemDrive}/Program Files/Microsoft Compute Cluster Pack/Include"
- "$ENV{SystemDrive}/Program Files/Microsoft HPC Pack 2008 SDK/Include"
+# No MPI compiler to interogate so attempt to find everything with find functions.
+ find_path(MPI_INCLUDE_PATH mpi.h
+ HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH}
+ PATH_SUFFIXES include
)
# Decide between 32-bit and 64-bit libraries for Microsoft's MPI
- if (CMAKE_CL_64)
+ if("${CMAKE_SIZEOF_VOID_P}" EQUAL 8)
set(MS_MPI_ARCH_DIR amd64)
- else (CMAKE_CL_64)
+ else()
set(MS_MPI_ARCH_DIR i386)
- endif (CMAKE_CL_64)
+ endif()
- find_library(MPI_LIBRARY
+ find_library(MPI_LIBRARY
NAMES mpi mpich msmpi
- PATHS /usr/lib /usr/local/lib /usr/local/mpi/lib
- "$ENV{SystemDrive}/Program Files/MPICH/SDK/Lib"
- "${ProgramFiles}/MPICH2/Lib"
- "$ENV{SystemDrive}/Program Files/Microsoft Compute Cluster Pack/Lib/${MS_MPI_ARCH_DIR}"
- "$ENV{SystemDrive}/Program Files/Microsoft HPC Pack 2008 SDK/Lib/${MS_MPI_ARCH_DIR}"
+ HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH}
+ PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR}
)
- find_library(MPI_LIBRARY
- NAMES mpich2
- PATHS
- "${ProgramFiles}/MPICH2/Lib")
- find_library(MPI_EXTRA_LIBRARY
+ find_library(MPI_EXTRA_LIBRARY
NAMES mpi++
- PATHS /usr/lib /usr/local/lib /usr/local/mpi/lib
- "$ENV{SystemDrive}/Program Files/MPICH/SDK/Lib"
+ HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH}
+ PATH_SUFFIXES lib
DOC "Extra MPI libraries to link against.")
set(MPI_COMPILE_FLAGS "" CACHE STRING "MPI compilation flags")
@@ -308,7 +337,7 @@ if("${MPI_LIBRARY}" MATCHES "mpich.rts")
set(MPI_LIBRARY ${MPI_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
endif("${MPI_LIBRARY}" MATCHES "mpich.rts")
-# Set up extra variables to conform to
+# Set up extra variables to conform to
if (MPI_EXTRA_LIBRARY)
set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
else (MPI_EXTRA_LIBRARY)
@@ -322,8 +351,13 @@ else (MPI_INCLUDE_PATH AND MPI_LIBRARY)
endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
include(FindPackageHandleStandardArgs)
-# handle the QUIETLY and REQUIRED arguments
+# handle the QUIETLY and REQUIRED arguments
find_package_handle_standard_args(MPI DEFAULT_MSG MPI_LIBRARY MPI_INCLUDE_PATH)
-mark_as_advanced(MPI_INCLUDE_PATH MPI_COMPILE_FLAGS MPI_LINK_FLAGS MPI_LIBRARY
+mark_as_advanced(MPI_INCLUDE_PATH MPI_COMPILE_FLAGS MPI_LINK_FLAGS MPI_LIBRARY
MPI_EXTRA_LIBRARY)
+
+# unset to cleanup namespace
+unset(MPI_PACKAGE_DIR)
+unset(MPI_PREFIX_PATH)
+unset(MPI_BASE_DIR)
diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake
index 9a13ea2ab7..25cf4ee150 100644
--- a/Modules/FindOpenSceneGraph.cmake
+++ b/Modules/FindOpenSceneGraph.cmake
@@ -96,13 +96,22 @@ if(OSG_INCLUDE_DIR)
message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
"Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}")
endif()
-
- file(READ "${OSG_INCLUDE_DIR}/osg/Version" _osg_Version_contents)
+
+ set(_osg_Version_file "${OSG_INCLUDE_DIR}/osg/Version")
+ if("${OSG_INCLUDE_DIR}" MATCHES "\\.framework$" AND NOT EXISTS "${_osg_Version_file}")
+ set(_osg_Version_file "${OSG_INCLUDE_DIR}/Headers/Version")
+ endif()
+
+ if(EXISTS "${_osg_Version_file}")
+ file(READ "${_osg_Version_file}" _osg_Version_contents)
+ else()
+ set(_osg_Version_contents "unknown")
+ endif()
string(REGEX MATCH ".*#define OSG_VERSION_MAJOR[ \t]+[0-9]+.*"
- _osg_old_defines ${_osg_Version_contents})
+ _osg_old_defines "${_osg_Version_contents}")
string(REGEX MATCH ".*#define OPENSCENEGRAPH_MAJOR_VERSION[ \t]+[0-9]+.*"
- _osg_new_defines ${_osg_Version_contents})
+ _osg_new_defines "${_osg_Version_contents}")
if(_osg_old_defines)
string(REGEX REPLACE ".*#define OSG_VERSION_MAJOR[ \t]+([0-9]+).*"
"\\1" _osg_VERSION_MAJOR ${_osg_Version_contents})
diff --git a/Modules/FindPythonLibs.cmake b/Modules/FindPythonLibs.cmake
index 2b1241e5d8..81d117981b 100644
--- a/Modules/FindPythonLibs.cmake
+++ b/Modules/FindPythonLibs.cmake
@@ -41,8 +41,6 @@ FOREACH(_CURRENT_VERSION 2.6 2.5 2.4 2.3 2.2 2.1 2.0 1.6 1.5)
NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs
- PATH_SUFFIXES
- python${_CURRENT_VERSION}/config
# Avoid finding the .dll in the PATH. We want the .lib.
NO_SYSTEM_ENVIRONMENT_PATH
)
diff --git a/Modules/FindSquish.cmake b/Modules/FindSquish.cmake
index 3b0eb2f0f3..2327186d80 100644
--- a/Modules/FindSquish.cmake
+++ b/Modules/FindSquish.cmake
@@ -3,27 +3,27 @@
# This module can be used to find Squish (currently support is aimed at version 3).
#
# ---- Variables and Macros
-# SQUISH_FOUND If false, don't try to use Squish
-# SQUISH_VERSION_MAJOR The major version of Squish found
-# SQUISH_VERSION_MINOR The minor version of Squish found
-# SQUISH_VERSION_PATCH The patch version of Squish found
+# SQUISH_FOUND If false, don't try to use Squish
+# SQUISH_VERSION_MAJOR The major version of Squish found
+# SQUISH_VERSION_MINOR The minor version of Squish found
+# SQUISH_VERSION_PATCH The patch version of Squish found
#
-# SQUISH_INSTALL_DIR The Squish installation directory (containing bin, lib, etc)
-# SQUISH_SERVER_EXECUTABLE The squishserver executable
-# SQUISH_CLIENT_EXECUTABLE The squishrunner executable
+# SQUISH_INSTALL_DIR The Squish installation directory (containing bin, lib, etc)
+# SQUISH_SERVER_EXECUTABLE The squishserver executable
+# SQUISH_CLIENT_EXECUTABLE The squishrunner executable
#
-# SQUISH_INSTALL_DIR_FOUND Was the install directory found?
-# SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found?
-# SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found?
+# SQUISH_INSTALL_DIR_FOUND Was the install directory found?
+# SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found?
+# SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found?
#
# macro SQUISH_ADD_TEST(testName applicationUnderTest testSuite testCase)
#
# ---- Typical Use
-# ENABLE_TESTING()
-# FIND_PACKAGE(Squish)
-# IF (SQUISH_FOUND)
-# SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName)
-# ENDIF (SQUISH_FOUND)
+# ENABLE_TESTING()
+# FIND_PACKAGE(Squish)
+# IF (SQUISH_FOUND)
+# SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName)
+# ENDIF (SQUISH_FOUND)
#
#=============================================================================
diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in
index c18104dc84..d90967d2e3 100644
--- a/Modules/NSIS.template.in
+++ b/Modules/NSIS.template.in
@@ -18,7 +18,7 @@
Var ADD_TO_PATH_ALL_USERS
Var ADD_TO_PATH_CURRENT_USER
Var INSTALL_DESKTOP
-
+ Var IS_DEFAULT_INSTALLDIR
;--------------------------------
;Include Modern UI
@@ -892,8 +892,19 @@ Function .onInit
; Reads components status for registry
!insertmacro SectionList "InitSection"
+ ; check to see if /D has been used to change
+ ; the install directory by comparing it to the
+ ; install directory that is expected to be the
+ ; default
+ StrCpy $IS_DEFAULT_INSTALLDIR 0
+ StrCmp "$INSTDIR" "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" 0 +2
+ StrCpy $IS_DEFAULT_INSTALLDIR 1
+
StrCpy $SV_ALLUSERS "JustMe"
- StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+ ; if default install dir then change the default
+ ; if it is installed for JustMe
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+ StrCpy $INSTDIR "$DOCUMENTS\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
ClearErrors
UserInfo::GetName
@@ -917,8 +928,9 @@ Function .onInit
;Get installation folder from registry if available
done:
- StrCmp $SV_ALLUSERS "AllUsers" 0 +2
- StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
+ StrCmp $SV_ALLUSERS "AllUsers" 0 +3
+ StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
+ StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"
diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake
index 27a98ed935..da3b935c2f 100644
--- a/Modules/Platform/Linux-Intel-Fortran.cmake
+++ b/Modules/Platform/Linux-Intel-Fortran.cmake
@@ -8,7 +8,7 @@ IF(XIAR)
ENDIF(XIAR)
SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC")
-SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared")
+SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared -i_dynamic -nofor_main")
SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-i_dynamic")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-rpath,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":")
diff --git a/Modules/Platform/Windows-g77.cmake b/Modules/Platform/Windows-g77.cmake
index ad24db6789..ed3a07332c 100644
--- a/Modules/Platform/Windows-g77.cmake
+++ b/Modules/Platform/Windows-g77.cmake
@@ -20,4 +20,5 @@ SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-O1")
SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O2")
SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-02 -g")
-
+SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY
+ "<CMAKE_Fortran_COMPILER> <CMAKE_SHARED_LIBRARY_Fortran_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
diff --git a/Modules/Platform/Windows-ifort.cmake b/Modules/Platform/Windows-ifort.cmake
index 01848a6011..c9624b55af 100644
--- a/Modules/Platform/Windows-ifort.cmake
+++ b/Modules/Platform/Windows-ifort.cmake
@@ -12,7 +12,7 @@ SET(CMAKE_Fortran_MODDIR_FLAG "-module:")
SET(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1)
SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY
- "link ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /dll <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
+ "link ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /dll <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY})
@@ -26,7 +26,7 @@ SET(CMAKE_Fortran_COMPILE_OBJECT
SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
SET(CMAKE_Fortran_LINK_EXECUTABLE
- "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> -link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
+ "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
INCLUDE(Platform/Windows-Intel)
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index d188b11a88..909969139e 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -303,6 +303,8 @@ IF (WIN32)
cmLocalVisualStudio10Generator.h
cmGlobalVisualStudio10Generator.h
cmGlobalVisualStudio10Generator.cxx
+ cmGlobalVisualStudio10Win64Generator.h
+ cmGlobalVisualStudio10Win64Generator.cxx
cmGlobalVisualStudioGenerator.cxx
cmGlobalVisualStudioGenerator.h
cmGlobalWatcomWMakeGenerator.cxx
diff --git a/Source/CPack/cmCPackTGZGenerator.cxx b/Source/CPack/cmCPackTGZGenerator.cxx
index 1c56d81a9d..391093a6fe 100644
--- a/Source/CPack/cmCPackTGZGenerator.cxx
+++ b/Source/CPack/cmCPackTGZGenerator.cxx
@@ -23,7 +23,6 @@
#include <cmsys/SystemTools.hxx>
#include <cm_zlib.h>
#include <libtar/libtar.h>
-#include <memory> // auto_ptr
#include <fcntl.h>
#include <errno.h>
@@ -219,9 +218,8 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
&mydata
};
- // Ok, this libtar is not const safe. for now use auto_ptr hack
+ // Ok, this libtar is not const safe. Make a non-const copy of outFileName
char* realName = new char[ strlen(outFileName) + 1 ];
- std::auto_ptr<char> realNamePtr(realName);
strcpy(realName, outFileName);
int flags = O_WRONLY | O_CREAT;
int options = 0;
@@ -239,6 +237,7 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): "
<< strerror(errno) << std::endl);
+ delete [] realName;
return 0;
}
@@ -257,6 +256,7 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
<< pathname << "\"): "
<< strerror(errno) << std::endl);
tar_close(t);
+ delete [] realName;
return 0;
}
}
@@ -265,6 +265,7 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_append_eof(): "
<< strerror(errno) << std::endl);
tar_close(t);
+ delete [] realName;
return 0;
}
@@ -272,8 +273,10 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
{
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_close(): "
<< strerror(errno) << std::endl);
+ delete [] realName;
return 0;
}
+ delete [] realName;
return 1;
}
diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx
index 7c33d70158..00bb6fa706 100644
--- a/Source/CTest/cmCTestBatchTestHandler.cxx
+++ b/Source/CTest/cmCTestBatchTestHandler.cxx
@@ -25,7 +25,7 @@ cmCTestBatchTestHandler::~cmCTestBatchTestHandler()
void cmCTestBatchTestHandler::RunTests()
{
this->WriteBatchScript();
- //this->SubmitBatchScript();
+ this->SubmitBatchScript();
}
//---------------------------------------------------------
@@ -128,16 +128,16 @@ void cmCTestBatchTestHandler::SubmitBatchScript()
args.push_back(this->Script);
args.push_back("-o");
args.push_back(this->CTest->GetBinaryDir()
- + "/Testing/CTestBatchOutput.txt");
+ + "/Testing/CTestBatch.txt");
sbatch.SetCommand("sbatch");
sbatch.SetCommandArguments(args);
- if(sbatch.StartProcess())
+ /*if(sbatch.StartProcess())
{
//success condition
}
else
{
//fail condition
- }
+ }*/
}
diff --git a/Source/CTest/cmCTestBuildAndTestHandler.cxx b/Source/CTest/cmCTestBuildAndTestHandler.cxx
index 46d9f26016..8a2d65a7b9 100644
--- a/Source/CTest/cmCTestBuildAndTestHandler.cxx
+++ b/Source/CTest/cmCTestBuildAndTestHandler.cxx
@@ -251,7 +251,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
tarIt != this->BuildTargets.end(); ++ tarIt )
{
double remainingTime = 0;
- if (this->Timeout)
+ if (this->Timeout > 0)
{
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
if (remainingTime <= 0)
@@ -376,7 +376,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// how much time is remaining
double remainingTime = 0;
- if (this->Timeout)
+ if (this->Timeout > 0)
{
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
if (remainingTime <= 0)
diff --git a/Source/CTest/cmCTestCoverageHandler.cxx b/Source/CTest/cmCTestCoverageHandler.cxx
index c2135aa625..10768866e4 100644
--- a/Source/CTest/cmCTestCoverageHandler.cxx
+++ b/Source/CTest/cmCTestCoverageHandler.cxx
@@ -677,6 +677,24 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
#endif
//----------------------------------------------------------------------
+bool IsFileInDir(const std::string &infile, const std::string &indir)
+{
+ std::string file = cmSystemTools::CollapseFullPath(infile.c_str());
+ std::string dir = cmSystemTools::CollapseFullPath(indir.c_str());
+
+ if (
+ file.size() > dir.size() &&
+ (fnc(file.substr(0, dir.size())) == fnc(dir)) &&
+ file[dir.size()] == '/'
+ )
+ {
+ return true;
+ }
+
+ return false;
+}
+
+//----------------------------------------------------------------------
int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestCoverageHandlerContainer* cont)
{
@@ -735,16 +753,27 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
" Processing coverage (each . represents one file):" << std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
int file_count = 0;
+
// make sure output from gcov is in English!
cmSystemTools::PutEnv("LC_ALL=POSIX");
+
+ // files is a list of *.da and *.gcda files with coverage data in them.
+ // These are binary files that you give as input to gcov so that it will
+ // give us text output we can analyze to summarize coverage.
+ //
for ( it = files.begin(); it != files.end(); ++ it )
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush);
+
+ // Call gcov to get coverage data for this *.gcda file:
+ //
std::string fileDir = cmSystemTools::GetFilenamePath(it->c_str());
std::string command = "\"" + gcovCommand + "\" -l -o \"" + fileDir
+ "\" \"" + *it + "\"";
+
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
<< std::endl);
+
std::string output = "";
std::string errors = "";
int retVal = 0;
@@ -777,149 +806,151 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
<< output << std::endl
<< "--------------------------------------------------------------"
<< std::endl);
+
std::vector<cmStdString> lines;
std::vector<cmStdString>::iterator line;
-
- // Globals for storing current source file and current gcov file;
cmSystemTools::Split(output.c_str(), lines);
+
for ( line = lines.begin(); line != lines.end(); ++line)
{
std::string sourceFile;
std::string gcovFile;
+
cmCTestLog(this->CTest, DEBUG, "Line: [" << line->c_str() << "]"
<< std::endl);
+
if ( line->size() == 0 )
{
// Ignore empty line; probably style 2
}
else if ( st1re1.find(line->c_str()) )
{
- if ( gcovStyle != 0 )
+ if ( gcovStyle == 0 )
{
- if ( gcovStyle != 1 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 1;
}
+ if ( gcovStyle != 1 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e1"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
actualSourceFile = "";
sourceFile = st1re1.match(2);
}
else if ( st1re2.find(line->c_str() ) )
{
- if ( gcovStyle != 0 )
+ if ( gcovStyle == 0 )
{
- if ( gcovStyle != 1 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 1;
}
+ if ( gcovStyle != 1 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e2"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
gcovFile = st1re2.match(1);
}
else if ( st2re1.find(line->c_str() ) )
{
- if ( gcovStyle != 0 )
+ if ( gcovStyle == 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e3"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
actualSourceFile = "";
sourceFile = st2re1.match(1);
}
else if ( st2re2.find(line->c_str() ) )
{
- if ( gcovStyle != 0 )
+ if ( gcovStyle == 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e4"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
}
else if ( st2re3.find(line->c_str() ) )
{
- if ( gcovStyle != 0 )
+ if ( gcovStyle == 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e5"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
gcovFile = st2re3.match(2);
}
else if ( st2re4.find(line->c_str() ) )
{
- if ( gcovStyle != 0 )
+ if ( gcovStyle == 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e6"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
cmCTestLog(this->CTest, WARNING, "Warning: " << st2re4.match(1)
<< " had unexpected EOF" << std::endl);
}
else if ( st2re5.find(line->c_str() ) )
{
- if ( gcovStyle != 0 )
+ if ( gcovStyle == 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e7"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
cmCTestLog(this->CTest, WARNING, "Warning: Cannot open file: "
<< st2re5.match(1) << std::endl);
}
else if ( st2re6.find(line->c_str() ) )
{
- if ( gcovStyle != 0 )
+ if ( gcovStyle == 0 )
{
- if ( gcovStyle != 2 )
- {
- cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style"
- << std::endl);
- cont->Error ++;
- break;
- }
gcovStyle = 2;
}
+ if ( gcovStyle != 2 )
+ {
+ cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e8"
+ << std::endl);
+ cont->Error ++;
+ break;
+ }
cmCTestLog(this->CTest, WARNING, "Warning: File: " << st2re6.match(1)
<< " is newer than " << st2re6.match(2) << std::endl);
@@ -927,16 +958,24 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
else
{
cmCTestLog(this->CTest, ERROR_MESSAGE,
- "Unknown line: [" << line->c_str() << "]" << std::endl);
+ "Unknown gcov output line: [" << line->c_str() << "]" << std::endl);
cont->Error ++;
//abort();
}
- if ( !gcovFile.empty() && actualSourceFile.size() )
+
+
+ // If the last line of gcov output gave us a valid value for gcovFile,
+ // and we have an actualSourceFile, then insert a (or add to existing)
+ // SingleFileCoverageVector for actualSourceFile:
+ //
+ if ( !gcovFile.empty() && !actualSourceFile.empty() )
{
- cmCTestCoverageHandlerContainer::SingleFileCoverageVector* vec
- = &cont->TotalCoverage[actualSourceFile];
- cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in file: "
+ cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec
+ = cont->TotalCoverage[actualSourceFile];
+
+ cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in gcovFile: "
<< gcovFile << std::endl);
+
std::ifstream ifile(gcovFile.c_str());
if ( ! ifile )
{
@@ -969,41 +1008,45 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
// line
std::string prefix = nl.substr(0, 12);
int cov = atoi(prefix.c_str());
+
// Read the line number starting at the 10th character of the gcov
// output line
std::string lineNumber = nl.substr(10, 5);
+
int lineIdx = atoi(lineNumber.c_str())-1;
if ( lineIdx >= 0 )
{
- while ( vec->size() <=
- static_cast<size_t>(lineIdx) )
+ while ( vec.size() <= static_cast<size_t>(lineIdx) )
{
- vec->push_back(-1);
+ vec.push_back(-1);
}
+
// Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first.
- if ( (*vec)[lineIdx] < 0 )
+ if ( vec[lineIdx] < 0 )
{
if ( cov > 0 || prefix.find("#") != prefix.npos )
{
- (*vec)[lineIdx] = 0;
+ vec[lineIdx] = 0;
}
}
- (*vec)[lineIdx] += cov;
+
+ vec[lineIdx] += cov;
}
}
}
+
actualSourceFile = "";
}
+
+
if ( !sourceFile.empty() && actualSourceFile.empty() )
{
gcovFile = "";
- // Is it in the source dir?
- if ( sourceFile.size() > cont->SourceDir.size() &&
- (fnc(sourceFile.substr(0, cont->SourceDir.size())) ==
- fnc(cont->SourceDir)) &&
- sourceFile[cont->SourceDir.size()] == '/' )
+ // Is it in the source dir or the binary dir?
+ //
+ if ( IsFileInDir(sourceFile, cont->SourceDir) )
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: "
<< sourceFile.c_str() << std::endl);
@@ -1012,12 +1055,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
actualSourceFile
= cmSystemTools::CollapseFullPath(sourceFile.c_str());
}
-
- // Binary dir?
- if ( sourceFile.size() > cont->BinaryDir.size() &&
- (fnc(sourceFile.substr(0, cont->BinaryDir.size())) ==
- fnc(cont->BinaryDir)) &&
- sourceFile[cont->BinaryDir.size()] == '/' )
+ else if ( IsFileInDir(sourceFile, cont->BinaryDir) )
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: "
<< sourceFile.c_str() << std::endl);
@@ -1029,7 +1067,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
if ( actualSourceFile.empty() )
{
- if ( missingFiles.find(actualSourceFile) == missingFiles.end() )
+ if ( missingFiles.find(sourceFile) == missingFiles.end() )
{
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Something went wrong" << std::endl);
@@ -1048,12 +1086,15 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
<< sourceFile.c_str()
<< " in source dir: " << cont->SourceDir.c_str()
<< " or binary dir: " << cont->BinaryDir.c_str() << std::endl;
- missingFiles.insert(actualSourceFile);
+
+ missingFiles.insert(sourceFile);
}
}
}
}
- file_count ++;
+
+ file_count++;
+
if ( file_count % 50 == 0 )
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count
@@ -1061,6 +1102,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
}
}
+
cmSystemTools::ChangeDirectory(currentDirectory.c_str());
return file_count;
}
diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx
index 63dfe7e1cc..024599ce9e 100644
--- a/Source/CTest/cmCTestMultiProcessHandler.cxx
+++ b/Source/CTest/cmCTestMultiProcessHandler.cxx
@@ -81,6 +81,10 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
cmCTestRunTest* testRun = new cmCTestRunTest(this->TestHandler);
testRun->SetIndex(test);
testRun->SetTestProperties(this->Properties[test]);
+
+ std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
+ cmSystemTools::ChangeDirectory(this->Properties[test]->Directory.c_str());
+
if(testRun->StartTest(this->Total))
{
this->RunningTests.insert(testRun);
@@ -92,6 +96,7 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
testRun->EndTest(this->Completed, this->Total, false);
this->Failed->push_back(this->Properties[test]->Name);
}
+ cmSystemTools::ChangeDirectory(current_dir.c_str());
}
//---------------------------------------------------------
@@ -339,6 +344,9 @@ void cmCTestMultiProcessHandler::PrintTestList()
{
count++;
cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
+ //push working dir
+ std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
+ cmSystemTools::ChangeDirectory(p.Directory.c_str());
cmCTestRunTest testRun(this->TestHandler);
testRun.SetIndex(p.Index);
@@ -360,6 +368,8 @@ void cmCTestMultiProcessHandler::PrintTestList()
<< indexStr.str().c_str());
cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl);
+ //pop working dir
+ cmSystemTools::ChangeDirectory(current_dir.c_str());
}
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: "
<< this->Total << std::endl);
diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx
index 982beb340e..3e4757b284 100644
--- a/Source/CTest/cmCTestRunTest.cxx
+++ b/Source/CTest/cmCTestRunTest.cxx
@@ -301,7 +301,7 @@ bool cmCTestRunTest::StartTest(size_t total)
{
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8)
<< "Start "
- << std::setw(getNumWidth(total))
+ << std::setw(getNumWidth(this->TestHandler->GetMaxIndex()))
<< this->TestProperties->Index << ": "
<< this->TestProperties->Name << std::endl);
this->ComputeArguments();
@@ -419,11 +419,11 @@ bool cmCTestRunTest::CreateProcess(double testTimeOut,
// determine how much time we have
double timeout = this->CTest->GetRemainingTimeAllowed() - 120;
- if (this->CTest->GetTimeOut() && this->CTest->GetTimeOut() < timeout)
+ if (this->CTest->GetTimeOut() > 0 && this->CTest->GetTimeOut() < timeout)
{
timeout = this->CTest->GetTimeOut();
}
- if (testTimeOut
+ if (testTimeOut > 0
&& testTimeOut < this->CTest->GetRemainingTimeAllowed())
{
timeout = testTimeOut;
diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index 7bc6f72da9..f19a36dd83 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -16,11 +16,6 @@
#include <QTranslator>
#include <QLocale>
#include "QMacInstallDialog.h"
-
-#ifdef Q_OS_WIN
-#include "windows.h" // for SetErrorMode
-#endif
-
#include "CMakeSetupDialog.h"
#include "cmDocumentation.h"
#include "cmake.h"
@@ -103,10 +98,6 @@ int main(int argc, char** argv)
}
QApplication app(argc, argv);
-#ifdef Q_OS_WIN
- // QApplication changes error mode, let's put it back
- SetErrorMode(0);
-#endif
// clean out standard Qt paths for plugins, which we don't use anyway
// when creating Mac bundles, it potentially causes problems
diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx
index 3bd64f0913..dc31fad446 100644
--- a/Source/QtDialog/QCMake.cxx
+++ b/Source/QtDialog/QCMake.cxx
@@ -20,6 +20,10 @@
#include "cmSystemTools.h"
#include "cmExternalMakefileProjectGenerator.h"
+#ifdef Q_OS_WIN
+#include "qt_windows.h" // For SetErrorMode
+#endif
+
QCMake::QCMake(QObject* p)
: QObject(p)
{
@@ -148,6 +152,10 @@ void QCMake::setGenerator(const QString& gen)
void QCMake::configure()
{
+#ifdef Q_OS_WIN
+ UINT lastErrorMode = SetErrorMode(0);
+#endif
+
this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toAscii().data());
this->CMakeInstance->SetStartDirectory(this->SourceDirectory.toAscii().data());
this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toAscii().data());
@@ -162,14 +170,27 @@ void QCMake::configure()
int err = this->CMakeInstance->Configure();
+#ifdef Q_OS_WIN
+ SetErrorMode(lastErrorMode);
+#endif
+
emit this->propertiesChanged(this->properties());
emit this->configureDone(err);
}
void QCMake::generate()
{
+#ifdef Q_OS_WIN
+ UINT lastErrorMode = SetErrorMode(0);
+#endif
+
cmSystemTools::ResetErrorOccuredFlag();
int err = this->CMakeInstance->Generate();
+
+#ifdef Q_OS_WIN
+ SetErrorMode(lastErrorMode);
+#endif
+
emit this->generateDone(err);
}
diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx
index fa6333f1e1..6d21ab5690 100644
--- a/Source/cmCTest.cxx
+++ b/Source/cmCTest.cxx
@@ -564,6 +564,7 @@ bool cmCTest::UpdateCTestConfiguration()
<< fileName.c_str() << "\n");
// parse the dart test file
std::ifstream fin(fileName.c_str());
+
if(!fin)
{
return false;
@@ -1081,11 +1082,11 @@ int cmCTest::RunTest(std::vector<const char*> argv,
// determine how much time we have
double timeout = this->GetRemainingTimeAllowed() - 120;
- if (this->TimeOut && this->TimeOut < timeout)
+ if (this->TimeOut > 0 && this->TimeOut < timeout)
{
timeout = this->TimeOut;
}
- if (testTimeOut
+ if (testTimeOut > 0
&& testTimeOut < this->GetRemainingTimeAllowed())
{
timeout = testTimeOut;
@@ -1117,7 +1118,7 @@ int cmCTest::RunTest(std::vector<const char*> argv,
// make sure we pass the timeout in for any build and test
// invocations. Since --build-generator is required this is a
// good place to check for it, and to add the arguments in
- if (strcmp(argv[i],"--build-generator") == 0 && timeout)
+ if (strcmp(argv[i],"--build-generator") == 0 && timeout > 0)
{
args.push_back("--test-timeout");
cmOStringStream msg;
@@ -1265,6 +1266,11 @@ void cmCTest::StartXML(std::ostream& ostr, bool append)
<< this->GetCTestConfiguration("Site") << "\"\n\tGenerator=\"ctest-"
<< cmVersion::GetCMakeVersion() << "\"\n"
<< (append? "\tAppend=\"true\"\n":"")
+ << "\tCompilerName=\"" << this->GetCTestConfiguration("Compiler")
+ << "\"\n"
+#ifdef _COMPILER_VERSION
+ << "\tCompilerVersion=\"_COMPILER_VERSION\"\n"
+#endif
<< "\tOSName=\"" << info.GetOSName() << "\"\n"
<< "\tHostname=\"" << info.GetHostname() << "\"\n"
<< "\tOSRelease=\"" << info.GetOSRelease() << "\"\n"
@@ -2363,7 +2369,7 @@ void cmCTest::EmptyCTestConfiguration()
void cmCTest::SetCTestConfiguration(const char *name, const char* value)
{
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "SetCTestConfiguration:"
- << name << ":" << value << "\n");
+ << name << ":" << (value ? value : "(null)") << "\n");
if ( !name )
{
diff --git a/Source/cmCommandArgumentParserHelper.cxx b/Source/cmCommandArgumentParserHelper.cxx
index ace67ec384..234c37e56b 100644
--- a/Source/cmCommandArgumentParserHelper.cxx
+++ b/Source/cmCommandArgumentParserHelper.cxx
@@ -65,7 +65,11 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
if ( !key )
{
return this->ExpandVariable(var);
- }
+ }
+ if(!var)
+ {
+ return this->EmptyVariable;
+ }
if ( strcmp(key, "ENV") == 0 )
{
char *ptr = getenv(var);
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index 4746f06872..dab0c0d1dc 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -317,7 +317,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if ((res==0) && (copyFile.size()))
{
- if(!cmSystemTools::CopyFileAlways(this->OutputFile.c_str(),
+ if(this->OutputFile.empty() ||
+ !cmSystemTools::CopyFileAlways(this->OutputFile.c_str(),
copyFile.c_str()))
{
cmOStringStream emsg;
diff --git a/Source/cmExtraCodeBlocksGenerator.cxx b/Source/cmExtraCodeBlocksGenerator.cxx
index f272262286..4bedea3573 100644
--- a/Source/cmExtraCodeBlocksGenerator.cxx
+++ b/Source/cmExtraCodeBlocksGenerator.cxx
@@ -194,7 +194,7 @@ void Tree::BuildVirtualFolderImpl(std::string& virtualFolders,
{
virtualFolders += "CMake Files\\" + prefix + path + "\\;";
for (std::vector<Tree>::const_iterator it = folders.begin();
- it != folders.end();
+ it != folders.end();
++it)
{
it->BuildVirtualFolderImpl(virtualFolders, prefix + path + "\\");
@@ -263,37 +263,45 @@ void cmExtraCodeBlocksGenerator
it != this->GlobalGenerator->GetProjectMap().end();
++it)
{
- // Convert
- std::vector<std::string> listFiles =
- it->second[0]->GetMakefile()->GetListFiles();
+ // Collect all files
+ std::vector<std::string> listFiles;
+ for (std::vector<cmLocalGenerator *>::const_iterator
+ jt = it->second.begin();
+ jt != it->second.end();
+ ++jt)
+ {
+ const std::vector<std::string> & files =
+ (*jt)->GetMakefile()->GetListFiles();
+ listFiles.insert(listFiles.end(), files.begin(), files.end());
+ }
- for (std::vector<std::string>::const_iterator jt = listFiles.begin();
- jt != listFiles.end();
- ++jt)
- {
- const std::string &relative =
- cmSystemTools::RelativePath(
+ // Convert
+ for (std::vector<std::string>::const_iterator jt = listFiles.begin();
+ jt != listFiles.end();
+ ++jt)
+ {
+ const std::string &relative = cmSystemTools::RelativePath(
it->second[0]->GetMakefile()->GetHomeDirectory(),
jt->c_str());
- std::vector<std::string> splitted;
- cmSystemTools::SplitPath(relative.c_str(), splitted, false);
- // Split filename from path
- std::string fileName = *(splitted.end()-1);
- splitted.erase(splitted.end() - 1, splitted.end());
-
- // We don't want paths with ".." in them
- // reasons are that we don't want files outside the project
- // TODO: the path should be normalized first though
- // We don't want paths with CMakeFiles in them
- // or do we?
- // In speedcrunch those where purely internal
- if (splitted.size() >= 1
- && relative.find("..") == std::string::npos
- && relative.find("CMakeFiles") == std::string::npos)
- {
- tree.InsertPath(splitted, 1, fileName);
- }
- }
+ std::vector<std::string> splitted;
+ cmSystemTools::SplitPath(relative.c_str(), splitted, false);
+ // Split filename from path
+ std::string fileName = *(splitted.end()-1);
+ splitted.erase(splitted.end() - 1, splitted.end());
+
+ // We don't want paths with ".." in them
+ // reasons are that we don't want files outside the project
+ // TODO: the path should be normalized first though
+ // We don't want paths with CMakeFiles in them
+ // or do we?
+ // In speedcrunch those where purely internal
+ if (splitted.size() >= 1
+ && relative.find("..") == std::string::npos
+ && relative.find("CMakeFiles") == std::string::npos)
+ {
+ tree.InsertPath(splitted, 1, fileName);
+ }
+ }
}
// Now build a virtual tree string
@@ -329,68 +337,73 @@ void cmExtraCodeBlocksGenerator
for (cmTargets::iterator ti = targets.begin();
ti != targets.end(); ti++)
{
- switch(ti->second.GetType())
+ switch(ti->second.GetType())
{
- case cmTarget::GLOBAL_TARGET:
+ case cmTarget::GLOBAL_TARGET:
+ {
+ bool insertTarget = false;
+ // Only add the global targets from CMAKE_BINARY_DIR,
+ // not from the subdirs
+ if (strcmp(makefile->GetStartOutputDirectory(),
+ makefile->GetHomeOutputDirectory())==0)
{
- bool insertTarget = false;
- // Only add the global targets from CMAKE_BINARY_DIR,
- // not from the subdirs
- if (strcmp(makefile->GetStartOutputDirectory(),
- makefile->GetHomeOutputDirectory())==0)
+ insertTarget = true;
+ // only add the "edit_cache" target if it's not ccmake, because
+ // this will not work within the IDE
+ if (ti->first == "edit_cache")
{
- insertTarget = true;
- // only add the "edit_cache" target if it's not ccmake, because
- // this will not work within the IDE
- if (ti->first == "edit_cache")
+ const char* editCommand = makefile->GetDefinition
+ ("CMAKE_EDIT_COMMAND");
+ if (editCommand == 0)
{
- if (strstr(makefile->GetRequiredDefinition
- ("CMAKE_EDIT_COMMAND"), "ccmake")!=NULL)
- {
- insertTarget = false;
- }
+ insertTarget = false;
+ }
+ else if (strstr(editCommand, "ccmake")!=NULL)
+ {
+ insertTarget = false;
}
}
- if (insertTarget)
- {
- this->AppendTarget(fout, ti->first.c_str(), 0,
+ }
+ if (insertTarget)
+ {
+ this->AppendTarget(fout, ti->first.c_str(), 0,
make.c_str(), makefile, compiler.c_str());
- }
}
- break;
- case cmTarget::UTILITY:
- // Add all utility targets, except the Nightly/Continuous/
- // Experimental-"sub"targets as e.g. NightlyStart
- if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly"))
+ }
+ break;
+ case cmTarget::UTILITY:
+ // Add all utility targets, except the Nightly/Continuous/
+ // Experimental-"sub"targets as e.g. NightlyStart
+ if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly"))
|| ((ti->first.find("Continuous")==0)&&(ti->first!="Continuous"))
|| ((ti->first.find("Experimental")==0)
&& (ti->first!="Experimental")))
- {
- break;
- }
-
- this->AppendTarget(fout, ti->first.c_str(), 0,
- make.c_str(), makefile, compiler.c_str());
- break;
- case cmTarget::EXECUTABLE:
- case cmTarget::STATIC_LIBRARY:
- case cmTarget::SHARED_LIBRARY:
- case cmTarget::MODULE_LIBRARY:
{
- this->AppendTarget(fout, ti->first.c_str(), &ti->second,
- make.c_str(), makefile, compiler.c_str());
- std::string fastTarget = ti->first;
- fastTarget += "/fast";
- this->AppendTarget(fout, fastTarget.c_str(), &ti->second,
- make.c_str(), makefile, compiler.c_str());
- }
- break;
- // ignore these:
- case cmTarget::INSTALL_FILES:
- case cmTarget::INSTALL_PROGRAMS:
- case cmTarget::INSTALL_DIRECTORY:
- default:
break;
+ }
+
+ this->AppendTarget(fout, ti->first.c_str(), 0,
+ make.c_str(), makefile, compiler.c_str());
+ break;
+ case cmTarget::EXECUTABLE:
+ case cmTarget::STATIC_LIBRARY:
+ case cmTarget::SHARED_LIBRARY:
+ case cmTarget::MODULE_LIBRARY:
+ {
+ this->AppendTarget(fout, ti->first.c_str(), &ti->second,
+ make.c_str(), makefile, compiler.c_str());
+ std::string fastTarget = ti->first;
+ fastTarget += "/fast";
+ this->AppendTarget(fout, fastTarget.c_str(), &ti->second,
+ make.c_str(), makefile, compiler.c_str());
+ }
+ break;
+ // ignore these:
+ case cmTarget::INSTALL_FILES:
+ case cmTarget::INSTALL_PROGRAMS:
+ case cmTarget::INSTALL_DIRECTORY:
+ default:
+ break;
}
}
}
@@ -668,7 +681,7 @@ int cmExtraCodeBlocksGenerator::GetCBTargetType(cmTarget* target)
return 2;
}
else if ((target->GetType()==cmTarget::SHARED_LIBRARY)
- || (target->GetType()==cmTarget::MODULE_LIBRARY))
+ || (target->GetType()==cmTarget::MODULE_LIBRARY))
{
return 3;
}
diff --git a/Source/cmExtraEclipseCDT4Generator.cxx b/Source/cmExtraEclipseCDT4Generator.cxx
index 61be233025..0a5101ff98 100644
--- a/Source/cmExtraEclipseCDT4Generator.cxx
+++ b/Source/cmExtraEclipseCDT4Generator.cxx
@@ -727,8 +727,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// this will not work within the IDE
if (ti->first == "edit_cache")
{
- if (strstr(makefile->GetRequiredDefinition
- ("CMAKE_EDIT_COMMAND"), "ccmake")!=NULL)
+ const char* editCommand = makefile->GetDefinition
+ ("CMAKE_EDIT_COMMAND");
+ if (editCommand == 0)
+ {
+ insertTarget = false;
+ }
+ else if (strstr(editCommand, "ccmake")!=NULL)
{
insertTarget = false;
}
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx
index abe6bc9f62..bce41376e0 100644
--- a/Source/cmFileCommand.cxx
+++ b/Source/cmFileCommand.cxx
@@ -2290,7 +2290,7 @@ bool cmFileCommand::HandleRelativePathCommand(
{
if(args.size() != 4 )
{
- this->SetError("called with incorrect number of arguments");
+ this->SetError("RELATIVE_PATH called with incorrect number of arguments");
return false;
}
@@ -2301,7 +2301,7 @@ bool cmFileCommand::HandleRelativePathCommand(
if(!cmSystemTools::FileIsFullPath(directoryName.c_str()))
{
std::string errstring =
- "RelativePath must be passed a full path to the directory: "
+ "RELATIVE_PATH must be passed a full path to the directory: "
+ directoryName;
this->SetError(errstring.c_str());
return false;
@@ -2309,7 +2309,7 @@ bool cmFileCommand::HandleRelativePathCommand(
if(!cmSystemTools::FileIsFullPath(fileName.c_str()))
{
std::string errstring =
- "RelativePath must be passed a full path to the file: "
+ "RELATIVE_PATH must be passed a full path to the file: "
+ fileName;
this->SetError(errstring.c_str());
return false;
@@ -2328,7 +2328,7 @@ bool cmFileCommand::HandleRename(std::vector<std::string> const& args)
{
if(args.size() != 3)
{
- this->SetError("given incorrect number of arguments.");
+ this->SetError("RENAME given incorrect number of arguments.");
return false;
}
@@ -2400,8 +2400,8 @@ bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string>
std::vector<std::string>::const_iterator i = args.begin();
if(args.size() != 3)
{
- this->SetError("FILE(SYSTEM_PATH ENV result) must be called with "
- "only three arguments.");
+ this->SetError("FILE([TO_CMAKE_PATH|TO_NATIVE_PATH] path result) must be "
+ "called with exactly three arguments.");
return false;
}
i++; // Get rid of subcommand
@@ -2465,17 +2465,48 @@ namespace{
cmFileCommandVectorOfChar *vec
= static_cast<cmFileCommandVectorOfChar*>(data);
vec->insert(vec->end(), chPtr, chPtr + size);
-
+
return size;
}
-
-
+
+
}
#endif
-bool
-cmFileCommand::HandleDownloadCommand(std::vector<std::string>
+#if defined(CMAKE_BUILD_WITH_CMAKE)
+namespace {
+
+ class cURLEasyGuard
+ {
+ public:
+ cURLEasyGuard(CURL * easy)
+ : Easy(easy)
+ {}
+
+ ~cURLEasyGuard(void)
+ {
+ if (this->Easy)
+ {
+ ::curl_easy_cleanup(this->Easy);
+ }
+ }
+
+ inline void release(void)
+ {
+ this->Easy = 0;
+ return;
+ }
+
+ private:
+ ::CURL * Easy;
+ };
+
+}
+#endif
+
+bool
+cmFileCommand::HandleDownloadCommand(std::vector<std::string>
const& args)
{
#if defined(CMAKE_BUILD_WITH_CMAKE)
@@ -2486,25 +2517,25 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
"at least three arguments.");
return false;
}
- i++; // Get rid of subcommand
+ ++i; // Get rid of subcommand
std::string url = *i;
- i++;
+ ++i;
std::string file = *i;
- i++;
- double timeout = 0;
+ ++i;
+ long timeout = 0;
std::string verboseLog;
std::string statusVar;
while(i != args.end())
{
if(*i == "TIMEOUT")
{
- i++;
+ ++i;
if(i != args.end())
{
- timeout = atof(i->c_str());
+ timeout = atol(i->c_str());
}
else
- {
+ {
this->SetError("FILE(DOWNLOAD url file TIMEOUT time) missing "
"time for TIMEOUT.");
return false;
@@ -2512,7 +2543,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
}
else if(*i == "LOG")
{
- i++;
+ ++i;
if( i == args.end())
{
this->SetError("FILE(DOWNLOAD url file LOG VAR) missing "
@@ -2523,7 +2554,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
}
else if(*i == "STATUS")
{
- i++;
+ ++i;
if( i == args.end())
{
this->SetError("FILE(DOWNLOAD url file STATUS VAR) missing "
@@ -2532,15 +2563,16 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
}
statusVar = *i;
}
- i++;
+ ++i;
}
std::string dir = cmSystemTools::GetFilenamePath(file.c_str());
if(!cmSystemTools::FileExists(dir.c_str()) &&
!cmSystemTools::MakeDirectory(dir.c_str()))
{
- std::string errstring = "FILE(DOWNLOAD ) error; cannot create directory: "
- + dir + ". Maybe need administrative privileges.";
+ std::string errstring = "DOWNLOAD error: cannot create directory '"
+ + dir + "' - Specify file by full path name and verify that you "
+ "have directory creation and file write privileges.";
this->SetError(errstring.c_str());
return false;
}
@@ -2552,50 +2584,106 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
"file for write.");
return false;
}
- CURL *curl;
- curl_global_init(CURL_GLOBAL_DEFAULT);
- curl = curl_easy_init();
+ ::CURL *curl;
+ ::curl_global_init(CURL_GLOBAL_DEFAULT);
+ curl = ::curl_easy_init();
if(!curl)
{
this->SetError("FILE(DOWNLOAD ) error "
"initializing curl.");
return false;
}
-
- curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
- curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
- cmFileCommandWriteMemoryCallback);
- curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION,
- cmFileCommandCurlDebugCallback);
+
+ cURLEasyGuard g_curl(curl);
+
+ ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
+ if (res != CURLE_OK)
+ {
+ std::string errstring = "FILE(DOWNLOAD ) error; cannot set url: ";
+ errstring += ::curl_easy_strerror(res);
+ return false;
+ }
+
+ res = ::curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
+ cmFileCommandWriteMemoryCallback);
+ if (res != CURLE_OK)
+ {
+ std::string errstring =
+ "FILE(DOWNLOAD ) error; cannot set write function: ";
+ errstring += ::curl_easy_strerror(res);
+ return false;
+ }
+
+ res = ::curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION,
+ cmFileCommandCurlDebugCallback);
+ if (res != CURLE_OK)
+ {
+ std::string errstring =
+ "FILE(DOWNLOAD ) error; cannot set debug function: ";
+ errstring += ::curl_easy_strerror(res);
+ return false;
+ }
+
cmFileCommandVectorOfChar chunkDebug;
- ::curl_easy_setopt(curl, CURLOPT_FILE, (void *)&fout);
- ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug);
+
+ res = ::curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)&fout);
+
+ if (res != CURLE_OK)
+ {
+ std::string errstring = "FILE(DOWNLOAD ) error; cannot set write data: ";
+ errstring += ::curl_easy_strerror(res);
+ return false;
+ }
+
+ res = ::curl_easy_setopt(curl, CURLOPT_DEBUGDATA, (void *)&chunkDebug);
+ if (res != CURLE_OK)
+ {
+ std::string errstring = "FILE(DOWNLOAD ) error; cannot set write data: ";
+ errstring += ::curl_easy_strerror(res);
+ return false;
+ }
+
if(verboseLog.size())
{
- curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
+ res = ::curl_easy_setopt(curl, CURLOPT_VERBOSE, 1);
+
+ if (res != CURLE_OK)
+ {
+ std::string errstring = "FILE(DOWNLOAD ) error; cannot set verbose: ";
+ errstring += ::curl_easy_strerror(res);
+ return false;
+ }
}
if(timeout > 0)
{
- curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout );
+ res = ::curl_easy_setopt(curl, CURLOPT_TIMEOUT, timeout );
+
+ if (res != CURLE_OK)
+ {
+ std::string errstring = "FILE(DOWNLOAD ) error; cannot set verbose: ";
+ errstring += ::curl_easy_strerror(res);
+ return false;
+ }
}
- CURLcode res = curl_easy_perform(curl);
+ res = ::curl_easy_perform(curl);
/* always cleanup */
- curl_easy_cleanup(curl);
+ g_curl.release();
+ ::curl_easy_cleanup(curl);
if(statusVar.size())
{
cmOStringStream result;
- result << (int)res << ";\"" << curl_easy_strerror(res) << "\"";
- this->Makefile->AddDefinition(statusVar.c_str(),
+ result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
+ this->Makefile->AddDefinition(statusVar.c_str(),
result.str().c_str());
}
- curl_global_cleanup();
+ ::curl_global_cleanup();
if(chunkDebug.size())
{
chunkDebug.push_back(0);
if(CURLE_OPERATION_TIMEOUTED == res)
- {
+ {
std::string output = &*chunkDebug.begin();
-
+
if(verboseLog.size())
{
this->Makefile->AddDefinition(verboseLog.c_str(),
@@ -2607,9 +2695,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
&*chunkDebug.begin());
}
return true;
-#else
+#else
this->SetError("FILE(DOWNLOAD ) "
"not supported in bootstrap cmake ");
return false;
-#endif
+#endif
}
diff --git a/Source/cmFileCommand.h b/Source/cmFileCommand.h
index d7538621af..c6da30125c 100644
--- a/Source/cmFileCommand.h
+++ b/Source/cmFileCommand.h
@@ -152,7 +152,7 @@ public:
"and the second element is a string value for the error. A 0 "
"numeric error means no error in the operation. "
"If TIMEOUT time is specified, the operation will "
- "timeout after time seconds, time can be specified as a float."
+ "timeout after time seconds, time should be specified as an integer."
"\n"
"The file() command also provides COPY and INSTALL signatures:\n"
" file(<COPY|INSTALL> files... DESTINATION <dir>\n"
diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx
index b6ae951ef7..abe66a88f7 100644
--- a/Source/cmGlobalVisualStudio10Generator.cxx
+++ b/Source/cmGlobalVisualStudio10Generator.cxx
@@ -31,13 +31,14 @@ void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf)
void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
{
fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n";
- fout << "# Visual Studio 10\n";
+ fout << "# Visual Studio 2010\n";
}
///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator()
{
- cmLocalGenerator*lg = new cmLocalVisualStudio10Generator;
+ cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator;
+ lg->SetPlatformName(this->PlatformName.c_str());
lg->SetGlobalGenerator(this);
return lg;
}
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.cxx b/Source/cmGlobalVisualStudio10Win64Generator.cxx
new file mode 100644
index 0000000000..0e821c72ab
--- /dev/null
+++ b/Source/cmGlobalVisualStudio10Win64Generator.cxx
@@ -0,0 +1,37 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#include "cmGlobalVisualStudio10Win64Generator.h"
+#include "cmMakefile.h"
+#include "cmake.h"
+
+//----------------------------------------------------------------------------
+cmGlobalVisualStudio10Win64Generator::cmGlobalVisualStudio10Win64Generator()
+{
+ this->PlatformName = "x64";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10Win64Generator
+::GetDocumentation(cmDocumentationEntry& entry) const
+{
+ entry.Name = this->GetName();
+ entry.Brief = "Generates Visual Studio 10 Win64 project files.";
+ entry.Full = "";
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio10Win64Generator::EnableLanguage(
+ std::vector<std::string> const& lang, cmMakefile *mf, bool optional)
+{
+ mf->AddDefinition("CMAKE_FORCE_WIN64", "TRUE");
+ cmGlobalVisualStudio10Generator::EnableLanguage(lang, mf, optional);
+}
diff --git a/Source/cmGlobalVisualStudio10Win64Generator.h b/Source/cmGlobalVisualStudio10Win64Generator.h
new file mode 100644
index 0000000000..51b68c0282
--- /dev/null
+++ b/Source/cmGlobalVisualStudio10Win64Generator.h
@@ -0,0 +1,36 @@
+/*============================================================================
+ CMake - Cross Platform Makefile Generator
+ Copyright 2000-2009 Kitware, Inc., Insight Software Consortium
+
+ Distributed under the OSI-approved BSD License (the "License");
+ see accompanying file Copyright.txt for details.
+
+ This software is distributed WITHOUT ANY WARRANTY; without even the
+ implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ See the License for more information.
+============================================================================*/
+#ifndef cmGlobalVisualStudio10Win64Generator_h
+#define cmGlobalVisualStudio10Win64Generator_h
+
+#include "cmGlobalVisualStudio10Generator.h"
+
+class cmGlobalVisualStudio10Win64Generator :
+ public cmGlobalVisualStudio10Generator
+{
+public:
+ cmGlobalVisualStudio10Win64Generator();
+ static cmGlobalGenerator* New() {
+ return new cmGlobalVisualStudio10Win64Generator; }
+
+ ///! Get the name for the generator.
+ virtual const char* GetName() const {
+ return cmGlobalVisualStudio10Win64Generator::GetActualName();}
+ static const char* GetActualName() {return "Visual Studio 10 Win64";}
+
+ /** Get the documentation entry for this generator. */
+ virtual void GetDocumentation(cmDocumentationEntry& entry) const;
+
+ virtual void EnableLanguage(std::vector<std::string>const& languages,
+ cmMakefile *, bool optional);
+};
+#endif
diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx
index dbe9aed112..ea9065ebfd 100644
--- a/Source/cmGlobalVisualStudio7Generator.cxx
+++ b/Source/cmGlobalVisualStudio7Generator.cxx
@@ -615,13 +615,6 @@ cmGlobalVisualStudio7Generator
}
}
-//----------------------------------------------------------------------------
-bool cmGlobalVisualStudio7Generator::IsRootOnlyTarget(cmTarget* target)
-{
- return (this->cmGlobalVisualStudioGenerator::IsRootOnlyTarget(target) ||
- strcmp(target->GetName(), CMAKE_CHECK_BUILD_SYSTEM_TARGET) == 0);
-}
-
bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
cmTarget* target)
{
diff --git a/Source/cmGlobalVisualStudio7Generator.h b/Source/cmGlobalVisualStudio7Generator.h
index 73302bcc3c..85ba24495d 100644
--- a/Source/cmGlobalVisualStudio7Generator.h
+++ b/Source/cmGlobalVisualStudio7Generator.h
@@ -92,6 +92,10 @@ public:
///! What is the configurations directory variable called?
virtual const char* GetCMakeCFGInitDirectory() { return "$(OutDir)"; }
+ /** Return true if the target project file should have the option
+ LinkLibraryDependencies and link to .sln dependencies. */
+ virtual bool NeedLinkLibraryDependencies(cmTarget&) { return false; }
+
protected:
virtual const char* GetIDEVersion() { return "7.0"; }
@@ -133,7 +137,6 @@ protected:
std::string ConvertToSolutionPath(const char* path);
- virtual bool IsRootOnlyTarget(cmTarget* target);
bool IsPartOfDefaultBuild(const char* project,
cmTarget* target);
std::vector<std::string> Configurations;
diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx
index 1084fa9fc6..8aec865b6c 100644
--- a/Source/cmGlobalVisualStudio8Generator.cxx
+++ b/Source/cmGlobalVisualStudio8Generator.cxx
@@ -110,132 +110,123 @@ std::string cmGlobalVisualStudio8Generator::GetUserMacrosRegKeyBase()
}
//----------------------------------------------------------------------------
-void cmGlobalVisualStudio8Generator::Generate()
+void cmGlobalVisualStudio8Generator::AddCheckTarget()
{
// Add a special target on which all other targets depend that
// checks the build system and optionally re-runs CMake.
const char* no_working_directory = 0;
std::vector<std::string> no_depends;
- std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it;
- for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it)
- {
- std::vector<cmLocalGenerator*>& generators = it->second;
- if(!generators.empty())
- {
- // Add the build-system check target to the first local
- // generator of this project.
- cmLocalVisualStudio7Generator* lg =
- static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
- cmMakefile* mf = lg->GetMakefile();
+ std::vector<cmLocalGenerator*> const& generators = this->LocalGenerators;
+ cmLocalVisualStudio7Generator* lg =
+ static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
+ cmMakefile* mf = lg->GetMakefile();
- // Skip the target if no regeneration is to be done.
- if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
- {
- continue;
- }
+ // Skip the target if no regeneration is to be done.
+ if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
+ {
+ return;
+ }
- std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
- cmCustomCommandLines noCommandLines;
- mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
- no_working_directory, no_depends,
- noCommandLines);
- cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET);
- if(!tgt)
- {
- cmSystemTools::Error("Error adding target "
- CMAKE_CHECK_BUILD_SYSTEM_TARGET);
- continue;
- }
+ std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
+ cmCustomCommandLines noCommandLines;
+ cmTarget* tgt =
+ mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
+ no_working_directory, no_depends,
+ noCommandLines);
- // Create a list of all stamp files for this project.
- std::vector<std::string> stamps;
- std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();
- stampList += "generate.stamp.list";
- {
- std::string stampListFile =
- generators[0]->GetMakefile()->GetCurrentOutputDirectory();
- stampListFile += "/";
- stampListFile += stampList;
- std::string stampFile;
- cmGeneratedFileStream fout(stampListFile.c_str());
- for(std::vector<cmLocalGenerator*>::const_iterator
- gi = generators.begin(); gi != generators.end(); ++gi)
- {
- stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory();
- stampFile += "/";
- stampFile += cmake::GetCMakeFilesDirectoryPostSlash();
- stampFile += "generate.stamp";
- stampFile = generators[0]->Convert(stampFile.c_str(),
- cmLocalGenerator::START_OUTPUT);
- fout << stampFile << "\n";
- stamps.push_back(stampFile);
- }
- }
+ // Create a list of all stamp files for this project.
+ std::vector<std::string> stamps;
+ std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();
+ stampList += "generate.stamp.list";
+ {
+ std::string stampListFile =
+ generators[0]->GetMakefile()->GetCurrentOutputDirectory();
+ stampListFile += "/";
+ stampListFile += stampList;
+ std::string stampFile;
+ cmGeneratedFileStream fout(stampListFile.c_str());
+ for(std::vector<cmLocalGenerator*>::const_iterator
+ gi = generators.begin(); gi != generators.end(); ++gi)
+ {
+ stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory();
+ stampFile += "/";
+ stampFile += cmake::GetCMakeFilesDirectoryPostSlash();
+ stampFile += "generate.stamp";
+ stampFile = generators[0]->Convert(stampFile.c_str(),
+ cmLocalGenerator::START_OUTPUT);
+ fout << stampFile << "\n";
+ stamps.push_back(stampFile);
+ }
+ }
- // Add a custom rule to re-run CMake if any input files changed.
- {
- // Collect the input files used to generate all targets in this
- // project.
- std::vector<std::string> listFiles;
- for(unsigned int j = 0; j < generators.size(); ++j)
- {
- cmMakefile* lmf = generators[j]->GetMakefile();
- listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(),
- lmf->GetListFiles().end());
- }
- // Sort the list of input files and remove duplicates.
- std::sort(listFiles.begin(), listFiles.end(),
- std::less<std::string>());
- std::vector<std::string>::iterator new_end =
- std::unique(listFiles.begin(), listFiles.end());
- listFiles.erase(new_end, listFiles.end());
+ // Add a custom rule to re-run CMake if any input files changed.
+ {
+ // Collect the input files used to generate all targets in this
+ // project.
+ std::vector<std::string> listFiles;
+ for(unsigned int j = 0; j < generators.size(); ++j)
+ {
+ cmMakefile* lmf = generators[j]->GetMakefile();
+ listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(),
+ lmf->GetListFiles().end());
+ }
+ // Sort the list of input files and remove duplicates.
+ std::sort(listFiles.begin(), listFiles.end(),
+ std::less<std::string>());
+ std::vector<std::string>::iterator new_end =
+ std::unique(listFiles.begin(), listFiles.end());
+ listFiles.erase(new_end, listFiles.end());
- // Create a rule to re-run CMake.
- std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash();
- stampName += "generate.stamp";
- const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND");
- cmCustomCommandLine commandLine;
- commandLine.push_back(dsprule);
- std::string argH = "-H";
- argH += lg->Convert(mf->GetHomeDirectory(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED, true);
- commandLine.push_back(argH);
- std::string argB = "-B";
- argB += lg->Convert(mf->GetHomeOutputDirectory(),
- cmLocalGenerator::START_OUTPUT,
- cmLocalGenerator::UNCHANGED, true);
- commandLine.push_back(argB);
- commandLine.push_back("--check-stamp-list");
- commandLine.push_back(stampList.c_str());
- commandLine.push_back("--vs-solution-file");
- commandLine.push_back("\"$(SolutionPath)\"");
- cmCustomCommandLines commandLines;
- commandLines.push_back(commandLine);
+ // Create a rule to re-run CMake.
+ std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash();
+ stampName += "generate.stamp";
+ const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND");
+ cmCustomCommandLine commandLine;
+ commandLine.push_back(dsprule);
+ std::string argH = "-H";
+ argH += lg->Convert(mf->GetHomeDirectory(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED, true);
+ commandLine.push_back(argH);
+ std::string argB = "-B";
+ argB += lg->Convert(mf->GetHomeOutputDirectory(),
+ cmLocalGenerator::START_OUTPUT,
+ cmLocalGenerator::UNCHANGED, true);
+ commandLine.push_back(argB);
+ commandLine.push_back("--check-stamp-list");
+ commandLine.push_back(stampList.c_str());
+ commandLine.push_back("--vs-solution-file");
+ commandLine.push_back("\"$(SolutionPath)\"");
+ cmCustomCommandLines commandLines;
+ commandLines.push_back(commandLine);
- // Add the rule. Note that we cannot use the CMakeLists.txt
- // file as the main dependency because it would get
- // overwritten by the CreateVCProjBuildRule.
- // (this could be avoided with per-target source files)
- const char* no_main_dependency = 0;
- const char* no_working_directory = 0;
- mf->AddCustomCommandToOutput(
- stamps, listFiles,
- no_main_dependency, commandLines, "Checking Build System",
- no_working_directory, true);
- std::string ruleName = stamps[0];
- ruleName += ".rule";
- if(cmSourceFile* file = mf->GetSource(ruleName.c_str()))
- {
- tgt->AddSourceFile(file);
- }
- else
- {
- cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
- }
- }
- }
+ // Add the rule. Note that we cannot use the CMakeLists.txt
+ // file as the main dependency because it would get
+ // overwritten by the CreateVCProjBuildRule.
+ // (this could be avoided with per-target source files)
+ const char* no_main_dependency = 0;
+ const char* no_working_directory = 0;
+ mf->AddCustomCommandToOutput(
+ stamps, listFiles,
+ no_main_dependency, commandLines, "Checking Build System",
+ no_working_directory, true);
+ std::string ruleName = stamps[0];
+ ruleName += ".rule";
+ if(cmSourceFile* file = mf->GetSource(ruleName.c_str()))
+ {
+ tgt->AddSourceFile(file);
}
+ else
+ {
+ cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
+ }
+ }
+}
+
+//----------------------------------------------------------------------------
+void cmGlobalVisualStudio8Generator::Generate()
+{
+ this->AddCheckTarget();
// All targets depend on the build-system check target.
for(std::map<cmStdString,cmTarget *>::const_iterator
@@ -290,6 +281,29 @@ cmGlobalVisualStudio8Generator
}
//----------------------------------------------------------------------------
+bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
+ cmTarget& target)
+{
+ // Look for utility dependencies that magically link.
+ for(std::set<cmStdString>::const_iterator ui =
+ target.GetUtilities().begin();
+ ui != target.GetUtilities().end(); ++ui)
+ {
+ if(cmTarget* depTarget = this->FindTarget(0, ui->c_str()))
+ {
+ if(depTarget->GetProperty("EXTERNAL_MSPROJECT"))
+ {
+ // This utility dependency names an external .vcproj target.
+ // We use LinkLibraryDependencies="true" to link to it without
+ // predicting the .lib file location or name.
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
+//----------------------------------------------------------------------------
static cmVS7FlagTable cmVS8ExtraFlagTable[] =
{
{"CallingConvention", "Gd", "cdecl", "0", 0 },
diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h
index 4313b58ca3..9d836bda3c 100644
--- a/Source/cmGlobalVisualStudio8Generator.h
+++ b/Source/cmGlobalVisualStudio8Generator.h
@@ -38,6 +38,8 @@ public:
///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator();
+ std::string const& GetPlatformName() const { return this->PlatformName; }
+
/**
* Override Configure and Generate to add the build-system check
* target.
@@ -58,11 +60,17 @@ public:
*/
virtual std::string GetUserMacrosRegKeyBase();
+ /** Return true if the target project file should have the option
+ LinkLibraryDependencies and link to .sln dependencies. */
+ virtual bool NeedLinkLibraryDependencies(cmTarget& target);
+
protected:
virtual const char* GetIDEVersion() { return "8.0"; }
virtual bool VSLinksDependencies() const { return false; }
+ void AddCheckTarget();
+
static cmIDEFlagTable const* GetExtraFlagTableVS8();
virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual void WriteSLNHeader(std::ostream& fout);
diff --git a/Source/cmGlobalVisualStudioGenerator.h b/Source/cmGlobalVisualStudioGenerator.h
index d799485c89..0c7cf7fedf 100644
--- a/Source/cmGlobalVisualStudioGenerator.h
+++ b/Source/cmGlobalVisualStudioGenerator.h
@@ -88,10 +88,11 @@ protected:
virtual void GetTargetSets(TargetDependSet& projectTargets,
TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const&);
+
+ bool CheckTargetLinks(cmTarget& target, const char* name);
private:
void FixUtilityDependsForTarget(cmTarget& target);
void CreateUtilityDependTarget(cmTarget& target);
- bool CheckTargetLinks(cmTarget& target, const char* name);
};
#endif
diff --git a/Source/cmGlobalXCodeGenerator.cxx b/Source/cmGlobalXCodeGenerator.cxx
index d2c75b2d6c..7b27f3b75a 100644
--- a/Source/cmGlobalXCodeGenerator.cxx
+++ b/Source/cmGlobalXCodeGenerator.cxx
@@ -655,6 +655,10 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
{
sourcecode += ".c.c";
}
+ else if(lang && strcmp(lang, "Fortran") == 0)
+ {
+ sourcecode += ".fortran.f90";
+ }
else if(ext == "png" || ext == "gif" || ext == "jpg")
{
sourcecode = "image";
@@ -1833,25 +1837,25 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// VERSION -> current_version
target.GetTargetVersion(false, major, minor, patch);
- if(major == 0 && minor == 0 && patch == 0)
+ cmOStringStream v;
+
+ // Xcode always wants at least 1.0.0 or nothing
+ if(!(major == 0 && minor == 0 && patch == 0))
{
- // Xcode always wants at least 1.0.0
- major = 1;
+ v << major << "." << minor << "." << patch;
}
- cmOStringStream v;
- v << major << "." << minor << "." << patch;
buildSettings->AddAttribute("DYLIB_CURRENT_VERSION",
this->CreateString(v.str().c_str()));
// SOVERSION -> compatibility_version
target.GetTargetVersion(true, major, minor, patch);
- if(major == 0 && minor == 0 && patch == 0)
+ cmOStringStream vso;
+
+ // Xcode always wants at least 1.0.0 or nothing
+ if(!(major == 0 && minor == 0 && patch == 0))
{
- // Xcode always wants at least 1.0.0
- major = 1;
+ vso << major << "." << minor << "." << patch;
}
- cmOStringStream vso;
- vso << major << "." << minor << "." << patch;
buildSettings->AddAttribute("DYLIB_COMPATIBILITY_VERSION",
this->CreateString(vso.str().c_str()));
}
diff --git a/Source/cmIfCommand.cxx b/Source/cmIfCommand.cxx
index b51fabbd80..76bbd0c29d 100644
--- a/Source/cmIfCommand.cxx
+++ b/Source/cmIfCommand.cxx
@@ -16,6 +16,22 @@
#include <list>
#include <cmsys/RegularExpression.hxx>
+
+static std::string cmIfCommandError(
+ cmMakefile* mf, std::vector<std::string> const& args)
+{
+ cmLocalGenerator* lg = mf->GetLocalGenerator();
+ std::string err = "given arguments:\n ";
+ for(std::vector<std::string>::const_iterator i = args.begin();
+ i != args.end(); ++i)
+ {
+ err += " ";
+ err += lg->EscapeForCMake(i->c_str());
+ }
+ err += "\n";
+ return err;
+}
+
//=========================================================================
bool cmIfFunctionBlocker::
IsFunctionBlocked(const cmListFileFunction& lff,
@@ -85,16 +101,7 @@ IsFunctionBlocked(const cmListFileFunction& lff,
if (errorString.size())
{
- std::string err = "given arguments\n ";
- unsigned int i;
- for(i =0; i < this->Functions[c].Arguments.size(); ++i)
- {
- err += (this->Functions[c].Arguments[i].Quoted?"\"":"");
- err += this->Functions[c].Arguments[i].Value;
- err += (this->Functions[c].Arguments[i].Quoted?"\"":"");
- err += " ";
- }
- err += "\n";
+ std::string err = cmIfCommandError(&mf, expandedArguments);
err += errorString;
mf.IssueMessage(messType, err);
if (messType == cmake::FATAL_ERROR)
@@ -175,16 +182,7 @@ bool cmIfCommand
if (errorString.size())
{
- std::string err = "given arguments\n ";
- unsigned int i;
- for(i =0; i < args.size(); ++i)
- {
- err += (args[i].Quoted?"\"":"");
- err += args[i].Value;
- err += (args[i].Quoted?"\"":"");
- err += " ";
- }
- err += "\n";
+ std::string err = cmIfCommandError(this->Makefile, expandedArguments);
err += errorString;
if (status == cmake::FATAL_ERROR)
{
@@ -215,84 +213,69 @@ bool cmIfCommand
namespace
{
//=========================================================================
- // returns true if succesfull, the resulting bool parsed is stored in result
- bool GetBooleanValue(std::string &newArg,
- cmMakefile *makefile,
- bool &result,
- std::string &errorString,
- cmPolicies::PolicyStatus Policy12Status,
- cmake::MessageType &status)
+ bool GetBooleanValue(std::string& arg, cmMakefile* mf)
{
- if (Policy12Status != cmPolicies::OLD &&
- Policy12Status != cmPolicies::WARN)
- {
- // please note IsOn(var) does not always equal !IsOff(var)
- // that is why each is called
- if (cmSystemTools::IsOn(newArg.c_str()))
- {
- result = true;
- return true;
- }
- if (cmSystemTools::IsOff(newArg.c_str()))
- {
- result = false;
- return true;
- }
- return false;
- }
-
- // Old policy is more complex...
- // 0 and 1 are very common, test for them first quickly
- if (newArg == "0")
+ // Check basic constants.
+ if (arg == "0")
{
- result = false;
- return true;
+ return false;
}
- if (newArg == "1")
+ if (arg == "1")
{
- result = true;
- return true;
+ return true;
}
- // old behavior is to dereference the var
- if (Policy12Status == cmPolicies::OLD)
+ // Check named constants.
+ if (cmSystemTools::IsOn(arg.c_str()))
{
- return false;
+ return true;
+ }
+ if (cmSystemTools::IsOff(arg.c_str()))
+ {
+ return false;
}
- // now test for values that may be the name of a variable
- // warn if used
- if (cmSystemTools::IsOn(newArg.c_str()))
+ // Check for numbers.
+ if(!arg.empty())
+ {
+ char* end;
+ double d = strtod(arg.c_str(), &end);
+ if(*end == '\0')
{
- // only warn if the value would change
- const char *def = makefile->GetDefinition(newArg.c_str());
- if (cmSystemTools::IsOff(def))
- {
- cmPolicies* policies = makefile->GetPolicies();
- errorString = "A variable or argument named \""
- + newArg
- + "\" appears in a conditional statement. "
- + policies->GetPolicyWarning(cmPolicies::CMP0012);
- status = cmake::AUTHOR_WARNING;
- }
- return false;
+ // The whole string is a number. Use C conversion to bool.
+ return d? true:false;
}
- if (cmSystemTools::IsOff(newArg.c_str()))
+ }
+
+ // Check definition.
+ const char* def = mf->GetDefinition(arg.c_str());
+ return !cmSystemTools::IsOff(def);
+ }
+
+ //=========================================================================
+ // Boolean value behavior from CMake 2.6.4 and below.
+ bool GetBooleanValueOld(std::string const& arg, cmMakefile* mf, bool one)
+ {
+ if(one)
+ {
+ // Old IsTrue behavior for single argument.
+ if(arg == "0")
+ { return false; }
+ else if(arg == "1")
+ { return true; }
+ else
+ { return !cmSystemTools::IsOff(mf->GetDefinition(arg.c_str())); }
+ }
+ else
+ {
+ // Old GetVariableOrNumber behavior.
+ const char* def = mf->GetDefinition(arg.c_str());
+ if(!def && atoi(arg.c_str()))
{
- // only warn if the value would change
- const char *def = makefile->GetDefinition(newArg.c_str());
- if (!cmSystemTools::IsOff(def))
- {
- cmPolicies* policies = makefile->GetPolicies();
- errorString = "A variable or argument named \""
- + newArg
- + "\" appears in a conditional statement. "
- + policies->GetPolicyWarning(cmPolicies::CMP0012);
- status = cmake::AUTHOR_WARNING;
- }
- return false;
+ def = arg.c_str();
}
- return false;
+ return !cmSystemTools::IsOff(def);
+ }
}
//=========================================================================
@@ -302,16 +285,50 @@ namespace
cmMakefile *makefile,
std::string &errorString,
cmPolicies::PolicyStatus Policy12Status,
- cmake::MessageType &status)
+ cmake::MessageType &status,
+ bool oneArg = false)
{
- bool result = false;
- if (GetBooleanValue(newArg, makefile, result,
- errorString, Policy12Status, status))
+ // Use the policy if it is set.
+ if (Policy12Status == cmPolicies::NEW)
{
- return result;
+ return GetBooleanValue(newArg, makefile);
}
- const char *def = makefile->GetDefinition(newArg.c_str());
- return !cmSystemTools::IsOff(def);
+ else if (Policy12Status == cmPolicies::OLD)
+ {
+ return GetBooleanValueOld(newArg, makefile, oneArg);
+ }
+
+ // Check policy only if old and new results differ.
+ bool newResult = GetBooleanValue(newArg, makefile);
+ bool oldResult = GetBooleanValueOld(newArg, makefile, oneArg);
+ if(newResult != oldResult)
+ {
+ switch(Policy12Status)
+ {
+ case cmPolicies::WARN:
+ {
+ cmPolicies* policies = makefile->GetPolicies();
+ errorString = "An argument named \"" + newArg
+ + "\" appears in a conditional statement. "
+ + policies->GetPolicyWarning(cmPolicies::CMP0012);
+ status = cmake::AUTHOR_WARNING;
+ }
+ case cmPolicies::OLD:
+ return oldResult;
+ case cmPolicies::REQUIRED_IF_USED:
+ case cmPolicies::REQUIRED_ALWAYS:
+ {
+ cmPolicies* policies = makefile->GetPolicies();
+ errorString = "An argument named \"" + newArg
+ + "\" appears in a conditional statement. "
+ + policies->GetRequiredPolicyError(cmPolicies::CMP0012);
+ status = cmake::FATAL_ERROR;
+ }
+ case cmPolicies::NEW:
+ break;
+ }
+ }
+ return newResult;
}
//=========================================================================
@@ -893,7 +910,7 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
makefile,
errorString,
Policy12Status,
- status);
+ status, true);
}
//=========================================================================
diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h
index 90d144793f..74692b7d9a 100644
--- a/Source/cmIfCommand.h
+++ b/Source/cmIfCommand.h
@@ -121,16 +121,24 @@ public:
"Then any EQUAL, LESS, GREATER, STRLESS, STRGREATER, STREQUAL, MATCHES "
"will be evaluated. Then NOT operators and finally AND, OR operators "
"will be evaluated. Possible expressions are:\n"
- " if(variable)\n"
- "True if the variable's value is not empty, 0, N, NO, OFF, FALSE, "
- "NOTFOUND, or <variable>-NOTFOUND.\n"
- " if(NOT variable)\n"
- "True if the variable's value is empty, 0, N, NO, OFF, FALSE, "
- "NOTFOUND, or <variable>-NOTFOUND.\n"
- " if(variable1 AND variable2)\n"
- "True if both variables would be considered true individually.\n"
- " if(variable1 OR variable2)\n"
- "True if either variable would be considered true individually.\n"
+ " if(<constant>)\n"
+ "True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number. "
+ "False if the constant is 0, OFF, NO, FALSE, N, IGNORE, \"\", "
+ "or ends in the suffix '-NOTFOUND'. "
+ "Named boolean constants are case-insensitive."
+ "\n"
+ " if(<variable>)\n"
+ "True if the variable's value is not a false constant."
+ "\n"
+ " if(NOT <expression>)\n"
+ "True if the expression is not true."
+ "\n"
+ " if(<expr1> AND <expr2>)\n"
+ "True if both expressions would be considered true individually."
+ "\n"
+ " if(<expr1> OR <expr2>)\n"
+ "True if either expression would be considered true individually."
+ "\n"
" if(COMMAND command-name)\n"
"True if the given name is a command, macro or function that can be "
"invoked.\n"
diff --git a/Source/cmLocalVisualStudio10Generator.cxx b/Source/cmLocalVisualStudio10Generator.cxx
index 382192e059..8df0ffaff1 100644
--- a/Source/cmLocalVisualStudio10Generator.cxx
+++ b/Source/cmLocalVisualStudio10Generator.cxx
@@ -13,7 +13,7 @@
#include "cmTarget.h"
#include "cmMakefile.h"
#include "cmVisualStudio10TargetGenerator.h"
-#include "cmGlobalVisualStudio7Generator.h"
+#include "cmGlobalVisualStudio10Generator.h"
#include <cm_expat.h>
#include "cmXMLParser.h"
class cmVS10XMLParser : public cmXMLParser
@@ -93,9 +93,9 @@ void cmLocalVisualStudio10Generator::Generate()
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{
- cmVisualStudio10TargetGenerator tg(&l->second,
- (cmGlobalVisualStudio7Generator*)
- this->GetGlobalGenerator());
+ cmVisualStudio10TargetGenerator tg(
+ &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
+ this->GetGlobalGenerator()));
tg.Generate();
}
this->WriteStampFiles();
diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx
index 8639adb105..2084808916 100644
--- a/Source/cmLocalVisualStudio7Generator.cxx
+++ b/Source/cmLocalVisualStudio7Generator.cxx
@@ -588,7 +588,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
std::string flags;
if(strcmp(configType, "10") != 0)
{
- const char* linkLanguage = target.GetLinkerLanguage(configName);
+ const char* linkLanguage = (this->FortranProject? "Fortran":
+ target.GetLinkerLanguage(configName));
if(!linkLanguage)
{
cmSystemTools::Error
@@ -845,6 +846,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
cmTarget &target,
bool isDebug)
{
+ cmGlobalVisualStudio7Generator* gg =
+ static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
std::string temp;
std::string extraLinkOptions;
if(target.GetType() == cmTarget::EXECUTABLE)
@@ -948,6 +951,10 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"" << tool << "\"\n";
+ if(!gg->NeedLinkLibraryDependencies(target))
+ {
+ fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n";
+ }
linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
// Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad.
@@ -1020,6 +1027,10 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
}
fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"" << tool << "\"\n";
+ if(!gg->NeedLinkLibraryDependencies(target))
+ {
+ fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n";
+ }
linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
// Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad.
diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx
index 0d35b6567a..6b35b5b057 100644
--- a/Source/cmPolicies.cxx
+++ b/Source/cmPolicies.cxx
@@ -358,19 +358,24 @@ cmPolicies::cmPolicies()
this->DefinePolicy(
CMP0012, "CMP0012",
- "The if() command can recognize named boolean constants.",
- "In CMake versions 2.6.4 and lower the only boolean constants were 0 "
- "and 1. Other boolean constants such as true, false, yes, no, "
+ "if() recognizes numbers and boolean constants.",
+ "In CMake versions 2.6.4 and lower the if() command implicitly "
+ "dereferenced arguments corresponding to variables, even those named "
+ "like numbers or boolean constants, except for 0 and 1. "
+ "Numbers and boolean constants such as true, false, yes, no, "
"on, off, y, n, notfound, ignore (all case insensitive) were recognized "
"in some cases but not all. "
"For example, the code \"if(TRUE)\" might have evaluated as false. "
- "In later versions of cmake these values are "
- "treated as boolean constants more consistently and should not be used "
- "as variable names. "
- "The OLD behavior for this policy is to allow variables to have names "
- "such as true and to dereference them. "
- "The NEW behavior for this policy is to treat strings like true as a "
- "boolean constant.",
+ "Numbers such as 2 were recognized only in "
+ "boolean expressions like \"if(NOT 2)\" (leading to false) "
+ "but not as a single-argument like \"if(2)\" (also leading to false). "
+ "Later versions of CMake prefer to treat numbers and boolean constants "
+ "literally, so they should not be used as variable names."
+ "\n"
+ "The OLD behavior for this policy is to implicitly dereference variables "
+ "named like numbers and boolean constants. "
+ "The NEW behavior for this policy is to recognize numbers and "
+ "boolean constants without dereferencing variables with such names.",
2,8,0, cmPolicies::WARN);
this->DefinePolicy(
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index cf808bd4cf..4d1c3fc89b 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -47,7 +47,7 @@ public:
CMP0009, // GLOB_RECURSE should not follow symlinks by default
CMP0010, // Bad variable reference syntax is an error
CMP0011, // Strong policy scope for include and find_package
- CMP0012, // Strong handling of boolean constants
+ CMP0012, // Recognize numbers and boolean constants in if()
CMP0013, // Duplicate binary directories not allowed
CMP0014, // Input directories must have CMakeLists.txt
diff --git a/Source/cmVS10CLFlagTable.h b/Source/cmVS10CLFlagTable.h
index 10f2c9be6d..a7b1b3651a 100644
--- a/Source/cmVS10CLFlagTable.h
+++ b/Source/cmVS10CLFlagTable.h
@@ -102,9 +102,11 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
"Fast", "Fast", 0},
{"PrecompiledHeader", "Yc",
- "Create", "Create", 0},
+ "Create", "Create",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"PrecompiledHeader", "Yu",
- "Use", "Use", 0},
+ "Use", "Use",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"PrecompiledHeader", "",
"Not Using Precompiled Headers", "NotUsing", 0},
@@ -136,7 +138,7 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
{"ErrorReporting", "errorReport:none",
"Do Not Send Report", "None", 0},
{"ErrorReporting", "errorReport:prompt",
- "Prompt Immediatelly", "Prompt", 0},
+ "Prompt Immediately", "Prompt", 0},
{"ErrorReporting", "errorReport:queue",
"Queue For Next Login", "Queue", 0},
{"ErrorReporting", "errorReport:send",
@@ -180,7 +182,7 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
{"FunctionLevelLinking", "Gy", "", "true", 0},
{"FloatingPointExceptions", "fp:except-", "", "false", 0},
{"FloatingPointExceptions", "fp:except", "", "true", 0},
- {"CodeGeneration", "hotpatch", "", "true", 0},
+ {"CreateHotpatchableImage", "hotpatch", "", "true", 0},
{"DisableLanguageExtensions", "Za", "", "true", 0},
{"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0},
{"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0},
@@ -199,14 +201,16 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
{"UseUnicodeForAssemblerListing", "FAu", "", "true", 0},
//Bool Properties With Argument
- {"MultiProcessorCompilation", "MP", "", "true", cmVS7FlagTable::Continue},
+ {"MultiProcessorCompilation", "MP", "", "true",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"ProcessorNumber", "MP", "Multi-processor Compilation", "",
cmVS7FlagTable::UserValueRequired},
{"GenerateXMLDocumentationFiles", "doc", "", "true",
- cmVS7FlagTable::Continue},
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "",
cmVS7FlagTable::UserValueRequired},
- {"BrowseInformation", "FR", "", "true", cmVS7FlagTable::Continue},
+ {"BrowseInformation", "FR", "", "true",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"BrowseInformationFile", "FR", "Enable Browse Information", "",
cmVS7FlagTable::UserValueRequired},
@@ -238,7 +242,15 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
//String Properties
// Skip [TrackerLogDirectory] - no command line Switch.
- // Skip [PrecompiledHeaderFile] - no command line Switch.
+ {"PreprocessOutputPath", "Fi",
+ "Preprocess Output Path",
+ "", cmVS7FlagTable::UserValue},
+ {"PrecompiledHeaderFile", "Yc",
+ "Precompiled Header Name",
+ "", cmVS7FlagTable::UserValueRequired},
+ {"PrecompiledHeaderFile", "Yu",
+ "Precompiled Header Name",
+ "", cmVS7FlagTable::UserValueRequired},
{"PrecompiledHeaderOutputFile", "Fp",
"Precompiled Header Output File",
"", cmVS7FlagTable::UserValue},
diff --git a/Source/cmVS10LinkFlagTable.h b/Source/cmVS10LinkFlagTable.h
index c1f1dda727..c60e8eb207 100644
--- a/Source/cmVS10LinkFlagTable.h
+++ b/Source/cmVS10LinkFlagTable.h
@@ -191,13 +191,16 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] =
{"LinkDLL", "DLL", "", "true", 0},
//Bool Properties With Argument
- {"EnableUAC", "MANIFESTUAC:NO", "", "false", cmVS7FlagTable::Continue},
+ {"EnableUAC", "MANIFESTUAC:NO", "", "false",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"EnableUAC", "MANIFESTUAC:NO", "Enable User Account Control (UAC)", "",
cmVS7FlagTable::UserValueRequired},
- {"EnableUAC", "MANIFESTUAC:", "", "true", cmVS7FlagTable::Continue},
+ {"EnableUAC", "MANIFESTUAC:", "", "true",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "",
cmVS7FlagTable::UserValueRequired},
- {"GenerateMapFile", "MAP", "", "true", cmVS7FlagTable::Continue},
+ {"GenerateMapFile", "MAP", "", "true",
+ cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"MapFileName", "MAP", "Generate Map File", "",
cmVS7FlagTable::UserValueRequired},
diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx
index e7a8784f00..32fceada99 100644
--- a/Source/cmVisualStudio10TargetGenerator.cxx
+++ b/Source/cmVisualStudio10TargetGenerator.cxx
@@ -10,7 +10,7 @@
See the License for more information.
============================================================================*/
#include "cmVisualStudio10TargetGenerator.h"
-#include "cmGlobalVisualStudio7Generator.h"
+#include "cmGlobalVisualStudio10Generator.h"
#include "cmTarget.h"
#include "cmComputeLinkInformation.h"
#include "cmGeneratedFileStream.h"
@@ -22,6 +22,8 @@
#include "cmVS10LinkFlagTable.h"
#include "cmVS10LibFlagTable.h"
+#include <cmsys/auto_ptr.hxx>
+
static std::string cmVS10EscapeXML(std::string arg)
{
cmSystemTools::ReplaceString(arg, "&", "&amp;");
@@ -32,7 +34,7 @@ static std::string cmVS10EscapeXML(std::string arg)
cmVisualStudio10TargetGenerator::
cmVisualStudio10TargetGenerator(cmTarget* target,
- cmGlobalVisualStudio7Generator* gg)
+ cmGlobalVisualStudio10Generator* gg)
{
this->GlobalGenerator = gg;
this->Target = target;
@@ -43,13 +45,18 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->Name = this->Target->GetName();
this->GlobalGenerator->CreateGUID(this->Name.c_str());
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
- this->Platform = "|Win32";
+ this->Platform = gg->GetPlatformName();
this->ComputeObjectNames();
this->BuildFileStream = 0;
}
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
{
+ for(OptionsMap::iterator i = this->ClOptions.begin();
+ i != this->ClOptions.end(); ++i)
+ {
+ delete i->second;
+ }
if(!this->BuildFileStream)
{
return;
@@ -80,7 +87,7 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
(*stream ) << "";
(*stream ) << "<" << tag
<< " Condition=\"'$(Configuration)|$(Platform)'=='";
- (*stream ) << config << this->Platform << "'\"";
+ (*stream ) << config << "|" << this->Platform << "'\"";
if(attribute)
{
(*stream ) << attribute;
@@ -103,6 +110,7 @@ void cmVisualStudio10TargetGenerator::WriteString(const char* line,
(*this->BuildFileStream ) << line;
}
+#define VS10_USER_PROPS "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props"
void cmVisualStudio10TargetGenerator::Generate()
{
@@ -115,6 +123,10 @@ void cmVisualStudio10TargetGenerator::Generate()
this->Target->SetProperty("GENERATOR_FILE_NAME",this->Name.c_str());
this->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
".vcxproj");
+ if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY)
+ {
+ this->ComputeClOptions();
+ }
cmMakefile* mf = this->Target->GetMakefile();
std::string path = mf->GetStartOutputDirectory();
path += "/";
@@ -141,6 +153,8 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<SccProjectName />\n", 2);
this->WriteString("<SccLocalPath />\n", 2);
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
+ this->WriteString("<Platform>", 2);
+ (*this->BuildFileStream) << this->Platform << "</Platform>\n";
this->WriteString("</PropertyGroup>\n", 1);
this->WriteString("<Import Project="
"\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n",
@@ -151,12 +165,9 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<ImportGroup Label=\"ExtensionSettings\">\n", 1);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1);
- this->WriteString("<Import Project="
- "\"$(LocalAppData)\\Microsoft\\VisualStudio\\10.0\\"
- "Microsoft.Cpp.$(Platform).user.props\" "
- "Condition=\"exists('$(LocalAppData)\\Microsoft"
- "\\VisualStudio\\10.0\\"
- "Microsoft.Cpp.$(Platform).user.props')\" />\n", 2);
+ this->WriteString("<Import Project=\"" VS10_USER_PROPS "\""
+ " Condition=\"exists('" VS10_USER_PROPS "')\""
+ " Label=\"LocalAppDataPlatform\" />", 2);
this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
this->WritePathAndIncrementalLinkOptions();
@@ -187,10 +198,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
i != configs->end(); ++i)
{
this->WriteString("<ProjectConfiguration Include=\"", 2);
- (*this->BuildFileStream ) << *i << this->Platform << "\">\n";
+ (*this->BuildFileStream ) << *i << "|" << this->Platform << "\">\n";
this->WriteString("<Configuration>", 3);
(*this->BuildFileStream ) << *i << "</Configuration>\n";
- this->WriteString("<Platform>Win32</Platform>\n", 3);
+ this->WriteString("<Platform>", 3);
+ (*this->BuildFileStream) << this->Platform << "</Platform>\n";
this->WriteString("</ProjectConfiguration>\n", 2);
}
this->WriteString("</ItemGroup>\n", 1);
@@ -236,7 +248,15 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
{
this->WriteString("<UseOfMfc>false</UseOfMfc>\n", 2);
}
- this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
+ if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
+ this->ClOptions[*i]->UsingUnicode())
+ {
+ this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
+ }
+ else
+ {
+ this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
+ }
this->WriteString("</PropertyGroup>\n", 1);
}
}
@@ -375,6 +395,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::vector<cmSourceFile*> clCompile;
std::vector<cmSourceFile*> customBuild;
std::vector<cmSourceFile*> none;
+ std::vector<cmSourceFile*> headers;
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
s != classes.end(); s++)
@@ -384,7 +405,10 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
cmSourceGroup& sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
groupsUsed.insert(&sourceGroup);
- const char* lang = sf->GetLanguage();
+ const char* lang = sf->GetLanguage();
+ bool header = (*s)->GetPropertyAsBool("HEADER_FILE_ONLY")
+ || this->GlobalGenerator->IgnoreFile
+ ((*s)->GetExtension().c_str());
if(!lang)
{
lang = "None";
@@ -397,6 +421,10 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{
customBuild.push_back(sf);
}
+ else if(header)
+ {
+ headers.push_back(sf);
+ }
else
{
none.push_back(sf);
@@ -419,6 +447,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
"developer/msbuild/2003\">\n",
0);
this->WriteGroupSources("ClCompile", clCompile, sourceGroups);
+ this->WriteGroupSources("ClInclude", headers, sourceGroups);
this->WriteGroupSources("CustomBuild", customBuild, sourceGroups);
this->WriteString("<ItemGroup>\n", 1);
@@ -532,13 +561,13 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
{
// if it is not a custom command then add it as a c/c++ file,
// TODO: need to check for idl or rc
- if(!(*source)->GetCustomCommand()
- && !(*source)->GetPropertyAsBool("HEADER_FILE_ONLY")
- && !this->GlobalGenerator->IgnoreFile
- ((*source)->GetExtension().c_str()))
+ if(!(*source)->GetCustomCommand())
{
+ bool header = (*source)->GetPropertyAsBool("HEADER_FILE_ONLY")
+ || this->GlobalGenerator->IgnoreFile
+ ((*source)->GetExtension().c_str());
const char* lang = (*source)->GetLanguage();
- if(lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0))
+ bool cl = lang && (strcmp(lang, "C") == 0 || strcmp(lang, "CXX") ==0);
{
std::string sourceFile = (*source)->GetFullPath();
sourceFile = cmSystemTools::RelativePath(
@@ -546,10 +575,21 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
sourceFile.c_str());
this->ConvertToWindowsSlash(sourceFile);
// output the source file
- this->WriteString("<ClCompile Include=\"", 2);
+ if(header)
+ {
+ this->WriteString("<ClInclude Include=\"", 2);
+ }
+ else if(cl)
+ {
+ this->WriteString("<ClCompile Include=\"", 2);
+ }
+ else
+ {
+ this->WriteString("<None Include=\"", 2);
+ }
(*this->BuildFileStream ) << sourceFile << "\"";
// ouput any flags specific to this source file
- if(this->OutputSourceSpecificFlags(*source))
+ if(cl && this->OutputSourceSpecificFlags(*source))
{
// if the source file has specific flags the tag
// is ended on a new line
@@ -814,21 +854,31 @@ OutputLinkIncremental(std::string const& configName)
<< "</LinkIncremental>\n";
}
+//----------------------------------------------------------------------------
+void cmVisualStudio10TargetGenerator::ComputeClOptions()
+{
+ std::vector<std::string> const* configs =
+ this->GlobalGenerator->GetConfigurations();
+ for(std::vector<std::string>::const_iterator i = configs->begin();
+ i != configs->end(); ++i)
+ {
+ this->ComputeClOptions(*i);
+ }
+}
-void
-cmVisualStudio10TargetGenerator::
-WriteClOptions(std::string const& configName,
- std::vector<std::string> const & includes)
+//----------------------------------------------------------------------------
+void cmVisualStudio10TargetGenerator::ComputeClOptions(
+ std::string const& configName)
{
-
// much of this was copied from here:
// copied from cmLocalVisualStudio7Generator.cxx 805
+ // TODO: Integrate code below with cmLocalVisualStudio7Generator.
+
+ cmsys::auto_ptr<Options> pOptions(
+ new Options(this->LocalGenerator, 10, Options::Compiler,
+ cmVS10CLFlagTable));
+ Options& clOptions = *pOptions;
- this->WriteString("<ClCompile>\n", 2);
- cmVisualStudioGeneratorOptions
- clOptions(this->LocalGenerator,
- 10, cmVisualStudioGeneratorOptions::Compiler,
- cmVS10CLFlagTable);
std::string flags;
// collect up flags for
if(this->Target->GetType() < cmTarget::UTILITY)
@@ -898,6 +948,17 @@ WriteClOptions(std::string const& configName,
{
clOptions.AddDefine(exportMacro);
}
+
+ this->ClOptions[configName] = pOptions.release();
+}
+
+//----------------------------------------------------------------------------
+void cmVisualStudio10TargetGenerator::WriteClOptions(
+ std::string const& configName,
+ std::vector<std::string> const& includes)
+{
+ Options& clOptions = *(this->ClOptions[configName]);
+ this->WriteString("<ClCompile>\n", 2);
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
this->OutputIncludes(includes);
clOptions.OutputFlagMap(*this->BuildFileStream, " ");
@@ -1080,11 +1141,12 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
// first just full path
linkDirs += sep;
linkDirs += *d;
+ sep = ";";
linkDirs += sep;
// next path with configuration type Debug, Release, etc
linkDirs += *d;
linkDirs += "/$(Configuration)";
- sep = ";";
+ linkDirs += sep;
}
linkDirs += "%(AdditionalLibraryDirectories)";
linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str());
@@ -1115,13 +1177,15 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
targetNameImport, targetNamePDB,
config.c_str());
}
- std::string imLib = this->Target->GetDirectory(config.c_str(), true);
- std::string dir = this->Target->GetDirectory(config.c_str(), true);
+
+ std::string dir = this->Target->GetDirectory(config.c_str());
dir += "/";
- imLib += "/";
- imLib += targetNameImport;
std::string pdb = dir;
pdb += targetNamePDB;
+ std::string imLib = this->Target->GetDirectory(config.c_str(), true);
+ imLib += "/";
+ imLib += targetNameImport;
+
linkOptions.AddFlag("ImportLibrary", imLib.c_str());
linkOptions.AddFlag("ProgramDataBaseFileName", pdb.c_str());
linkOptions.Parse(flags.c_str());
@@ -1134,6 +1198,13 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
linkOptions.OutputFlagMap(*this->BuildFileStream, " ");
this->WriteString("</Link>\n", 2);
+ if(!this->GlobalGenerator->NeedLinkLibraryDependencies(*this->Target))
+ {
+ this->WriteString("<ProjectReference>\n", 2);
+ this->WriteString(
+ " <LinkLibraryDependencies>false</LinkLibraryDependencies>\n", 2);
+ this->WriteString("</ProjectReference>\n", 2);
+ }
}
void cmVisualStudio10TargetGenerator::AddLibraries(
diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h
index 127554f9be..989db71a06 100644
--- a/Source/cmVisualStudio10TargetGenerator.h
+++ b/Source/cmVisualStudio10TargetGenerator.h
@@ -16,18 +16,19 @@
class cmTarget;
class cmMakefile;
class cmGeneratedFileStream;
-class cmGlobalVisualStudio7Generator;
+class cmGlobalVisualStudio10Generator;
class cmSourceFile;
class cmCustomCommand;
class cmLocalVisualStudio7Generator;
class cmComputeLinkInformation;
+class cmVisualStudioGeneratorOptions;
#include "cmSourceGroup.h"
class cmVisualStudio10TargetGenerator
{
public:
cmVisualStudio10TargetGenerator(cmTarget* target,
- cmGlobalVisualStudio7Generator* gg);
+ cmGlobalVisualStudio10Generator* gg);
~cmVisualStudio10TargetGenerator();
void Generate();
// used by cmVisualStudioGeneratorOptions
@@ -49,6 +50,8 @@ private:
void WriteObjSources();
void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups();
+ void ComputeClOptions();
+ void ComputeClOptions(std::string const& configName);
void WriteClOptions(std::string const& config,
std::vector<std::string> const & includes);
void WriteRCOptions(std::string const& config,
@@ -75,6 +78,9 @@ private:
std::vector<cmSourceFile*> const& sources,
std::vector<cmSourceGroup>& );
private:
+ typedef cmVisualStudioGeneratorOptions Options;
+ typedef std::map<cmStdString, Options*> OptionsMap;
+ OptionsMap ClOptions;
std::string ModuleDefinitionFile;
std::string PathToVcxproj;
cmTarget* Target;
@@ -82,7 +88,7 @@ private:
std::string Platform;
std::string GUID;
std::string Name;
- cmGlobalVisualStudio7Generator* GlobalGenerator;
+ cmGlobalVisualStudio10Generator* GlobalGenerator;
cmGeneratedFileStream* BuildFileStream;
cmLocalVisualStudio7Generator* LocalGenerator;
std::set<cmSourceFile*> SourcesVisited;
diff --git a/Source/cmake.cxx b/Source/cmake.cxx
index 48a0e83008..a2e4a11302 100644
--- a/Source/cmake.cxx
+++ b/Source/cmake.cxx
@@ -63,6 +63,7 @@
# include "cmGlobalVisualStudio9Generator.h"
# include "cmGlobalVisualStudio9Win64Generator.h"
# include "cmGlobalVisualStudio10Generator.h"
+# include "cmGlobalVisualStudio10Win64Generator.h"
# include "cmGlobalVisualStudio8Win64Generator.h"
# include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h"
@@ -2413,6 +2414,8 @@ void cmake::AddDefaultGenerators()
&cmGlobalVisualStudio7Generator::New;
this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] =
&cmGlobalVisualStudio10Generator::New;
+ this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] =
+ &cmGlobalVisualStudio10Win64Generator::New;
this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
&cmGlobalVisualStudio71Generator::New;
this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] =
diff --git a/Source/cmparseMSBuildXML.py b/Source/cmparseMSBuildXML.py
index 4e3f34e42b..4877e59134 100755
--- a/Source/cmparseMSBuildXML.py
+++ b/Source/cmparseMSBuildXML.py
@@ -3,7 +3,9 @@
# more information see here:
# http://blogs.msdn.com/vcblog/archive/2008/12/16/msbuild-task.aspx
-# cl.xml
+# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/cl.xml"
+# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/lib.xml"
+# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/link.xml"
#
# BoolProperty <Name>true|false</Name>
# simple example:
@@ -215,11 +217,25 @@ class MSBuildToCMake:
def toCMake(self):
toReturn = "static cmVS7FlagTable cmVS10CxxTable[] =\n{\n"
toReturn += "\n //Enum Properties\n"
+ lastProp = {}
for i in self.enumProperties:
+ if i.attributes["Name"] == "CompileAsManaged":
+ #write these out after the rest of the enumProperties
+ lastProp = i
+ continue
for j in i.values:
- toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\", 0},\n"
+ #hardcore Brad King's manual fixes for cmVS10CLFlagTable.h
+ if i.attributes["Name"] == "PrecompiledHeader" and j.attributes["Switch"] != "":
+ toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n"
+ else:
+ #default (normal, non-hardcoded) case
+ toReturn+=" {\""+i.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\", 0},\n"
toReturn += "\n"
+ if lastProp != {}:
+ for j in lastProp.values:
+ toReturn+=" {\""+lastProp.attributes["Name"]+"\", \""+j.attributes["Switch"]+"\",\n \""+j.DisplayName+"\", \""+j.attributes["Name"]+"\", 0},\n"
+ toReturn += "\n"
toReturn += "\n //Bool Properties\n"
for i in self.boolProperties:
@@ -233,10 +249,10 @@ class MSBuildToCMake:
for i in self.boolProperties:
if i.argumentProperty != "":
if i.attributes["ReverseSwitch"] != "":
- toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\", cmVS7FlagTable::Continue},\n"
+ toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \"\", \"false\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n"
toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n"
if i.attributes["Switch"] != "":
- toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\", cmVS7FlagTable::Continue},\n"
+ toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+"\", \"\", \"true\",\n cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},\n"
toReturn += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n"
toReturn += "\n //String List Properties\n"
@@ -249,7 +265,16 @@ class MSBuildToCMake:
toReturn += "\n //String Properties\n"
for i in self.stringProperties:
if i.attributes["Switch"] == "":
- toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n";
+ if i.attributes["Name"] == "PrecompiledHeaderFile":
+ #more hardcoding
+ toReturn += " {\"PrecompiledHeaderFile\", \"Yc\",\n"
+ toReturn += " \"Precompiled Header Name\",\n"
+ toReturn += " \"\", cmVS7FlagTable::UserValueRequired},\n"
+ toReturn += " {\"PrecompiledHeaderFile\", \"Yu\",\n"
+ toReturn += " \"Precompiled Header Name\",\n"
+ toReturn += " \"\", cmVS7FlagTable::UserValueRequired},\n"
+ else:
+ toReturn += " // Skip [" + i.attributes["Name"] + "] - no command line Switch.\n";
else:
toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+i.attributes["Separator"]+"\",\n \""+i.DisplayName+"\",\n \"\", cmVS7FlagTable::UserValue},\n"
diff --git a/Source/kwsys/ProcessUNIX.c b/Source/kwsys/ProcessUNIX.c
index 22135fee07..e2935eb1ea 100644
--- a/Source/kwsys/ProcessUNIX.c
+++ b/Source/kwsys/ProcessUNIX.c
@@ -1921,7 +1921,7 @@ static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
{
/* The first time this is called, we need to calculate the time at
which the child will timeout. */
- if(cp->Timeout && cp->TimeoutTime.tv_sec < 0)
+ if(cp->Timeout > 0 && cp->TimeoutTime.tv_sec < 0)
{
kwsysProcessTime length = kwsysProcessTimeFromDouble(cp->Timeout);
cp->TimeoutTime = kwsysProcessTimeAdd(cp->StartTime, length);
@@ -2710,7 +2710,7 @@ static void kwsysProcessesSignalHandler(int signum
kwsysProcess_ssize_t status=
read(cp->PipeReadEnds[KWSYSPE_PIPE_SIGNAL], &buf, 1);
status=write(cp->SignalPipe, &buf, 1);
-
+ (void)status;
}
}
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 8ed6315933..a6dee1b336 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -3959,7 +3959,20 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
line = "";
long leftToRead = sizeLimit;
-
+
+ // Early short circuit return if stream is no good. Just return
+ // false and the empty line. (Probably means caller tried to
+ // create a file stream with a non-existent file name...)
+ //
+ if(!is)
+ {
+ if(has_newline)
+ {
+ *has_newline = false;
+ }
+ return false;
+ }
+
// If no characters are read from the stream, the end of file has
// been reached. Clear the fail bit just before reading.
while(!haveNewline &&
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt
index d8f83605a0..8714640860 100644
--- a/Tests/BuildDepends/CMakeLists.txt
+++ b/Tests/BuildDepends/CMakeLists.txt
@@ -28,6 +28,12 @@ function(help_xcode_depends)
endif(HELP_XCODE)
endfunction(help_xcode_depends)
+# The Intel compiler causes the MSVC linker to crash during
+# incremental linking, so avoid the /INCREMENTAL:YES flag.
+if(WIN32 AND "${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
+ set(_cmake_options "-DCMAKE_EXE_LINKER_FLAGS=")
+endif()
+
file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project)
message("Creating Project/foo.cxx")
write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx
@@ -49,6 +55,7 @@ try_compile(RESULT
${BuildDepends_BINARY_DIR}/Project
${BuildDepends_SOURCE_DIR}/Project
testRebuild
+ CMAKE_FLAGS ${_cmake_options}
OUTPUT_VARIABLE OUTPUT)
if(HELP_XCODE)
try_compile(RESULT
@@ -63,8 +70,9 @@ if(HELP_XCODE)
OUTPUT_VARIABLE OUTPUT)
endif(HELP_XCODE)
+message("Output from first build:\n${OUTPUT}")
if(NOT RESULT)
- message(SEND_ERROR "Could not build test project: ${OUTPUT}")
+ message(SEND_ERROR "Could not build test project (1)!")
endif(NOT RESULT)
set(bar ${BuildDepends_BINARY_DIR}/Project/bar${CMAKE_EXECUTABLE_SUFFIX})
@@ -130,6 +138,7 @@ try_compile(RESULT
${BuildDepends_BINARY_DIR}/Project
${BuildDepends_SOURCE_DIR}/Project
testRebuild
+ CMAKE_FLAGS ${_cmake_options}
OUTPUT_VARIABLE OUTPUT)
# Xcode is in serious need of help here
@@ -146,8 +155,9 @@ if(HELP_XCODE)
OUTPUT_VARIABLE OUTPUT)
endif(HELP_XCODE)
+message("Output from second build:\n${OUTPUT}")
if(NOT RESULT)
- message(SEND_ERROR "Could not build test project: ${OUTPUT}")
+ message(SEND_ERROR "Could not build test project (2)!")
endif(NOT RESULT)
if(EXISTS
"${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" )
diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt
index f21efd7ad3..357b0c6c57 100644
--- a/Tests/CMakeLists.txt
+++ b/Tests/CMakeLists.txt
@@ -35,6 +35,11 @@ IF(BUILD_TESTING)
"Should the tests that run a full sub ctest process be run?"
OFF)
MARK_AS_ADVANCED(CTEST_TEST_CTEST)
+
+ OPTION(TEST_KDE4_STABLE_BRANCH
+ "Should the KDE4 stable branch test be run?"
+ OFF)
+ MARK_AS_ADVANCED(TEST_KDE4_STABLE_BRANCH)
ENDIF (CMAKE_RUN_LONG_TESTS)
# Should tests that use CVS be run?
@@ -410,14 +415,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
set(CTEST_RUN_CPackComponents ${CTEST_TEST_CPACK})
set(CTEST_package_X11_TEST ${CTEST_TEST_CPACK})
+ find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis
+ PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
+ DOC "makensis program location"
+ )
+
# But on Windows, only run the CPackComponents test if the NSIS
# installer builder is available:
#
if(WIN32)
- find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis
- PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
- DOC "makensis.exe location"
- )
if(NSIS_MAKENSIS_EXECUTABLE)
set(CTEST_RUN_CPackComponents ON)
else(NSIS_MAKENSIS_EXECUTABLE)
@@ -431,6 +437,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
if(APPLE)
set(CPackComponents_EXTRA_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON)
endif(APPLE)
+ if(NSIS_MAKENSIS_EXECUTABLE)
+ set(CPackComponents_EXTRA_OPTIONS ${CPackComponents_EXTRA_OPTIONS}
+ -DCPACK_BINARY_NSIS:BOOL=ON)
+ endif(NSIS_MAKENSIS_EXECUTABLE)
ADD_TEST(CPackComponents ${CMAKE_CTEST_COMMAND}
--build-and-test
@@ -445,12 +455,47 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
-DCPACK_BINARY_DEB:BOOL=${CPACK_BINARY_DEB}
-DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
${CPackComponents_EXTRA_OPTIONS}
+ --graphviz=CPackComponents.dot
--test-command ${CMAKE_CMAKE_COMMAND}
"-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents"
-P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake")
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents")
ENDIF(CTEST_RUN_CPackComponents)
+ # By default, turn this test off (because it takes a long time...)
+ #
+ if(NOT DEFINED CTEST_RUN_CPackTestAllGenerators)
+ set(CTEST_RUN_CPackTestAllGenerators OFF)
+
+ # ...but: if it appears to be a coverage dashboard, or long tests are
+ # on, then set it to the generic CTEST_TEST_CPACK setting.
+ #
+ if(CMAKE_CXX_FLAGS MATCHES "-ftest-coverage" OR
+ NOT "$ENV{COVFILE}" STREQUAL "" OR
+ CMAKE_RUN_LONG_TESTS)
+ set(CTEST_RUN_CPackTestAllGenerators ${CTEST_TEST_CPACK})
+ endif(CMAKE_CXX_FLAGS MATCHES "-ftest-coverage" OR
+ NOT "$ENV{COVFILE}" STREQUAL "" OR
+ CMAKE_RUN_LONG_TESTS)
+ endif(NOT DEFINED CTEST_RUN_CPackTestAllGenerators)
+
+ IF(CTEST_RUN_CPackTestAllGenerators)
+ ADD_TEST(CPackTestAllGenerators ${CMAKE_CTEST_COMMAND}
+ --build-and-test
+ "${CMake_SOURCE_DIR}/Tests/CPackTestAllGenerators"
+ "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators"
+ --build-generator ${CMAKE_TEST_GENERATOR}
+ --build-project CPackTestAllGenerators
+ --build-makeprogram ${CMAKE_TEST_MAKEPROGRAM}
+ --test-command
+ ${CMAKE_CMAKE_COMMAND}
+ -D dir=${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators
+ -D cpack=${CMAKE_CPACK_COMMAND}
+ -P ${CMake_SOURCE_DIR}/Tests/CPackTestAllGenerators/RunCPack.cmake
+ )
+ LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackTestAllGenerators")
+ ENDIF(CTEST_RUN_CPackTestAllGenerators)
+
IF(CTEST_package_X11_TEST)
SET(X11_build_target_arg --build-target package)
ELSE(CTEST_package_X11_TEST)
@@ -469,6 +514,50 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
--test-command UseX11)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11")
+ if(NOT DEFINED CTEST_RUN_CMakeTestAllGenerators)
+ set(CTEST_RUN_CMakeTestAllGenerators ON)
+ endif(NOT DEFINED CTEST_RUN_CMakeTestAllGenerators)
+
+ IF(CTEST_RUN_CMakeTestAllGenerators)
+ ADD_TEST(CMakeTestAllGenerators ${CMAKE_CMAKE_COMMAND}
+ -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators
+ -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
+ -P ${CMake_SOURCE_DIR}/Tests/CMakeTestAllGenerators/RunCMake.cmake
+ )
+ LIST(APPEND TEST_BUILD_DIRS
+ "${CMake_BINARY_DIR}/Tests/CMakeTestAllGenerators")
+ ENDIF(CTEST_RUN_CMakeTestAllGenerators)
+
+ if(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines)
+ set(CTEST_RUN_CMakeTestBadCommandLines ON)
+ endif(NOT DEFINED CTEST_RUN_CMakeTestBadCommandLines)
+
+ IF(CTEST_RUN_CMakeTestBadCommandLines)
+ ADD_TEST(CMakeTestBadCommandLines ${CMAKE_CMAKE_COMMAND}
+ -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines
+ -D gen=${CMAKE_TEST_GENERATOR}
+ -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
+ -P ${CMake_SOURCE_DIR}/Tests/CMakeTestBadCommandLines/RunCMake.cmake
+ )
+ LIST(APPEND TEST_BUILD_DIRS
+ "${CMake_BINARY_DIR}/Tests/CMakeTestBadCommandLines")
+ ENDIF(CTEST_RUN_CMakeTestBadCommandLines)
+
+ if(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures)
+ set(CTEST_RUN_CMakeTestMultipleConfigures ON)
+ endif(NOT DEFINED CTEST_RUN_CMakeTestMultipleConfigures)
+
+ IF(CTEST_RUN_CMakeTestMultipleConfigures)
+ ADD_TEST(CMakeTestMultipleConfigures ${CMAKE_CMAKE_COMMAND}
+ -D dir=${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures
+ -D gen=${CMAKE_TEST_GENERATOR}
+ -D CMake_SOURCE_DIR=${CMake_SOURCE_DIR}
+ -P ${CMake_SOURCE_DIR}/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
+ )
+ LIST(APPEND TEST_BUILD_DIRS
+ "${CMake_BINARY_DIR}/Tests/CMakeTestMultipleConfigures")
+ ENDIF(CTEST_RUN_CMakeTestMultipleConfigures)
+
ADD_TEST(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND}
--build-and-test
"${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig"
@@ -1100,6 +1189,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
)
CONFIGURE_FILE(
+ "${CMake_SOURCE_DIR}/Tests/CTestTestSubdir/test.cmake.in"
+ "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake"
+ @ONLY ESCAPE_QUOTES)
+ ADD_TEST(CTestTestSubdir ${CMAKE_CTEST_COMMAND}
+ -S "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake" -V
+ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/testOutput.log"
+ )
+
+ CONFIGURE_FILE(
"${CMake_SOURCE_DIR}/Tests/CTestTestTimeout/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake"
@ONLY ESCAPE_QUOTES)
@@ -1110,8 +1208,69 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
SET_TESTS_PROPERTIES(CTestTestTimeout PROPERTIES
PASS_REGULAR_EXPRESSION "\\*\\*\\*Timeout")
+ CONFIGURE_FILE(
+ "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/test.cmake"
+ "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake"
+ @ONLY ESCAPE_QUOTES)
+ CONFIGURE_FILE(
+ "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/hello.cmake"
+ "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/hello.cmake"
+ @ONLY ESCAPE_QUOTES)
+ #ADD_TEST(CTestTestRunScript ${CMAKE_CTEST_COMMAND}
+ # -S "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake" -V
+ # --output-log "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/testOutput.log"
+ # )
+
ADD_TEST(CTestTestShowOnly ${CMAKE_CTEST_COMMAND} -N)
+ ADD_TEST(CTestBatchTest ${CMAKE_CTEST_COMMAND} -B)
+
+ # Use macro, not function so that build can still be driven by CMake 2.4.
+ # After 2.6 is required, this could be a function without the extra 'set'
+ # calls.
+ #
+ macro(add_failed_submit_test name source build in out log regex)
+ # Have variables named source, build and drop_method because the
+ # configure_file call expects those variables to be defined.
+ #
+ set(source "${source}")
+ set(build "${build}")
+ configure_file("${in}" "${out}" @ONLY)
+ add_test(${name} ${CMAKE_CTEST_COMMAND} -S "${out}" -V --output-log "${log}")
+ set_tests_properties(${name} PROPERTIES PASS_REGULAR_EXPRESSION "${regex}")
+ endmacro()
+
+ set(regex "(Problems when submitting via S*CP")
+ set(regex "${regex}|Error message was: ")
+ set(regex "${regex}(Couldn.t resolve host ")
+ set(regex "${regex}|couldn.t connect to host")
+ set(regex "${regex}|libcurl was built with SSL disabled. https: not supported)")
+ set(regex "${regex}|Submission method .xmlrpc. not compiled into CTest")
+ set(regex "${regex}|Submission successful)")
+
+ set(ctest_coverage_labels_args "")
+
+ foreach(drop_method cp ftp http https scp xmlrpc)
+ # Cycle through these values each time through the loop:
+ if(ctest_coverage_labels_args STREQUAL "")
+ set(ctest_coverage_labels_args "LABELS Everything")
+ elseif(ctest_coverage_labels_args STREQUAL "LABELS Everything")
+ set(ctest_coverage_labels_args "LABELS 0ArgTest")
+ else()
+ set(ctest_coverage_labels_args "")
+ endif()
+
+ add_failed_submit_test(CTestTestFailedSubmit-${drop_method}
+ "${CMake_SOURCE_DIR}/Tests/CTestTest/SmallAndFast"
+ "${CMake_BINARY_DIR}/Tests/CTestTestFailedSubmits/${drop_method}"
+ "${CMake_SOURCE_DIR}/Tests/CTestTestFailedSubmits/test.cmake.in"
+ "${CMake_BINARY_DIR}/Tests/CTestTestFailedSubmits/test-${drop_method}.cmake"
+ "${CMake_BINARY_DIR}/Tests/CTestTestFailedSubmits/test-${drop_method}.log"
+ "${regex}"
+ )
+ endforeach()
+
+
IF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES)
@@ -1152,6 +1311,43 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
+
+ IF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH)
+ IF(UNIX)
+ IF(NOT QT4_FOUND)
+ FIND_PACKAGE(Qt4)
+ ENDIF(NOT QT4_FOUND)
+
+ SET(TRY_BUILD_KDE4 TRUE)
+ IF(QT4_FOUND)
+ # check whether it's Qt 4.5 in a cmake 2.4. compatible way:
+ IF(NOT EXISTS "${QT_QTNETWORK_INCLUDE_DIR}/QAbstractNetworkCache")
+ SET(TRY_BUILD_KDE4 FALSE)
+ ENDIF(NOT EXISTS "${QT_QTNETWORK_INCLUDE_DIR}/QAbstractNetworkCache")
+ ELSE(QT4_FOUND)
+ SET(TRY_BUILD_KDE4 FALSE)
+ ENDIF(QT4_FOUND)
+
+ FIND_PACKAGE(Perl)
+ IF(NOT PERL_FOUND)
+ SET(TRY_BUILD_KDE4 FALSE)
+ ENDIF(NOT PERL_FOUND)
+
+ FIND_PACKAGE(ZLIB)
+ IF(NOT ZLIB_FOUND)
+ SET(TRY_BUILD_KDE4 FALSE)
+ ENDIF(NOT ZLIB_FOUND)
+
+ IF(TRY_BUILD_KDE4)
+ FILE(MAKE_DIRECTORY ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest)
+ SET(TEST_KDE4_BASE_DIR ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest)
+ CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh.in ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh @ONLY)
+ EXECUTE_PROCESS(COMMAND chmod 755 ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh )
+ ADD_TEST(KDE4StableBranchTest ${CMake_BINARY_DIR}/Tests/KDE4StableBranchTest/test_kde4.sh)
+ ENDIF(TRY_BUILD_KDE4)
+
+ ENDIF(UNIX)
+ ENDIF (CMAKE_RUN_LONG_TESTS AND TEST_KDE4_STABLE_BRANCH)
IF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode)
SET(CMAKE_SKIP_BOOTSTRAP_TEST 1)
diff --git a/Tests/CMakeTestAllGenerators/RunCMake.cmake b/Tests/CMakeTestAllGenerators/RunCMake.cmake
new file mode 100644
index 0000000000..dcf4a23c62
--- /dev/null
+++ b/Tests/CMakeTestAllGenerators/RunCMake.cmake
@@ -0,0 +1,95 @@
+if(NOT DEFINED CMake_SOURCE_DIR)
+ message(FATAL_ERROR "CMake_SOURCE_DIR not defined")
+endif()
+
+if(NOT DEFINED dir)
+ message(FATAL_ERROR "dir not defined")
+endif()
+
+# Analyze 'cmake --help' output for list of available generators:
+#
+execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${dir})
+execute_process(COMMAND ${CMAKE_COMMAND} --help
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ WORKING_DIRECTORY ${dir})
+
+string(REPLACE ";" "\\;" stdout "${stdout}")
+string(REPLACE "\n" "E;" stdout "${stdout}")
+
+set(collecting 0)
+set(generators)
+foreach(eline ${stdout})
+ string(REGEX REPLACE "^(.*)E$" "\\1" line "${eline}")
+ if(collecting AND NOT line STREQUAL "")
+ if(line MATCHES "=")
+ string(REGEX REPLACE "^ (.+)= (.*)$" "\\1" gen "${line}")
+ if(gen MATCHES "[A-Za-z]")
+ string(REGEX REPLACE "^(.*[^ ]) +$" "\\1" gen "${gen}")
+ if(gen)
+ set(generators ${generators} ${gen})
+ endif()
+ endif()
+ else()
+ if(line MATCHES "^ [A-Za-z0-9]")
+ string(REGEX REPLACE "^ (.+)$" "\\1" gen "${line}")
+ string(REGEX REPLACE "^(.*[^ ]) +$" "\\1" gen "${gen}")
+ if(gen)
+ set(generators ${generators} ${gen})
+ endif()
+ endif()
+ endif()
+ endif()
+ if(line STREQUAL "The following generators are available on this platform:")
+ set(collecting 1)
+ endif()
+endforeach()
+
+# Also call with one non-existent generator:
+#
+set(generators ${generators} "BOGUS_CMAKE_GENERATOR")
+
+# Call cmake with -G on each available generator. We do not care if this
+# succeeds or not. We expect it *not* to succeed if the underlying packaging
+# tools are not installed on the system... This test is here simply to add
+# coverage for the various cmake generators, even/especially to test ones
+# where the tools are not installed.
+#
+message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
+
+message(STATUS "CMake generators='${generators}'")
+
+# First setup a source tree to run CMake on.
+#
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${CMake_SOURCE_DIR}/Tests/CTestTest/SmallAndFast
+ ${dir}/Source
+)
+
+foreach(g ${generators})
+ message(STATUS "cmake -G \"${g}\" ..")
+
+ # Create a binary directory for each generator:
+ #
+ execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
+ ${dir}/Source/${g}
+ )
+
+ # Run cmake:
+ #
+ execute_process(COMMAND ${CMAKE_COMMAND} -G ${g} ..
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ WORKING_DIRECTORY ${dir}/Source/${g}
+ )
+
+ message(STATUS "result='${result}'")
+ message(STATUS "stdout='${stdout}'")
+ message(STATUS "stderr='${stderr}'")
+ message(STATUS "")
+endforeach()
+
+message(STATUS "CMake generators='${generators}'")
+message(STATUS "CMAKE_COMMAND='${CMAKE_COMMAND}'")
diff --git a/Tests/CMakeTestBadCommandLines/RunCMake.cmake b/Tests/CMakeTestBadCommandLines/RunCMake.cmake
new file mode 100644
index 0000000000..08549cc5e8
--- /dev/null
+++ b/Tests/CMakeTestBadCommandLines/RunCMake.cmake
@@ -0,0 +1,79 @@
+if(NOT DEFINED CMake_SOURCE_DIR)
+ message(FATAL_ERROR "CMake_SOURCE_DIR not defined")
+endif()
+
+if(NOT DEFINED dir)
+ message(FATAL_ERROR "dir not defined")
+endif()
+
+if(NOT DEFINED gen)
+ message(FATAL_ERROR "gen not defined")
+endif()
+
+message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
+
+# First setup a source tree to run CMake on.
+#
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${CMake_SOURCE_DIR}/Tests/CTestTest/SmallAndFast
+ ${dir}/Source
+)
+
+execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
+ ${dir}/Build
+ )
+
+function(RunCMakeWithArgs)
+ message(STATUS "info: running cmake with ARGN='${ARGN}'")
+
+ execute_process(COMMAND ${CMAKE_COMMAND} ${ARGN}
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ WORKING_DIRECTORY ${dir}/Build
+ )
+
+ message(STATUS "result='${result}'")
+ message(STATUS "stdout='${stdout}'")
+ message(STATUS "stderr='${stderr}'")
+ message(STATUS "")
+endfunction()
+
+# Run cmake once with no errors to get a good build tree:
+#
+RunCMakeWithArgs(-G ${gen} ../Source)
+
+# Run cmake with args that produce some sort of problem to cover the error
+# cases in cmake.cxx...
+#
+# (These are not good examples of cmake command lines. Do not copy and
+# paste them elsewhere and expect them to work... See the cmake
+# documentation or other real examples of usage instead.)
+#
+RunCMakeWithArgs()
+RunCMakeWithArgs(-C)
+RunCMakeWithArgs(-C nosuchcachefile.txt)
+RunCMakeWithArgs(--check-stamp-file nostampfile)
+RunCMakeWithArgs(--check-stamp-list nostamplist)
+RunCMakeWithArgs(nosuchsubdir/CMakeCache.txt)
+RunCMakeWithArgs(nosuchsubdir/CMakeLists.txt)
+RunCMakeWithArgs(-D)
+RunCMakeWithArgs(--debug-output .)
+RunCMakeWithArgs(--debug-trycompile .)
+RunCMakeWithArgs(-E)
+RunCMakeWithArgs(-E create_symlink)
+RunCMakeWithArgs(-E echo_append)
+RunCMakeWithArgs(-E rename)
+RunCMakeWithArgs(-E touch_nocreate)
+RunCMakeWithArgs(-G)
+RunCMakeWithArgs(--graphviz= ../Source)
+RunCMakeWithArgs(--graphviz=g.dot .)
+RunCMakeWithArgs(-P)
+RunCMakeWithArgs(-P nosuchscriptfile.cmake)
+RunCMakeWithArgs(--trace .)
+RunCMakeWithArgs(-U)
+RunCMakeWithArgs(-U nosuchvariable .)
+RunCMakeWithArgs(-V)
+RunCMakeWithArgs(-V .)
+RunCMakeWithArgs(-Wno-dev .)
+RunCMakeWithArgs(-Wdev .)
diff --git a/Tests/CMakeTestMultipleConfigures/RunCMake.cmake b/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
new file mode 100644
index 0000000000..19391d7f18
--- /dev/null
+++ b/Tests/CMakeTestMultipleConfigures/RunCMake.cmake
@@ -0,0 +1,165 @@
+if(NOT DEFINED CMake_SOURCE_DIR)
+ message(FATAL_ERROR "CMake_SOURCE_DIR not defined")
+endif()
+
+if(NOT DEFINED dir)
+ message(FATAL_ERROR "dir not defined")
+endif()
+
+if(NOT DEFINED gen)
+ message(FATAL_ERROR "gen not defined")
+endif()
+
+# Call cmake once to get a baseline/reference output build tree: "Build".
+# Then call cmake N more times, each time making a copy of the entire
+# build tree after cmake is done configuring/generating. At the end,
+# analyze the diffs in the generated build trees. Expect no diffs.
+#
+message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
+
+set(N 7)
+
+# First setup source and binary trees:
+#
+execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory
+ ${dir}/Source
+)
+
+execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory
+ ${dir}/Build
+)
+
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${CMake_SOURCE_DIR}/Tests/CTestTest/SmallAndFast
+ ${dir}/Source
+)
+
+execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory
+ ${dir}/Build
+)
+
+# Patch SmallAndFast to build a .cxx executable too:
+#
+execute_process(COMMAND ${CMAKE_COMMAND} -E copy
+ ${dir}/Source/echoargs.c
+ ${dir}/Source/echoargs.cxx
+)
+file(APPEND "${dir}/Source/CMakeLists.txt" "\nadd_executable(echoargsCXX echoargs.cxx)\n")
+
+# Loop N times, saving a copy of the configured/generated build tree each time:
+#
+foreach(i RANGE 1 ${N})
+ # Equivalent sequence of shell commands:
+ #
+ message(STATUS "${i}: cd Build && cmake -G \"${gen}\" ../Source && cd .. && cp -r Build b${i}")
+
+ # Run cmake:
+ #
+ execute_process(COMMAND ${CMAKE_COMMAND} -G ${gen} ../Source
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ WORKING_DIRECTORY ${dir}/Build
+ )
+
+ message(STATUS "result='${result}'")
+ message(STATUS "stdout='${stdout}'")
+ message(STATUS "stderr='${stderr}'")
+ message(STATUS "")
+
+ # Save this iteration of the Build directory:
+ #
+ execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory
+ ${dir}/b${i}
+ )
+ execute_process(COMMAND ${CMAKE_COMMAND} -E copy_directory
+ ${dir}/Build
+ ${dir}/b${i}
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ )
+
+ message(STATUS "result='${result}'")
+ message(STATUS "stdout='${stdout}'")
+ message(STATUS "stderr='${stderr}'")
+ message(STATUS "")
+endforeach()
+
+
+# Function to analyze diffs between two directories.
+# Set DIFF_EXECUTABLE before calling if 'diff' is available.
+#
+function(analyze_directory_diffs d1 d2 diff_count_var)
+ set(diffs 0)
+
+ message(STATUS "Analyzing directory diffs between:")
+ message(STATUS " d1='${d1}'")
+ message(STATUS " d2='${d2}'")
+
+ if(NOT "${d1}" STREQUAL "" AND NOT "${d2}" STREQUAL "")
+ message(STATUS "info: analyzing directories")
+
+ file(GLOB_RECURSE files1 RELATIVE "${d1}" "${d1}/*")
+ file(GLOB_RECURSE files2 RELATIVE "${d2}" "${d2}/*")
+
+ if("${files1}" STREQUAL "${files2}")
+ message(STATUS "info: file lists the same")
+ #message(STATUS " files='${files1}'")
+
+ foreach(f ${files1})
+ execute_process(COMMAND ${CMAKE_COMMAND} -E compare_files
+ ${d1}/${f}
+ ${d2}/${f}
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ )
+ if(result STREQUAL 0)
+ #message(STATUS "info: file '${f}' the same")
+ else()
+ math(EXPR diffs "${diffs} + 1")
+ message(STATUS "warning: file '${f}' differs from d1 to d2")
+ file(READ "${d1}/${f}" f1contents)
+ message(STATUS "contents of file '${d1}/${f}'
+[===[${f1contents}]===]")
+ file(READ "${d2}/${f}" f2contents)
+ message(STATUS "contents of file '${d2}/${f}'
+[===[${f2contents}]===]")
+ if(DIFF_EXECUTABLE)
+ message(STATUS "diff of files '${d1}/${f}' '${d2}/${f}'")
+ message(STATUS "[====[")
+ execute_process(COMMAND ${DIFF_EXECUTABLE} "${d1}/${f}" "${d2}/${f}")
+ message(STATUS "]====]")
+ endif()
+ endif()
+ endforeach()
+ else()
+ math(EXPR diffs "${diffs} + 1")
+ message(STATUS "warning: file *lists* differ - some files exist in d1/not-d2 or not-d1/d2...")
+ message(STATUS " files1='${files1}'")
+ message(STATUS " files2='${files2}'")
+ endif()
+ endif()
+
+ set(${diff_count_var} ${diffs} PARENT_SCOPE)
+endfunction(analyze_directory_diffs)
+
+
+# Analyze diffs between b1:b2, b2:b3, b3:b4, b4:b5 ... bN-1:bN.
+# Expect no diffs.
+#
+find_program(DIFF_EXECUTABLE diff)
+set(total_diffs 0)
+
+foreach(i RANGE 2 ${N})
+ math(EXPR prev "${i} - 1")
+ set(count 0)
+ analyze_directory_diffs(${dir}/b${prev} ${dir}/b${i} count)
+ message(STATUS "diff count='${count}'")
+ message(STATUS "")
+ math(EXPR total_diffs "${total_diffs} + ${count}")
+endforeach()
+
+message(STATUS "CMAKE_COMMAND='${CMAKE_COMMAND}'")
+message(STATUS "total_diffs='${total_diffs}'")
diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt
index 456e2e9ae8..adaf24774f 100644
--- a/Tests/CMakeTests/CMakeLists.txt
+++ b/Tests/CMakeTests/CMakeLists.txt
@@ -22,10 +22,15 @@ AddCMakeTest(ConfigureFile "")
AddCMakeTest(SeparateArguments "")
AddCMakeTest(ImplicitLinkInfo "")
AddCMakeTest(ModuleNotices "")
+AddCMakeTest(If "")
AddCMakeTest(String "")
AddCMakeTest(Math "")
AddCMakeTest(CMakeMinimumRequired "")
+if(HAVE_ELF_H)
+ AddCMakeTest(ELF "")
+endif()
+
SET(EndStuff_PreArgs
"-Ddir:STRING=${CMAKE_CURRENT_BINARY_DIR}/EndStuffTest"
)
diff --git a/Tests/CMakeTests/ELF/elf32lsb.bin b/Tests/CMakeTests/ELF/elf32lsb.bin
new file mode 100644
index 0000000000..803ac43f35
--- /dev/null
+++ b/Tests/CMakeTests/ELF/elf32lsb.bin
Binary files differ
diff --git a/Tests/CMakeTests/ELF/elf32msb.bin b/Tests/CMakeTests/ELF/elf32msb.bin
new file mode 100644
index 0000000000..d04aaf76c1
--- /dev/null
+++ b/Tests/CMakeTests/ELF/elf32msb.bin
Binary files differ
diff --git a/Tests/CMakeTests/ELF/elf64lsb.bin b/Tests/CMakeTests/ELF/elf64lsb.bin
new file mode 100644
index 0000000000..a21e3eaa65
--- /dev/null
+++ b/Tests/CMakeTests/ELF/elf64lsb.bin
Binary files differ
diff --git a/Tests/CMakeTests/ELF/elf64msb.bin b/Tests/CMakeTests/ELF/elf64msb.bin
new file mode 100644
index 0000000000..bbe2551890
--- /dev/null
+++ b/Tests/CMakeTests/ELF/elf64msb.bin
Binary files differ
diff --git a/Tests/CMakeTests/ELFTest.cmake.in b/Tests/CMakeTests/ELFTest.cmake.in
new file mode 100644
index 0000000000..0271abb1f6
--- /dev/null
+++ b/Tests/CMakeTests/ELFTest.cmake.in
@@ -0,0 +1,48 @@
+set(names
+ elf32lsb.bin
+ elf32msb.bin
+ elf64lsb.bin
+ elf64msb.bin
+ )
+
+# Prepare binaries on which to operate.
+set(in "@CMAKE_CURRENT_SOURCE_DIR@/ELF")
+set(out "@CMAKE_CURRENT_BINARY_DIR@/ELF-Out")
+file(REMOVE_RECURSE "${out}")
+file(MAKE_DIRECTORY "${out}")
+foreach(f ${names})
+ file(COPY ${in}/${f} DESTINATION ${out})
+ list(APPEND files "${out}/${f}")
+endforeach()
+
+foreach(f ${files})
+ # Check for the initial RPATH.
+ file(RPATH_CHECK FILE "${f}" RPATH "/sample/rpath")
+ if(NOT EXISTS "${f}")
+ message(FATAL_ERROR "RPATH_CHECK removed ${f}")
+ endif()
+
+ # Change the RPATH.
+ file(RPATH_CHANGE FILE "${f}"
+ OLD_RPATH "/sample/rpath"
+ NEW_RPATH "/rpath/sample")
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/rpath/sample" LIMIT_COUNT 1)
+ if(NOT rpath)
+ message(FATAL_ERROR "RPATH not changed in ${f}")
+ endif()
+
+ # Remove the RPATH.
+ file(RPATH_REMOVE FILE "${f}")
+ set(rpath)
+ file(STRINGS "${f}" rpath REGEX "/rpath/sample" LIMIT_COUNT 1)
+ if(rpath)
+ message(FATAL_ERROR "RPATH not removed from ${f}")
+ endif()
+
+ # Check again...this should remove the file.
+ file(RPATH_CHECK FILE "${f}" RPATH "/sample/rpath")
+ if(EXISTS "${f}")
+ message(FATAL_ERROR "RPATH_CHECK did not remove ${f}")
+ endif()
+endforeach()
diff --git a/Tests/CMakeTests/FileTest.cmake.in b/Tests/CMakeTests/FileTest.cmake.in
index b19ad0a253..721f311f92 100644
--- a/Tests/CMakeTests/FileTest.cmake.in
+++ b/Tests/CMakeTests/FileTest.cmake.in
@@ -23,3 +23,22 @@ check_cmake_test(File
Copy-NoDest
Copy-NoFile
)
+
+# Also execute each test listed in FileTestScript.cmake:
+#
+set(scriptname "@CMAKE_CURRENT_SOURCE_DIR@/FileTestScript.cmake")
+set(number_of_tests_expected 56)
+
+include("@CMAKE_CURRENT_SOURCE_DIR@/ExecuteScriptTests.cmake")
+execute_all_script_tests(${scriptname} number_of_tests_executed)
+
+# And verify that number_of_tests_executed is at least as many as we know
+# about as of this writing...
+#
+message(STATUS "scriptname='${scriptname}'")
+message(STATUS "number_of_tests_executed='${number_of_tests_executed}'")
+message(STATUS "number_of_tests_expected='${number_of_tests_expected}'")
+
+if(number_of_tests_executed LESS number_of_tests_expected)
+ message(FATAL_ERROR "error: some test cases were skipped")
+endif()
diff --git a/Tests/CMakeTests/FileTestScript.cmake b/Tests/CMakeTests/FileTestScript.cmake
new file mode 100644
index 0000000000..c4e27bd271
--- /dev/null
+++ b/Tests/CMakeTests/FileTestScript.cmake
@@ -0,0 +1,207 @@
+message(STATUS "testname='${testname}'")
+
+if(testname STREQUAL empty) # fail
+ file()
+
+elseif(testname STREQUAL bogus) # fail
+ file(BOGUS ffff)
+
+elseif(testname STREQUAL different_not_enough_args) # fail
+ file(DIFFERENT ffff)
+
+elseif(testname STREQUAL download_not_enough_args) # fail
+ file(DOWNLOAD ffff)
+
+elseif(testname STREQUAL read_not_enough_args) # fail
+ file(READ ffff)
+
+elseif(testname STREQUAL rpath_check_not_enough_args) # fail
+ file(RPATH_CHECK ffff)
+
+elseif(testname STREQUAL rpath_remove_not_enough_args) # fail
+ file(RPATH_REMOVE ffff)
+
+elseif(testname STREQUAL strings_not_enough_args) # fail
+ file(STRINGS ffff)
+
+elseif(testname STREQUAL to_native_path_not_enough_args) # fail
+ file(TO_NATIVE_PATH ffff)
+
+elseif(testname STREQUAL read_with_offset) # pass
+ file(READ ${CMAKE_CURRENT_LIST_FILE} v OFFSET 42 LIMIT 30)
+ message("v='${v}'")
+
+elseif(testname STREQUAL strings_bad_length_minimum) # fail
+ file(STRINGS ${CMAKE_CURRENT_LIST_FILE} v LENGTH_MINIMUM bogus)
+
+elseif(testname STREQUAL strings_bad_length_maximum) # fail
+ file(STRINGS ${CMAKE_CURRENT_LIST_FILE} v LENGTH_MAXIMUM bogus)
+
+elseif(testname STREQUAL strings_bad_limit_count) # fail
+ file(STRINGS ${CMAKE_CURRENT_LIST_FILE} v LIMIT_COUNT bogus)
+
+elseif(testname STREQUAL strings_bad_limit_input) # fail
+ file(STRINGS ${CMAKE_CURRENT_LIST_FILE} v LIMIT_INPUT bogus)
+
+elseif(testname STREQUAL strings_bad_limit_output) # fail
+ file(STRINGS ${CMAKE_CURRENT_LIST_FILE} v LIMIT_OUTPUT bogus)
+
+elseif(testname STREQUAL strings_bad_regex) # fail
+ file(STRINGS ${CMAKE_CURRENT_LIST_FILE} v REGEX "(")
+
+elseif(testname STREQUAL strings_unknown_arg) # fail
+ file(STRINGS ${CMAKE_CURRENT_LIST_FILE} v BOGUS)
+
+elseif(testname STREQUAL strings_bad_filename) # fail
+ file(STRINGS ffff v LIMIT_COUNT 10)
+
+elseif(testname STREQUAL strings_use_limit_count) # pass
+ file(STRINGS ${CMAKE_CURRENT_LIST_FILE} v LIMIT_COUNT 10)
+ message("v='${v}'")
+
+elseif(testname STREQUAL strings_use_no_hex_conversion) # pass
+ file(STRINGS ${CMAKE_CURRENT_LIST_FILE} v NO_HEX_CONVERSION)
+ message("v='${v}'")
+
+elseif(testname STREQUAL glob_recurse_follow_symlinks_no_expression) # fail
+ file(GLOB_RECURSE v FOLLOW_SYMLINKS)
+
+elseif(testname STREQUAL glob_recurse_relative_no_directory) # fail
+ file(GLOB_RECURSE v RELATIVE)
+
+elseif(testname STREQUAL glob_recurse_relative_no_expression) # fail
+ file(GLOB_RECURSE v RELATIVE dddd)
+
+elseif(testname STREQUAL glob_non_full_path) # pass
+ file(GLOB_RECURSE v ffff*.*)
+ message("v='${v}'")
+
+elseif(testname STREQUAL make_directory_non_full_path) # pass
+ file(MAKE_DIRECTORY FileTestScriptDDDD)
+ if(NOT EXISTS FileTestScriptDDDD)
+ message(FATAL_ERROR "error: non-full-path MAKE_DIRECTORY failed")
+ endif()
+ file(REMOVE_RECURSE FileTestScriptDDDD)
+ if(EXISTS FileTestScriptDDDD)
+ message(FATAL_ERROR "error: non-full-path REMOVE_RECURSE failed")
+ endif()
+
+elseif(testname STREQUAL different_no_variable) # fail
+ file(DIFFERENT FILES)
+
+elseif(testname STREQUAL different_no_files) # fail
+ file(DIFFERENT v FILES)
+
+elseif(testname STREQUAL different_unknown_arg) # fail
+ file(DIFFERENT v FILES ffffLHS ffffRHS BOGUS)
+
+elseif(testname STREQUAL different_different) # pass
+ file(DIFFERENT v FILES ffffLHS ffffRHS)
+ message("v='${v}'")
+
+elseif(testname STREQUAL different_same) # pass
+ file(DIFFERENT v FILES
+ ${CMAKE_CURRENT_LIST_FILE} ${CMAKE_CURRENT_LIST_FILE})
+ message("v='${v}'")
+
+elseif(testname STREQUAL rpath_change_unknown_arg) # fail
+ file(RPATH_CHANGE BOGUS)
+
+elseif(testname STREQUAL rpath_change_bad_file) # fail
+ file(RPATH_CHANGE FILE)
+
+elseif(testname STREQUAL rpath_change_bad_old_rpath) # fail
+ file(RPATH_CHANGE FILE ffff OLD_RPATH)
+
+elseif(testname STREQUAL rpath_change_bad_new_rpath) # fail
+ file(RPATH_CHANGE FILE ffff OLD_RPATH rrrr NEW_RPATH)
+
+elseif(testname STREQUAL rpath_change_file_does_not_exist) # fail
+ file(RPATH_CHANGE FILE ffff OLD_RPATH rrrr NEW_RPATH RRRR)
+
+elseif(testname STREQUAL rpath_change_file_is_not_executable) # fail
+ file(RPATH_CHANGE FILE ${CMAKE_CURRENT_LIST_FILE}
+ OLD_RPATH rrrr NEW_RPATH RRRR)
+
+elseif(testname STREQUAL rpath_remove_unknown_arg) # fail
+ file(RPATH_REMOVE BOGUS)
+
+elseif(testname STREQUAL rpath_remove_bad_file) # fail
+ file(RPATH_REMOVE FILE)
+
+elseif(testname STREQUAL rpath_remove_file_does_not_exist) # fail
+ file(RPATH_REMOVE FILE ffff)
+
+#elseif(testname STREQUAL rpath_remove_file_is_not_executable) # fail
+# file(RPATH_REMOVE FILE ${CMAKE_CURRENT_LIST_FILE})
+
+elseif(testname STREQUAL rpath_check_unknown_arg) # fail
+ file(RPATH_CHECK BOGUS)
+
+elseif(testname STREQUAL rpath_check_bad_file) # fail
+ file(RPATH_CHECK FILE)
+
+elseif(testname STREQUAL rpath_check_bad_rpath) # fail
+ file(RPATH_CHECK FILE ffff RPATH)
+
+elseif(testname STREQUAL rpath_check_file_does_not_exist) # pass
+ file(RPATH_CHECK FILE ffff RPATH rrrr)
+
+elseif(testname STREQUAL rpath_check_file_is_not_executable) # pass
+ file(WRITE ffff_rpath_check "")
+
+ if(NOT EXISTS ffff_rpath_check)
+ message(FATAL_ERROR "error: non-full-path WRITE failed")
+ endif()
+
+ file(RPATH_CHECK FILE ffff_rpath_check RPATH rrrr)
+ # careful: if the file does not have the given RPATH, it is deleted...
+
+ if(EXISTS ffff_rpath_check)
+ message(FATAL_ERROR "error: non-full-path RPATH_CHECK failed")
+ endif()
+
+elseif(testname STREQUAL relative_path_wrong_number_of_args) # fail
+ file(RELATIVE_PATH v dir)
+
+elseif(testname STREQUAL relative_path_non_full_path_dir) # fail
+ file(RELATIVE_PATH v dir file)
+
+elseif(testname STREQUAL relative_path_non_full_path_file) # fail
+ file(RELATIVE_PATH v /dir file)
+
+elseif(testname STREQUAL rename_wrong_number_of_args) # fail
+ file(RENAME ffff)
+
+elseif(testname STREQUAL rename_input_file_does_not_exist) # fail
+ file(RENAME ffff FFFFGGGG)
+
+elseif(testname STREQUAL to_native_path) # pass
+ file(TO_NATIVE_PATH /a/b/c\;/d/e/f:/g/h/i v)
+ message("v='${v}'")
+
+elseif(testname STREQUAL download_wrong_number_of_args) # fail
+ file(DOWNLOAD zzzz://bogus/ffff)
+
+elseif(testname STREQUAL download_file_with_no_path) # fail
+ file(DOWNLOAD zzzz://bogus/ffff ffff)
+
+elseif(testname STREQUAL download_missing_time) # fail
+ file(DOWNLOAD zzzz://bogus/ffff ./ffff TIMEOUT)
+
+elseif(testname STREQUAL download_missing_log_var) # fail
+ file(DOWNLOAD zzzz://bogus/ffff ./ffff TIMEOUT 2 LOG)
+
+elseif(testname STREQUAL download_missing_status_var) # fail
+ file(DOWNLOAD zzzz://bogus/ffff ./ffff TIMEOUT 2 LOG l STATUS)
+
+elseif(testname STREQUAL download_with_bogus_protocol) # pass
+ file(DOWNLOAD zzzz://bogus/ffff ./ffff TIMEOUT 2 LOG l STATUS s)
+ file(REMOVE ./ffff)
+ message("l='${l}'")
+ message("s='${s}'")
+
+else() # fail
+ message(FATAL_ERROR "testname='${testname}' - error: no such test in '${CMAKE_CURRENT_LIST_FILE}'")
+
+endif()
diff --git a/Tests/CMakeTests/IfTest.cmake.in b/Tests/CMakeTests/IfTest.cmake.in
new file mode 100644
index 0000000000..e5211b4fa0
--- /dev/null
+++ b/Tests/CMakeTests/IfTest.cmake.in
@@ -0,0 +1,158 @@
+# Prepare variable definitions.
+set(VAR_UNDEFINED)
+set(VAR_PATH /some/path/to/a/file.txt)
+set(FALSE_NAMES OFF NO FALSE N FOO-NOTFOUND IGNORE Off No False Ignore off n no false ignore)
+set(TRUE_NAMES ON YES TRUE Y On Yes True on yes true y)
+foreach(_arg "" 0 1 2 ${TRUE_NAMES} ${FALSE_NAMES})
+ set(VAR_${_arg} "${_arg}")
+endforeach()
+
+macro(test_vars _old)
+ # Variables set to false or not set.
+ foreach(_var "" 0 ${FALSE_NAMES} UNDEFINED)
+ if(VAR_${_var})
+ message(FATAL_ERROR "${_old}if(VAR_${_var}) is true!")
+ else()
+ message(STATUS "${_old}if(VAR_${_var}) is false")
+ endif()
+
+ if(NOT VAR_${_var})
+ message(STATUS "${_old}if(NOT VAR_${_var}) is true")
+ else()
+ message(FATAL_ERROR "${_old}if(NOT VAR_${_var}) is false!")
+ endif()
+ endforeach()
+
+ # Variables set to true.
+ foreach(_var 1 2 ${TRUE_NAMES} PATH)
+ if(VAR_${_var})
+ message(STATUS "${_old}if(VAR_${_var}) is true")
+ else()
+ message(FATAL_ERROR "${_old}if(VAR_${_var}) is false!")
+ endif()
+
+ if(NOT VAR_${_var})
+ message(FATAL_ERROR "${_old}if(NOT VAR_${_var}) is true!")
+ else()
+ message(STATUS "${_old}if(NOT VAR_${_var}) is false")
+ endif()
+ endforeach()
+endmacro()
+
+#-----------------------------------------------------------------------------
+# Test the OLD behavior of CMP0012.
+cmake_policy(SET CMP0012 OLD)
+
+# False constants not recognized (still false).
+foreach(_false "" ${FALSE_NAMES})
+ if("${_false}")
+ message(FATAL_ERROR "OLD if(${_false}) is true!")
+ else()
+ message(STATUS "OLD if(${_false}) is false")
+ endif()
+
+ if(NOT "${_false}")
+ message(STATUS "OLD if(NOT ${_false}) is true")
+ else()
+ message(FATAL_ERROR "OLD if(NOT ${_false}) is false!")
+ endif()
+endforeach()
+
+# True constants not recognized.
+foreach(_false ${TRUE_NAMES})
+ if(${_false})
+ message(FATAL_ERROR "OLD if(${_false}) is true!")
+ else()
+ message(STATUS "OLD if(${_false}) is false")
+ endif()
+
+ if(NOT ${_false})
+ message(STATUS "OLD if(NOT ${_false}) is true")
+ else()
+ message(FATAL_ERROR "OLD if(NOT ${_false}) is false!")
+ endif()
+endforeach()
+
+# Numbers not recognized properly.
+foreach(_num 2 -2 2.0 -2.0 2x -2x)
+ if(${_num})
+ message(FATAL_ERROR "OLD if(${_num}) is true!")
+ else()
+ message(STATUS "OLD if(${_num}) is false")
+ endif()
+
+ if(NOT ${_num})
+ message(FATAL_ERROR "OLD if(NOT ${_num}) is true!")
+ else()
+ message(STATUS "OLD if(NOT ${_num}) is false")
+ endif()
+endforeach()
+
+test_vars("OLD ")
+
+#-----------------------------------------------------------------------------
+
+# Test the NEW behavior of CMP0012.
+cmake_policy(SET CMP0012 NEW)
+
+# Test false constants.
+foreach(_false "" 0 ${FALSE_NAMES})
+ if("${_false}")
+ message(FATAL_ERROR "if(${_false}) is true!")
+ else()
+ message(STATUS "if(${_false}) is false")
+ endif()
+
+ if(NOT "${_false}")
+ message(STATUS "if(NOT ${_false}) is true")
+ else()
+ message(FATAL_ERROR "if(NOT ${_false}) is false!")
+ endif()
+endforeach()
+
+# Test true constants.
+foreach(_true 1 ${TRUE_NAMES})
+ if(${_true})
+ message(STATUS "if(${_true}) is true")
+ else()
+ message(FATAL_ERROR "if(${_true}) is false!")
+ endif()
+
+ if(NOT ${_true})
+ message(FATAL_ERROR "if(NOT ${_true}) is true!")
+ else()
+ message(STATUS "if(NOT ${_true}) is false")
+ endif()
+endforeach()
+
+# Numbers recognized properly.
+foreach(_num 2 -2 2.0 -2.0)
+ if(${_num})
+ message(STATUS "if(${_num}) is true")
+ else()
+ message(FATAL_ERROR "if(${_num}) is false!")
+ endif()
+
+ if(NOT ${_num})
+ message(FATAL_ERROR "if(NOT ${_num}) is true!")
+ else()
+ message(STATUS "if(NOT ${_num}) is false")
+ endif()
+endforeach()
+
+# Bad numbers not recognized.
+foreach(_bad 2x -2x)
+ if(${_bad})
+ message(FATAL_ERROR "if(${_bad}) is true!")
+ else()
+ message(STATUS "if(${_bad}) is false")
+ endif()
+
+ if(NOT ${_bad})
+ message(STATUS "if(NOT ${_bad}) is true")
+ else()
+ message(FATAL_ERROR "if(NOT ${_bad}) is false!")
+ endif()
+endforeach()
+
+test_vars("")
diff --git a/Tests/CPackTestAllGenerators/CMakeLists.txt b/Tests/CPackTestAllGenerators/CMakeLists.txt
new file mode 100644
index 0000000000..5eeb7e90be
--- /dev/null
+++ b/Tests/CPackTestAllGenerators/CMakeLists.txt
@@ -0,0 +1,5 @@
+cmake_minimum_required(VERSION 2.8)
+project(CPackTestAllGenerators)
+add_subdirectory(../CTestTest/SmallAndFast SmallAndFast)
+install(FILES RunCPack.cmake DESTINATION .)
+include(CPack)
diff --git a/Tests/CPackTestAllGenerators/RunCPack.cmake b/Tests/CPackTestAllGenerators/RunCPack.cmake
new file mode 100644
index 0000000000..e0c241ec44
--- /dev/null
+++ b/Tests/CPackTestAllGenerators/RunCPack.cmake
@@ -0,0 +1,55 @@
+if(NOT DEFINED cpack)
+ message(FATAL_ERROR "cpack not defined")
+endif()
+
+if(NOT DEFINED dir)
+ message(FATAL_ERROR "dir not defined")
+endif()
+
+# Analyze 'cpack --help' output for list of available generators:
+#
+execute_process(COMMAND ${cpack} --help
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ WORKING_DIRECTORY ${dir})
+
+string(REPLACE ";" "\\;" stdout "${stdout}")
+string(REPLACE "\n" "E;" stdout "${stdout}")
+
+set(collecting 0)
+set(generators)
+foreach(eline ${stdout})
+ string(REGEX REPLACE "^(.*)E$" "\\1" line "${eline}")
+ if(collecting AND NOT line STREQUAL "")
+ string(REGEX REPLACE "^ ([^ ]+) += (.*)$" "\\1" gen "${line}")
+ string(REGEX REPLACE "^ ([^ ]+) += (.*)$" "\\2" doc "${line}")
+ set(generators ${generators} ${gen})
+ endif()
+ if(line STREQUAL "Generators")
+ set(collecting 1)
+ endif()
+endforeach()
+
+# Call cpack with -G on each available generator. We do not care if this
+# succeeds or not. We expect it *not* to succeed if the underlying packaging
+# tools are not installed on the system... This test is here simply to add
+# coverage for the various cpack generators, even/especially to test ones
+# where the tools are not installed.
+#
+message(STATUS "CTEST_FULL_OUTPUT (Avoid ctest truncation of output)")
+
+message(STATUS "CPack generators='${generators}'")
+
+foreach(g ${generators})
+ message(STATUS "Calling cpack -G ${g}...")
+ execute_process(COMMAND ${cpack} -G ${g}
+ RESULT_VARIABLE result
+ OUTPUT_VARIABLE stdout
+ ERROR_VARIABLE stderr
+ WORKING_DIRECTORY ${dir})
+ message(STATUS "result='${result}'")
+ message(STATUS "stdout='${stdout}'")
+ message(STATUS "stderr='${stderr}'")
+ message(STATUS "")
+endforeach()
diff --git a/Tests/CTestTest/SmallAndFast/CMakeLists.txt b/Tests/CTestTest/SmallAndFast/CMakeLists.txt
index 51aa887bf7..85cb30ceff 100644
--- a/Tests/CTestTest/SmallAndFast/CMakeLists.txt
+++ b/Tests/CTestTest/SmallAndFast/CMakeLists.txt
@@ -4,7 +4,22 @@ project(SmallAndFast)
include(CTest)
add_executable(echoargs echoargs.c)
+set_property(SOURCE echoargs.c APPEND PROPERTY LABELS SourceLabel Everything)
+set_property(TARGET echoargs APPEND PROPERTY LABELS TargetLabel Everything)
add_test(test0 echoargs)
+set_property(TEST test0 APPEND PROPERTY LABELS TestLabel 0ArgTest Everything)
+
add_test(test1 echoargs 1)
+set_property(TEST test1 APPEND PROPERTY LABELS TestLabel 1ArgTest Everything)
+
add_test(test2 echoargs 1 2)
+set_property(TEST test2 APPEND PROPERTY LABELS TestLabel 2ArgTest Everything)
+
+if(SAF_INTENTIONAL_COMPILE_ERROR)
+ add_executable(ice intentional_compile_error.cxx)
+endif()
+
+if(SAF_INTENTIONAL_COMPILE_WARNING)
+ add_executable(icw intentional_compile_warning.cxx)
+endif()
diff --git a/Tests/CTestTest/SmallAndFast/intentional_compile_error.cxx b/Tests/CTestTest/SmallAndFast/intentional_compile_error.cxx
new file mode 100644
index 0000000000..a8930cf724
--- /dev/null
+++ b/Tests/CTestTest/SmallAndFast/intentional_compile_error.cxx
@@ -0,0 +1 @@
+garbage - obviously this should not compile as is
diff --git a/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx b/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx
new file mode 100644
index 0000000000..8ea5e404f7
--- /dev/null
+++ b/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx
@@ -0,0 +1,11 @@
+#include <stdio.h>
+
+int main(int argc, const char* argv[])
+{
+ unsigned int i = 0; // "i<argc" should produce a "signed/unsigned comparison" warning
+ for (; i<argc; ++i)
+ {
+ fprintf(stdout, "%s\n", argv[i]);
+ }
+ return 0;
+}
diff --git a/Tests/CTestTestFailedSubmits/test.cmake.in b/Tests/CTestTestFailedSubmits/test.cmake.in
new file mode 100644
index 0000000000..42bc79c670
--- /dev/null
+++ b/Tests/CTestTestFailedSubmits/test.cmake.in
@@ -0,0 +1,47 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
+
+# CTestConfig.cmake settings:
+set(CTEST_PROJECT_NAME "SmallAndFast")
+
+# Intentionally leave out other upload-related CTestConfig.cmake settings
+# so that the ctest_submit call below fails with an error message...
+#
+set(CTEST_DROP_METHOD "@drop_method@")
+
+# Settings:
+SET(CTEST_USE_LAUNCHERS 1)
+
+# Emit these compiler warnings:
+set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Wall")
+
+SET(CTEST_SITE "@SITE@")
+SET(CTEST_BUILD_NAME "CTestTestLaunchers-@drop_method@")
+
+SET(CTEST_SOURCE_DIRECTORY "@source@")
+SET(CTEST_BINARY_DIRECTORY "@build@")
+SET(CTEST_CVS_COMMAND "@CVSCOMMAND@")
+SET(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
+SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@")
+SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@")
+SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@")
+SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@")
+SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
+
+CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY})
+
+CTEST_START(Experimental)
+
+# explicitly do not use CTEST_UPDATE - avoid network activity
+
+CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}"
+ OPTIONS "-DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS};-DSAF_INTENTIONAL_COMPILE_ERROR:BOOL=ON;-DSAF_INTENTIONAL_COMPILE_WARNING:BOOL=ON"
+ RETURN_VALUE res)
+CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
+CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
+CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
+CTEST_COVERAGE(BUILD "${CTEST_BINARY_DIRECTORY}" @ctest_coverage_labels_args@ RETURN_VALUE res)
+
+# ok to call ctest_submit - still avoids network activity because there is
+# not a valid drop location given above...
+CTEST_SUBMIT(RETURN_VALUE res)
diff --git a/Tests/CTestTestRunScript/hello.cmake b/Tests/CTestTestRunScript/hello.cmake
new file mode 100644
index 0000000000..e2c652cff1
--- /dev/null
+++ b/Tests/CTestTestRunScript/hello.cmake
@@ -0,0 +1,6 @@
+GET_FILENAME_COMPONENT(CTEST_COMMAND "${CMAKE_COMMAND}" PATH)
+SET(CTEST_COMMAND "${CTEST_COMMAND}/ctest")
+SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestRunScript")
+SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestRunScript")
+
+message("hello world")
diff --git a/Tests/CTestTestRunScript/test.cmake b/Tests/CTestTestRunScript/test.cmake
new file mode 100644
index 0000000000..4afcdd9d29
--- /dev/null
+++ b/Tests/CTestTestRunScript/test.cmake
@@ -0,0 +1,7 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.1)
+GET_FILENAME_COMPONENT(CTEST_COMMAND "${CMAKE_COMMAND}" PATH)
+SET(CTEST_COMMAND "${CTEST_COMMAND}/ctest")
+SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestRunScript")
+SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestRunScript")
+
+CTEST_RUN_SCRIPT("${CTEST_BINARY_DIRECTORY}/hello.cmake")
diff --git a/Tests/CTestTestSubdir/CMakeLists.txt b/Tests/CTestTestSubdir/CMakeLists.txt
new file mode 100644
index 0000000000..f5a1fe2907
--- /dev/null
+++ b/Tests/CTestTestSubdir/CMakeLists.txt
@@ -0,0 +1,11 @@
+cmake_minimum_required (VERSION 2.6)
+PROJECT(CTestTestSubdir)
+
+SET(DART_ROOT "" CACHE STRING "" FORCE)
+ENABLE_TESTING()
+INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
+
+GET_FILENAME_COMPONENT(CTEST_COMMAND "${CMAKE_COMMAND}" PATH)
+SET(CTEST_COMMAND "${CTEST_COMMAND}/ctest")
+
+ADD_SUBDIRECTORY(subdir)
diff --git a/Tests/CTestTestSubdir/CTestConfig.cmake b/Tests/CTestTestSubdir/CTestConfig.cmake
new file mode 100644
index 0000000000..4b848aa26a
--- /dev/null
+++ b/Tests/CTestTestSubdir/CTestConfig.cmake
@@ -0,0 +1,7 @@
+set(CTEST_PROJECT_NAME "CTestTestSubdir")
+set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
+set(CTEST_DART_SERVER_VERSION "2")
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "www.cdash.org")
+set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard")
+set(CTEST_DROP_SITE_CDASH TRUE)
diff --git a/Tests/CTestTestSubdir/subdir/CMakeLists.txt b/Tests/CTestTestSubdir/subdir/CMakeLists.txt
new file mode 100644
index 0000000000..a92e13be57
--- /dev/null
+++ b/Tests/CTestTestSubdir/subdir/CMakeLists.txt
@@ -0,0 +1,2 @@
+ADD_EXECUTABLE (main main.c)
+ADD_TEST (TestMain main)
diff --git a/Tests/CTestTestSubdir/subdir/main.c b/Tests/CTestTestSubdir/subdir/main.c
new file mode 100644
index 0000000000..8488f4e58f
--- /dev/null
+++ b/Tests/CTestTestSubdir/subdir/main.c
@@ -0,0 +1,4 @@
+int main(void)
+{
+ return 0;
+}
diff --git a/Tests/CTestTestSubdir/test.cmake.in b/Tests/CTestTestSubdir/test.cmake.in
new file mode 100644
index 0000000000..299f86d1a1
--- /dev/null
+++ b/Tests/CTestTestSubdir/test.cmake.in
@@ -0,0 +1,32 @@
+CMAKE_MINIMUM_REQUIRED(VERSION 2.1)
+
+# Settings:
+SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest")
+SET(CTEST_SITE "@SITE@")
+SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Subdir")
+
+SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestSubdir")
+SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestSubdir")
+SET(CTEST_CVS_COMMAND "@CVSCOMMAND@")
+SET(CMAKE_TEST_MAKEPROGRAM "@CMAKE_TEST_MAKEPROGRAM@")
+SET(MAKECOMMAND "@MAKECOMMAND@")
+SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@")
+SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
+SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@")
+SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@")
+SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@")
+SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@")
+SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
+
+#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY})
+
+FILE(WRITE "${CTEST_BINARY_DIRECTORY}/CMakeCache.txt" "
+CMAKE_TEST_GENERATOR:STRING=@CMAKE_TEST_GENERATOR@
+CMAKE_TEST_MAKEPROGRAM:FILEPATH=@CMAKE_TEST_MAKEPROGRAM@
+MAKECOMMAND:STRING=@MAKECOMMAND@
+")
+
+CTEST_START(Experimental)
+CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
+CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
+CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt
index adcadd4dc7..709ea5f5a5 100644
--- a/Tests/Fortran/CMakeLists.txt
+++ b/Tests/Fortran/CMakeLists.txt
@@ -7,8 +7,25 @@ message("CMAKE_Fortran_COMPILER_INIT = ${CMAKE_Fortran_COMPILER_INIT}")
message("CMAKE_Fortran_COMPILER_FULLPATH = ${CMAKE_Fortran_COMPILER_FULLPATH}")
message("CMAKE_Fortran_COMPILER = ${CMAKE_Fortran_COMPILER}")
message("CMAKE_Fortran_FLAGS = ${CMAKE_Fortran_FLAGS}")
-add_executable(testf hello.f)
+set(_SHARED SHARED)
+if("${CMAKE_Fortran_COMPILER_ID}" MATCHES "^(XL|VisualAge)$")
+ # We do not implement SHARED Fortran libs on AIX yet!
+ # Workaround: Set LINKER_LANGUAGE to C, which uses 'xlc' and Fortran implicits.
+ set(_SHARED STATIC)
+elseif("${CMAKE_Fortran_COMPILER_ID}" STREQUAL "GNU")
+ # g77 2.96 does not support shared libs on Itanium because g2c is not -fPIC
+ execute_process(COMMAND ${CMAKE_Fortran_COMPILER} --version
+ OUTPUT_VARIABLE output ERROR_VARIABLE output)
+ if("${output}" MATCHES "Red Hat .* 2\\.96")
+ set(_SHARED STATIC)
+ endif()
+endif()
+
+add_library(hello STATIC hello.f)
+add_library(world ${_SHARED} world.f world.def)
+add_executable(testf testf.f)
+target_link_libraries(testf hello world)
function(test_fortran_c_interface_module)
message(STATUS "Testing FortranCInterface module")
diff --git a/Tests/Fortran/hello.f b/Tests/Fortran/hello.f
index c9ee3c2cbe..aa0de77150 100644
--- a/Tests/Fortran/hello.f
+++ b/Tests/Fortran/hello.f
@@ -1,6 +1,6 @@
- PROGRAM GREETINGS
+ SUBROUTINE HELLO
- PRINT *, 'Real programmers write Fortran!'
+ PRINT *, 'Hello'
END
diff --git a/Tests/Fortran/testf.f b/Tests/Fortran/testf.f
new file mode 100644
index 0000000000..abf6c6df7d
--- /dev/null
+++ b/Tests/Fortran/testf.f
@@ -0,0 +1,7 @@
+ PROGRAM TESTF
+
+ CALL HELLO()
+ CALL WORLD()
+
+ END
+
diff --git a/Tests/Fortran/world.def b/Tests/Fortran/world.def
new file mode 100644
index 0000000000..ead7710cd7
--- /dev/null
+++ b/Tests/Fortran/world.def
@@ -0,0 +1,2 @@
+EXPORTS
+ WORLD
diff --git a/Tests/Fortran/world.f b/Tests/Fortran/world.f
new file mode 100644
index 0000000000..0487dffe46
--- /dev/null
+++ b/Tests/Fortran/world.f
@@ -0,0 +1,6 @@
+ SUBROUTINE WORLD
+
+ PRINT *, 'World!'
+
+ END
+
diff --git a/Tests/KDE4StableBranchTest/test_kde4.sh.in b/Tests/KDE4StableBranchTest/test_kde4.sh.in
new file mode 100755
index 0000000000..81badcd79f
--- /dev/null
+++ b/Tests/KDE4StableBranchTest/test_kde4.sh.in
@@ -0,0 +1,62 @@
+#!/bin/sh
+
+# This shell script tests whether cmake is able to build the latest
+# stable KDE4 release, or at least some part of it.
+# It downloads automoc from KDE svn, builds and installs it, then it
+# downloads phonon from KDE svn, builds and installs it, and finally
+# it downloads kdelibs (currently from the 4.3 branch), and builds
+# a (small) part of it, i.e. libkdecore and one unit test depending on it.
+#
+# <neundorf AT kde.org>
+
+CMAKE="@CMAKE_CMAKE_COMMAND@"
+BASEDIR="@TEST_KDE4_BASE_DIR@"
+INSTALLDIR="$BASEDIR/install"
+QMAKE="@QT_QMAKE_EXECUTABLE@"
+
+cd "$BASEDIR" || exit -1
+echo "Removing old install dir " $INSTALLDIR
+
+rm -rf install || exit -1
+rm -rf build-automoc || exit -1
+rm -rf build-phonon || exit -1
+rm -rf build-kdelibs || exit -1
+
+
+
+# build and install automoc
+cd "$BASEDIR" || exit -1
+svn co svn://anonsvn.kde.org/home/kde/tags/kdesupport-for-4.3/kdesupport/automoc || exit -1
+
+mkdir -p build-automoc || exit -1
+
+cd build-automoc || exit -1
+"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DQT_QMAKE_EXECUTABLE:STRING="$QMAKE" ../automoc || exit -1
+"$CMAKE" --build . || exit -1
+"$CMAKE" -P cmake_install.cmake || exit -1
+
+export CMAKE_PREFIX_PATH="$INSTALLDIR:$CMAKE_PREFIX_PATH"
+
+
+# build and install phonon
+cd "$BASEDIR" || exit -1
+svn co svn://anonsvn.kde.org/home/kde/tags/kdesupport-for-4.3/kdesupport/phonon || exit -1
+
+mkdir -p build-phonon || exit -1
+
+cd build-phonon || exit -1
+"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DQT_QMAKE_EXECUTABLE:STRING="$QMAKE" -DWITH_GLIB2=FALSE -DWITH_GObject=FALSE -DWITH_GStreamer=FALSE -DWITH_GStreamerPlugins=FALSE -DWITH_OpenGL=FALSE -DWITH_XCB=FALSE -DWITH_Xine=FALSE ../phonon || exit -1
+"$CMAKE" --build . || exit -1
+"$CMAKE" -P cmake_install.cmake || exit -1
+
+
+# finally build kdelibs/kdecore
+cd "$BASEDIR" || exit -1
+
+svn co svn://anonsvn.kde.org/home/kde/branches/KDE/4.3/kdelibs/ || exit -1
+mkdir -p build-kdelibs || exit -1
+cd build-kdelibs || exit -1
+# trick cmake into not searching strigi and not searching sharedmimeinfo
+"$CMAKE" -DCMAKE_INSTALL_PREFIX="$INSTALLDIR" -DQT_QMAKE_EXECUTABLE:STRING="$QMAKE" -DSTRIGI_FOUND=TRUE -DSTRIGI_INCLUDE_DIR=/usr/include -DSTRIGI_STREAMANALYZER_LIBRARY=-lc -DSTRIGI_STREAMS_LIBRARY=-lc -DSTRIGI_STRIGIQTDBUSCLIENT_LIBRARY=-lc -DSTRIGI_NEEDS_SIGNED_CHAR=TRUE -DSTRIGI_NEEDS_CHAR=FALSE -DUPDATE_MIME_DATABASE_EXECUTABLE=/bin/sh ../kdelibs || exit -1
+make -C kdecore/tests kurltest || exit -1
+
diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake
index 2869ab46dd..19fec14883 100644
--- a/Utilities/Release/dash2win64_release.cmake
+++ b/Utilities/Release/dash2win64_release.cmake
@@ -11,7 +11,7 @@ set(INITIAL_CACHE "CMAKE_BUILD_TYPE:STRING=Release
CMAKE_SKIP_BOOTSTRAP_TEST:STRING=TRUE
CMAKE_GENERATOR:INTERNAL=Unix Makefiles
BUILD_QtDialog:BOOL:=TRUE
-QT_QMAKE_EXECUTABLE:FILEPATH=C:/cygwin/home/dashboard/qt/qt-all-opensource-src-4.5.2/bin/qmake.exe
+QT_QMAKE_EXECUTABLE:FILEPATH=c:/Dashboards/Support/qt-4.5.3-static/bin/qmake.exe
")
get_filename_component(path "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(${path}/release_cmake.cmake)
diff --git a/Utilities/cmtar/compat/fnmatch.c b/Utilities/cmtar/compat/fnmatch.c
index 936f21ec18..bb575b32c0 100644
--- a/Utilities/cmtar/compat/fnmatch.c
+++ b/Utilities/cmtar/compat/fnmatch.c
@@ -174,12 +174,7 @@ fnmatch(pattern, string, flags)
/* NOTREACHED */
}
-static int
-rangematch(pattern, test, flags, newp)
- const char *pattern;
- char test;
- int flags;
- char **newp;
+static int rangematch(const char *pattern, char test, int flags, char **newp)
{
int negate, ok;
char c, c2;
diff --git a/Utilities/cmtar/compat/snprintf.c b/Utilities/cmtar/compat/snprintf.c
index ef6e2f1813..599ccfe259 100644
--- a/Utilities/cmtar/compat/snprintf.c
+++ b/Utilities/cmtar/compat/snprintf.c
@@ -42,6 +42,10 @@
#include <libtar/config.h>
+#if defined(__INTEL_COMPILER)
+# pragma warning disable 177 /* function declared but not referenced */
+#endif
+
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
#include <stdio.h>
diff --git a/Utilities/cmtar/libtar.c b/Utilities/cmtar/libtar.c
index 0d031b7f8b..25f570fd38 100644
--- a/Utilities/cmtar/libtar.c
+++ b/Utilities/cmtar/libtar.c
@@ -312,7 +312,7 @@ extract(char *tarfile, char *rootdir)
return 0;
}
-
+#if !defined(_WIN32) || defined(__CYGWIN__)
static void
usage()
{
@@ -322,7 +322,7 @@ usage()
progname);
exit(-1);
}
-
+#endif
#define MODE_LIST 1
#define MODE_CREATE 2