From d6891e65c83d1e990aa030f46b4231d21df7cc23 Mon Sep 17 00:00:00 2001 From: Modestas Vainius Date: Fri, 6 Nov 2009 22:07:41 +0200 Subject: [PATCH] Import cmake 2.8.0-rc5. --- CMakeLists.txt | 5 +- CTestCustom.cmake.in | 3 + ChangeLog.manual | 66 +++++ CompileFlags.cmake | 9 +- Modules/CMakeDetermineJavaCompiler.cmake | 4 + Modules/CMakeFortranCompilerId.F.in | 2 + Modules/CMakeVS10FindMake.cmake | 4 +- Modules/CMakeVerifyManifest.cmake | 115 +++++++++ Modules/CPackDeb.cmake | 44 ++++ Modules/Compiler/G95-Fortran.cmake | 7 + Modules/DartConfiguration.tcl.in | 5 +- Modules/FeatureSummary.cmake | 16 +- Modules/FindBoost.cmake | 2 + Modules/FindCUDA.cmake | 4 +- Modules/FindHDF5.cmake | 15 +- Modules/FindJNI.cmake | 17 +- Modules/FindMPI.cmake | 144 +++++++---- Modules/FindOpenSSL.cmake | 33 ++- Modules/FindOpenSceneGraph.cmake | 17 +- Modules/FindPythonLibs.cmake | 2 - Modules/FindSquish.cmake | 30 +-- Modules/FindZLIB.cmake | 20 +- Modules/NSIS.template.in | 20 +- Modules/Platform/Linux-Intel-Fortran.cmake | 2 +- Modules/Platform/Windows-g77.cmake | 3 +- Modules/Platform/Windows-ifort.cmake | 10 +- Modules/UseSWIG.cmake | 41 ++- Modules/readme.txt | 5 +- Source/CMakeLists.txt | 2 + Source/CPack/cmCPackTGZGenerator.cxx | 7 +- Source/CPack/cmCPackTarCompressGenerator.cxx | 7 +- Source/CTest/cmCTestBatchTestHandler.cxx | 8 +- Source/CTest/cmCTestBuildAndTestHandler.cxx | 4 +- Source/CTest/cmCTestCoverageHandler.cxx | 224 +++++++++------- Source/CTest/cmCTestMemCheckHandler.cxx | 12 +- Source/CTest/cmCTestMultiProcessHandler.cxx | 61 ++++- Source/CTest/cmCTestMultiProcessHandler.h | 2 + Source/CTest/cmCTestRunTest.cxx | 6 +- Source/QtDialog/CMakeSetup.cxx | 9 - Source/QtDialog/CMakeSetupDialog.cxx | 9 +- Source/QtDialog/QCMake.cxx | 21 ++ Source/cmCTest.cxx | 14 +- Source/cmCommandArgumentParserHelper.cxx | 6 +- Source/cmCoreTryCompile.cxx | 3 +- Source/cmExtraCodeBlocksGenerator.cxx | 171 +++++++------ Source/cmExtraEclipseCDT4Generator.cxx | 9 +- Source/cmFileCommand.cxx | 178 +++++++++---- Source/cmFileCommand.h | 2 +- Source/cmGlobalVisualStudio10Generator.cxx | 5 +- .../cmGlobalVisualStudio10Win64Generator.cxx | 37 +++ Source/cmGlobalVisualStudio10Win64Generator.h | 36 +++ Source/cmGlobalVisualStudio7Generator.cxx | 7 - Source/cmGlobalVisualStudio7Generator.h | 5 +- Source/cmGlobalVisualStudio8Generator.cxx | 242 +++++++++--------- Source/cmGlobalVisualStudio8Generator.h | 8 + Source/cmGlobalVisualStudioGenerator.h | 3 +- Source/cmGlobalXCodeGenerator.cxx | 29 ++- Source/cmIfCommand.cxx | 203 ++++++++------- Source/cmIfCommand.h | 28 +- Source/cmLocalVisualStudio10Generator.cxx | 8 +- Source/cmLocalVisualStudio7Generator.cxx | 13 +- Source/cmMakefile.cxx | 10 +- Source/cmPolicies.cxx | 25 +- Source/cmPolicies.h | 2 +- Source/cmSystemTools.cxx | 20 +- Source/cmTarget.cxx | 25 +- Source/cmVS10CLFlagTable.h | 28 +- Source/cmVS10LinkFlagTable.h | 9 +- Source/cmVisualStudio10TargetGenerator.cxx | 143 ++++++++--- Source/cmVisualStudio10TargetGenerator.h | 12 +- Source/cmake.cxx | 3 + Source/cmparseMSBuildXML.py | 35 ++- Source/kwsys/ProcessUNIX.c | 4 +- Source/kwsys/SystemTools.cxx | 15 +- Tests/BuildDepends/CMakeLists.txt | 14 +- Tests/CMakeLists.txt | 206 ++++++++++++++- Tests/CMakeTestAllGenerators/RunCMake.cmake | 95 +++++++ Tests/CMakeTestBadCommandLines/RunCMake.cmake | 79 ++++++ .../RunCMake.cmake | 165 ++++++++++++ Tests/CMakeTests/CMakeLists.txt | 5 + Tests/CMakeTests/ELF/elf32lsb.bin | Bin 0 -> 2824 bytes Tests/CMakeTests/ELF/elf32msb.bin | Bin 0 -> 17984 bytes Tests/CMakeTests/ELF/elf64lsb.bin | Bin 0 -> 4320 bytes Tests/CMakeTests/ELF/elf64msb.bin | Bin 0 -> 18704 bytes Tests/CMakeTests/ELFTest.cmake.in | 48 ++++ Tests/CMakeTests/FileTest.cmake.in | 19 ++ Tests/CMakeTests/FileTestScript.cmake | 207 +++++++++++++++ Tests/CMakeTests/IfTest.cmake.in | 158 ++++++++++++ Tests/CPackComponents/CMakeLists.txt | 10 +- Tests/CPackTestAllGenerators/CMakeLists.txt | 5 + Tests/CPackTestAllGenerators/RunCPack.cmake | 55 ++++ Tests/CTestTest/SmallAndFast/CMakeLists.txt | 15 ++ .../intentional_compile_error.cxx | 1 + .../intentional_compile_warning.cxx | 11 + Tests/CTestTestFailedSubmits/test.cmake.in | 47 ++++ Tests/CTestTestRunScript/hello.cmake.in | 2 + Tests/CTestTestRunScript/test.cmake.in | 2 + Tests/CTestTestSubdir/CMakeLists.txt | 11 + Tests/CTestTestSubdir/CTestConfig.cmake | 7 + Tests/CTestTestSubdir/subdir/CMakeLists.txt | 2 + Tests/CTestTestSubdir/subdir/main.c | 4 + Tests/CTestTestSubdir/test.cmake.in | 32 +++ Tests/Fortran/CMakeLists.txt | 19 +- Tests/Fortran/hello.f | 4 +- Tests/Fortran/testf.f | 7 + Tests/Fortran/world.def | 2 + Tests/Fortran/world.f | 6 + Tests/KDE4StableBranchTest/test_kde4.sh.in | 62 +++++ Tests/TryCompile/CMakeLists.txt | 11 + Tests/TryCompile/expect_arg.c | 22 ++ Utilities/Release/dash2win64_release.cmake | 2 +- Utilities/cmtar/compat/fnmatch.c | 7 +- Utilities/cmtar/compat/snprintf.c | 4 + Utilities/cmtar/libtar.c | 4 +- 114 files changed, 2956 insertions(+), 749 deletions(-) create mode 100755 Modules/CMakeVerifyManifest.cmake create mode 100644 Modules/Compiler/G95-Fortran.cmake create mode 100644 Source/cmGlobalVisualStudio10Win64Generator.cxx create mode 100644 Source/cmGlobalVisualStudio10Win64Generator.h create mode 100644 Tests/CMakeTestAllGenerators/RunCMake.cmake create mode 100644 Tests/CMakeTestBadCommandLines/RunCMake.cmake create mode 100644 Tests/CMakeTestMultipleConfigures/RunCMake.cmake create mode 100644 Tests/CMakeTests/ELF/elf32lsb.bin create mode 100644 Tests/CMakeTests/ELF/elf32msb.bin create mode 100644 Tests/CMakeTests/ELF/elf64lsb.bin create mode 100644 Tests/CMakeTests/ELF/elf64msb.bin create mode 100644 Tests/CMakeTests/ELFTest.cmake.in create mode 100644 Tests/CMakeTests/FileTestScript.cmake create mode 100644 Tests/CMakeTests/IfTest.cmake.in create mode 100644 Tests/CPackTestAllGenerators/CMakeLists.txt create mode 100644 Tests/CPackTestAllGenerators/RunCPack.cmake create mode 100644 Tests/CTestTest/SmallAndFast/intentional_compile_error.cxx create mode 100644 Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx create mode 100644 Tests/CTestTestFailedSubmits/test.cmake.in create mode 100644 Tests/CTestTestRunScript/hello.cmake.in create mode 100644 Tests/CTestTestRunScript/test.cmake.in create mode 100644 Tests/CTestTestSubdir/CMakeLists.txt create mode 100644 Tests/CTestTestSubdir/CTestConfig.cmake create mode 100644 Tests/CTestTestSubdir/subdir/CMakeLists.txt create mode 100644 Tests/CTestTestSubdir/subdir/main.c create mode 100644 Tests/CTestTestSubdir/test.cmake.in create mode 100644 Tests/Fortran/testf.f create mode 100644 Tests/Fortran/world.def create mode 100644 Tests/Fortran/world.f create mode 100644 Tests/KDE4StableBranchTest/test_kde4.sh.in create mode 100755 Tests/TryCompile/expect_arg.c diff --git a/CMakeLists.txt b/CMakeLists.txt index 29337481c..3d8eeda44 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 5) # 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 2a6ce0604..343f9b0ad 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 65cb72822..572392735 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,69 @@ +Changes in CMake 2.8.0 RC 5 +- CTest now detects cycles in test dependency graph +- Warn on set(PARENT_SCOPE) at top scope +- Fix Xcode <= 2.0 projects with CMAKE_BUILD_TYPE +- Fix flags for Intel Fortran on Windows +- Fix #2199: UseSWIG documentation for swig_generated_file_fullname +- Fix #7915: UseSWIG interaction with JNI +- Fix #8971: FindOpenSSL now works on windows +- Fix #9124: CPackDeb documentation +- Fix #9722: cmake-gui reports error when not able to create build directory +- Fix #9767: Match more valgrind-reported leaks in CTest memcheck +- Fix #9777: Sync CMakeDetermineJavaCompiler paths with FindJava +- Fix #9793: FindJNI should find matching jni.h and jni_md.h +- Fix #9817: FindJNI on Solaris +- Fix FindHDF5 when hdf5.h exists without H5pubconf.h +- Fix FindZLIB to follow variable name conventions +- Fix invalid use of auto_ptr on array +- Mention temp var convention in Modules/readme.txt documentation + +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 ed12ab250..3b455b96f 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/CMakeDetermineJavaCompiler.cmake b/Modules/CMakeDetermineJavaCompiler.cmake index ee7ccb014..483db6b3d 100644 --- a/Modules/CMakeDetermineJavaCompiler.cmake +++ b/Modules/CMakeDetermineJavaCompiler.cmake @@ -51,14 +51,18 @@ IF(NOT CMAKE_Java_COMPILER) "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.5;JavaHome]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;JavaHome]/bin" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin" + $ENV{JAVA_HOME}/bin /usr/bin /usr/lib/java/bin /usr/share/java/bin /usr/local/bin /usr/local/java/bin + /usr/local/java/share/bin /usr/java/j2sdk1.4.2_04 /usr/lib/j2sdk1.4-sun/bin + /usr/java/j2sdk1.4.2_09/bin /usr/lib/j2sdk1.5-sun/bin + /opt/sun-jdk-1.5.0.04/bin ) # if no compiler has been specified yet, then look for one IF(CMAKE_Java_COMPILER_INIT) diff --git a/Modules/CMakeFortranCompilerId.F.in b/Modules/CMakeFortranCompilerId.F.in index 51f4e91d0..c92f127a2 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 4c8d619a3..8233e520b 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 100755 index 000000000..dbba46418 --- /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 ".*.*$" "\\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/CPackDeb.cmake b/Modules/CPackDeb.cmake index 8003ad253..f5ca592ba 100644 --- a/Modules/CPackDeb.cmake +++ b/Modules/CPackDeb.cmake @@ -1,6 +1,50 @@ +# - The builtin (binary) CPack Deb generator (Unix only) +# CPackDeb may be used to create Deb package using CPack. +# CPackDeb is a CPack generator thus it uses the CPACK_XXX variables +# used by CPack : http://www.cmake.org/Wiki/CMake:CPackConfiguration +# +# However CPackRPM has specific features which are controlled by +# the specifics CPACK_RPM_XXX variables.You'll find a detailed usage on +# the wiki: +# http://www.cmake.org/Wiki/CMake:CPackPackageGenerators#DEB_.28UNIX_only.29 +# However as a handy reminder here comes the list of specific variables: +# +# CPACK_DEBIAN_PACKAGE_NAME +# Mandatory : YES +# Default : CPACK_PACKAGE_NAME (lower case) +# The debian package summary +# CPACK_DEBIAN_PACKAGE_VERSION +# Mandatory : YES +# Default : CPACK_PACKAGE_VERSION +# The debian package version +# CPACK_DEBIAN_PACKAGE_ARCHITECTURE) +# Mandatory : YES +# Default : Output of dpkg --print-architecture or i386 +# The debian package architecture +# CPACK_DEBIAN_PACKAGE_DEPENDS +# Mandatory : NO +# Default : - +# May be used to set deb dependencies. +# CPACK_DEBIAN_PACKAGE_MAINTAINER +# Mandatory : YES +# Default : CPACK_PACKAGE_CONTACT +# The debian package maintainer +# CPACK_DEBIAN_PACKAGE_DESCRIPTION +# Mandatory : YES +# Default : CPACK_PACKAGE_DESCRIPTION_SUMMARY +# The debian package description +# CPACK_DEBIAN_PACKAGE_SECTION +# Mandatory : YES +# Default : 'devel' +# The debian package section +# CPACK_DEBIAN_PACKAGE_PRIORITY +# Mandatory : YES +# Default : 'optional' +# The debian package priority #============================================================================= # Copyright 2007-2009 Kitware, Inc. +# Copyright 2007-2009 Mathieu Malaterre # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. diff --git a/Modules/Compiler/G95-Fortran.cmake b/Modules/Compiler/G95-Fortran.cmake new file mode 100644 index 000000000..cbd466118 --- /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 7b79a3daf..2eea45cd0 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 5373852fa..d1d31bceb 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 04f5d528c..428be9e1c 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 34fcb9710..6c512983a 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/FindHDF5.cmake b/Modules/FindHDF5.cmake index 277cbfa93..d2092eff5 100644 --- a/Modules/FindHDF5.cmake +++ b/Modules/FindHDF5.cmake @@ -291,14 +291,15 @@ else() # If the HDF5 include directory was found, open H5pubconf.h to determine if # HDF5 was compiled with parallel IO support + set( HDF5_IS_PARALLEL FALSE ) if( HDF5_INCLUDE_DIR ) - file( STRINGS "${HDF5_INCLUDE_DIR}/H5pubconf.h" - HDF5_HAVE_PARALLEL_DEFINE - REGEX "HAVE_PARALLEL 1" ) - if( HDF5_HAVE_PARALLEL_DEFINE ) - set( HDF5_IS_PARALLEL TRUE ) - else() - set( HDF5_IS_PARALLEL FALSE ) + if( EXISTS "${HDF5_INCLUDE_DIR}/h5pubconf.h" ) + file( STRINGS "${HDF5_INCLUDE_DIR}/H5pubconf.h" + HDF5_HAVE_PARALLEL_DEFINE + REGEX "HAVE_PARALLEL 1" ) + if( HDF5_HAVE_PARALLEL_DEFINE ) + set( HDF5_IS_PARALLEL TRUE ) + endif() endif() endif() set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL diff --git a/Modules/FindJNI.cmake b/Modules/FindJNI.cmake index 8c9523a54..47f96e0ed 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 @@ -192,14 +195,14 @@ FIND_PATH(JAVA_INCLUDE_PATH jni.h ) FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h - ${JAVA_AWT_INCLUDE_DIRECTORIES} + ${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH}/win32 ${JAVA_INCLUDE_PATH}/linux ${JAVA_INCLUDE_PATH}/freebsd + ${JAVA_INCLUDE_PATH}/solaris ) FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h - ${JAVA_AWT_INCLUDE_DIRECTORIES} ${JAVA_INCLUDE_PATH} ) diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index d5014dd5b..e945ec5de 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 . + +# 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/FindOpenSSL.cmake b/Modules/FindOpenSSL.cmake index 0cb611f6d..95b23e1d2 100644 --- a/Modules/FindOpenSSL.cmake +++ b/Modules/FindOpenSSL.cmake @@ -8,6 +8,7 @@ #============================================================================= # Copyright 2006-2009 Kitware, Inc. # Copyright 2006 Alexander Neundorf +# Copyright 2009 Mathieu Malaterre # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -27,19 +28,32 @@ IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) SET(LIB_FOUND 1) ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) -FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h ) +# http://www.slproweb.com/products/Win32OpenSSL.html +FIND_PATH(OPENSSL_INCLUDE_DIR openssl/ssl.h + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/include" +) IF(WIN32 AND MSVC) # /MD and /MDd are the standard values - if somone wants to use # others, the libnames have to change here too # use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b - FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssl ssleay32) - FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssl ssleay32) + FIND_LIBRARY(LIB_EAY_DEBUG NAMES libeay32MDd libeay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + ) + FIND_LIBRARY(LIB_EAY_RELEASE NAMES libeay32MD libeay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + ) + FIND_LIBRARY(SSL_EAY_DEBUG NAMES ssleay32MDd ssl ssleay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + ) + FIND_LIBRARY(SSL_EAY_RELEASE NAMES ssleay32MD ssl ssleay32 + PATHS "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OpenSSL (32-bit)_is1;Inno Setup: App Path]/lib/VC" + ) IF(MSVC_IDE) IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) - SET(OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} debug ${SSL_EAY_DEBUG}) + SET(OPENSSL_LIBRARIES optimized ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE} debug ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG}) ELSE(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) SET(OPENSSL_LIBRARIES NOTFOUND) MESSAGE(STATUS "Could not find the debug and release version of openssl") @@ -47,15 +61,20 @@ IF(WIN32 AND MSVC) ELSE(MSVC_IDE) STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - SET(OPENSSL_LIBRARIES ${SSL_EAY_DEBUG}) + SET(OPENSSL_LIBRARIES ${SSL_EAY_DEBUG} ${LIB_EAY_DEBUG}) ELSE(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) - SET(OPENSSL_LIBRARIES ${SSL_EAY_RELEASE}) + SET(OPENSSL_LIBRARIES ${SSL_EAY_RELEASE} ${LIB_EAY_RELEASE}) ENDIF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) ENDIF(MSVC_IDE) MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE) + MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE) ELSE(WIN32 AND MSVC) - FIND_LIBRARY(OPENSSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD ) + FIND_LIBRARY(OPENSSL_SSL_LIBRARIES NAMES ssl ssleay32 ssleay32MD) + FIND_LIBRARY(OPENSSL_CRYPTO_LIBRARIES NAMES crypto) + MARK_AS_ADVANCED(OPENSSL_CRYPTO_LIBRARIES OPENSSL_SSL_LIBRARIES) + + SET(OPENSSL_LIBRARIES ${OPENSSL_SSL_LIBRARIES} ${OPENSSL_CRYPTO_LIBRARIES}) ENDIF(WIN32 AND MSVC) diff --git a/Modules/FindOpenSceneGraph.cmake b/Modules/FindOpenSceneGraph.cmake index 9a13ea2ab..25cf4ee15 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 2b1241e5d..81d117981 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 3b0eb2f0f..2327186d8 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/FindZLIB.cmake b/Modules/FindZLIB.cmake index dc80ed894..806634306 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -1,9 +1,9 @@ # - Find zlib # Find the native ZLIB includes and library # -# ZLIB_INCLUDE_DIR - where to find zlib.h, etc. -# ZLIB_LIBRARIES - List of libraries when using zlib. -# ZLIB_FOUND - True if zlib found. +# ZLIB_INCLUDE_DIRS - where to find zlib.h, etc. +# ZLIB_LIBRARIES - List of libraries when using zlib. +# ZLIB_FOUND - True if zlib found. #============================================================================= # Copyright 2001-2009 Kitware, Inc. @@ -27,16 +27,14 @@ FIND_PATH(ZLIB_INCLUDE_DIR zlib.h) SET(ZLIB_NAMES z zlib zdll) FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ) +MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR ) + +# Per-recommendation +SET(ZLIB_INCLUDE_DIRS "${ZLIB_INCLUDE_DIR}") +SET(ZLIB_LIBRARIES "${ZLIB_LIBRARY}") # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if # all listed variables are TRUE INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARY ZLIB_INCLUDE_DIR) +FIND_PACKAGE_HANDLE_STANDARD_ARGS(ZLIB DEFAULT_MSG ZLIB_LIBRARIES ZLIB_INCLUDE_DIRS) -IF(ZLIB_FOUND) - SET( ZLIB_LIBRARIES ${ZLIB_LIBRARY} ) -ELSE(ZLIB_FOUND) - SET( ZLIB_LIBRARIES ) -ENDIF(ZLIB_FOUND) - -MARK_AS_ADVANCED( ZLIB_LIBRARY ZLIB_INCLUDE_DIR ) diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index c18104dc8..d90967d2e 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 27a98ed93..da3b935c2 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 ad24db678..ed3a07332 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 + " -o -Wl,--out-implib, ${CMAKE_GNULD_IMAGE_VERSION} ") diff --git a/Modules/Platform/Windows-ifort.cmake b/Modules/Platform/Windows-ifort.cmake index 01848a601..6cffed997 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} ${CMAKE_START_TEMP_FILE} /out: /dll ${CMAKE_END_TEMP_FILE}") + "link ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /out: /implib: /dll ${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 /fo ") SET(CMAKE_Fortran_LINK_EXECUTABLE - " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link ${CMAKE_END_TEMP_FILE}") + " ${CMAKE_CL_NOLOGO} ${CMAKE_START_TEMP_FILE} /Fe -link /implib: ${CMAKE_END_TEMP_FILE}") INCLUDE(Platform/Windows-Intel) @@ -53,10 +53,10 @@ ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 7" OR CMAKE_GENERATOR MATCHES "Visu # does the compiler support pdbtype and is it the newer compiler SET(CMAKE_BUILD_TYPE_INIT Debug) -SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp") -SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full") +SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads") +SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs") SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") -SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/MD /O1 /D NDEBUG") +SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "/O1 /D NDEBUG") SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG") SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index 5e0d18c29..c79efac0f 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -6,7 +6,7 @@ # - Link libraries to swig module # All other macros are for internal use only. # To get the actual name of the swig module, -# use: ${SWIG_MODULE_name_REAL_NAME}. +# use: ${SWIG_MODULE_${name}_REAL_NAME}. # Set Source files properties such as CPLUSPLUS and SWIG_FLAGS to specify # special behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add # special flags to all swig calls. @@ -14,9 +14,14 @@ # where to write all the swig generated module (swig -outdir option) # The name-specific variable SWIG_MODULE__EXTRA_DEPS may be used # to specify extra dependencies for the generated modules. +# If the source file generated by swig need some special flag you can use +# SET_SOURCE_FILES_PROPERTIES( ${swig_generated_file_fullname} +# PROPERTIES COMPILE_FLAGS "-bla") + #============================================================================= # Copyright 2004-2009 Kitware, Inc. +# Copyright 2009 Mathieu Malaterre # # Distributed under the OSI-approved BSD License (the "License"); # see accompanying file Copyright.txt for details. @@ -48,6 +53,9 @@ MACRO(SWIG_MODULE_INITIALIZE name language) SET(SWIG_MODULE_${name}_REAL_NAME "${name}") IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$") + # when swig is used without the -interface it will produce in the module.py + # a 'import _modulename' statement, which implies having a corresponding + # _modulename.so (*NIX), _modulename.pyd (Win32). SET(SWIG_MODULE_${name}_REAL_NAME "_${name}") ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$") IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$") @@ -117,6 +125,8 @@ MACRO(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) # If CMAKE_SWIG_OUTDIR was specified then pass it to -outdir IF(CMAKE_SWIG_OUTDIR) SET(swig_outdir ${CMAKE_SWIG_OUTDIR}) + # it may not exist, so create it: + file(MAKE_DIRECTORY ${CMAKE_SWIG_OUTDIR}) ELSE(CMAKE_SWIG_OUTDIR) SET(swig_outdir ${CMAKE_CURRENT_BINARY_DIR}) ENDIF(CMAKE_SWIG_OUTDIR) @@ -203,8 +213,33 @@ MACRO(SWIG_ADD_MODULE name language) MODULE ${swig_generated_sources} ${swig_other_sources}) - SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME} - PROPERTIES PREFIX "") + STRING(TOLOWER "${language}" swig_lowercase_language) + IF ("${swig_lowercase_language}" STREQUAL "java") + IF (APPLE) + # In java you want: + # System.loadLibrary("LIBRARY"); + # then JNI will look for a library whose name is platform dependent, namely + # MacOS : libLIBRARY.jnilib + # Windows: LIBRARY.dll + # Linux : libLIBRARY.so + SET_TARGET_PROPERTIES (${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".jnilib") + ENDIF (APPLE) + ENDIF ("${swig_lowercase_language}" STREQUAL "java") + IF ("${swig_lowercase_language}" STREQUAL "python") + # this is only needed for the python case where a _modulename.so is generated + SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES PREFIX "") + # Python extension modules on Windows must have the extension ".pyd" + # instead of ".dll" as of Python 2.5. Older python versions do support + # this suffix. + # http://docs.python.org/whatsnew/ports.html#SECTION0001510000000000000000 + # + # Windows: .dll is no longer supported as a filename extension for extension modules. + # .pyd is now the only filename extension that will be searched for. + # + IF(WIN32 AND NOT CYGWIN) + SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME} PROPERTIES SUFFIX ".pyd") + ENDIF(WIN32 AND NOT CYGWIN) + ENDIF ("${swig_lowercase_language}" STREQUAL "python") ENDMACRO(SWIG_ADD_MODULE) # diff --git a/Modules/readme.txt b/Modules/readme.txt index d23c4c3e8..a292e208e 100644 --- a/Modules/readme.txt +++ b/Modules/readme.txt @@ -88,7 +88,7 @@ If the find module supports versioning it should locate a version of the package that is compatible with the version requested. If a compatible version of the package cannot be found the module should not report success. The version of the package found should be stored -in "XXX_VERSION..." version variables docmented by the module. +in "XXX_VERSION..." version variables documented by the module. If the QUIET option is given to the command it will set the variable XXX_FIND_QUIETLY to true before loading the FindXXX.cmake module. If @@ -110,3 +110,6 @@ error if the module is not found. To get this behaviour you can use the FIND_PACKAGE_HANDLE_STANDARD_ARGS() macro, as an example see FindJPEG.cmake. +For internal implementation, it's a generally accepted convention that variables starting with +underscore are for temporary use only. (variable starting with an underscore +are not intended as a reserved prefix). diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index d188b11a8..909969139 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 1c56d81a9..99574b09f 100644 --- a/Source/CPack/cmCPackTGZGenerator.cxx +++ b/Source/CPack/cmCPackTGZGenerator.cxx @@ -23,7 +23,6 @@ #include #include #include -#include // auto_ptr #include #include @@ -219,9 +218,8 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, &mydata }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr realNamePtr(realName); strcpy(realName, outFileName); int flags = O_WRONLY | O_CREAT; int options = 0; @@ -239,9 +237,12 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName, { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " << strerror(errno) << std::endl); + delete [] realName; return 0; } + delete [] realName; + std::vector::const_iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) { diff --git a/Source/CPack/cmCPackTarCompressGenerator.cxx b/Source/CPack/cmCPackTarCompressGenerator.cxx index d7513b633..165c18122 100644 --- a/Source/CPack/cmCPackTarCompressGenerator.cxx +++ b/Source/CPack/cmCPackTarCompressGenerator.cxx @@ -23,7 +23,6 @@ #include #include #include -#include // auto_ptr #include #include @@ -165,9 +164,8 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName, &mydata }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr realNamePtr(realName); strcpy(realName, outFileName); int flags = O_WRONLY | O_CREAT; int options = 0; @@ -185,9 +183,12 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName, { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " << strerror(errno) << std::endl); + delete [] realName; return 0; } + delete [] realName; + std::vector::const_iterator fileIt; for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) { diff --git a/Source/CTest/cmCTestBatchTestHandler.cxx b/Source/CTest/cmCTestBatchTestHandler.cxx index 7c33d7015..00bb6fa70 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 46d9f2601..8a2d65a7b 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 c2135aa62..10768866e 100644 --- a/Source/CTest/cmCTestCoverageHandler.cxx +++ b/Source/CTest/cmCTestCoverageHandler.cxx @@ -676,6 +676,24 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf) #define fnc(s) s #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 lines; std::vector::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(lineIdx) ) + while ( vec.size() <= static_cast(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/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 0c63d833e..47bb56aa5 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -659,8 +659,12 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( "== .*Invalid free\\(\\) / delete / delete\\[\\]"); cmsys::RegularExpression vgFMM( "== .*Mismatched free\\(\\) / delete / delete \\[\\]"); - cmsys::RegularExpression vgMLK( + cmsys::RegularExpression vgMLK1( "== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are definitely lost" + " in loss record [0-9][0-9]* of [0-9]"); + cmsys::RegularExpression vgMLK2( + "== .*[0-9][0-9]* \\([0-9]*,?[0-9]* direct, [0-9]*,?[0-9]* indirect\\)" + " bytes in [0-9][0-9]* blocks are definitely lost" " in loss record [0-9][0-9]* of [0-9]"); cmsys::RegularExpression vgPAR( "== .*Syscall param .* contains unaddressable byte\\(s\\)"); @@ -705,7 +709,11 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput( { failure = cmCTestMemCheckHandler::FMM; } - else if ( vgMLK.find(lines[cc]) ) + else if ( vgMLK1.find(lines[cc]) ) + { + failure = cmCTestMemCheckHandler::MLK; + } + else if ( vgMLK2.find(lines[cc]) ) { failure = cmCTestMemCheckHandler::MLK; } diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index 63dfe7e1c..4f3a6057f 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -15,6 +15,7 @@ #include "cmCTest.h" #include "cmSystemTools.h" #include +#include cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() { @@ -56,6 +57,10 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level) void cmCTestMultiProcessHandler::RunTests() { this->CheckResume(); + if(!this->CheckCycles()) + { + return; + } this->TestHandler->SetMaxIndex(this->FindMaxIndex()); this->StartNextTests(); while(this->Tests.size() != 0) @@ -81,6 +86,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 +101,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()); } //--------------------------------------------------------- @@ -335,10 +345,13 @@ void cmCTestMultiProcessHandler::PrintTestList() this->TestHandler->SetMaxIndex(this->FindMaxIndex()); int count = 0; for (PropertiesMap::iterator it = this->Properties.begin(); - it != this->Properties.end(); it ++ ) + it != this->Properties.end(); ++it) { 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 +373,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); @@ -423,3 +438,47 @@ int cmCTestMultiProcessHandler::FindMaxIndex() } return max; } + +//Returns true if no cycles exist in the dependency graph +bool cmCTestMultiProcessHandler::CheckCycles() +{ + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, + "Checking test dependency graph..." << std::endl); + for(TestMap::iterator it = this->Tests.begin(); + it != this->Tests.end(); ++it) + { + //DFS from each element to itself + std::stack s; + std::vector visited; + s.push(it->first); + visited.push_back(it->first); + + while(!s.empty()) + { + int test = s.top(); + s.pop(); + + for(TestSet::iterator d = this->Tests[test].begin(); + d != this->Tests[test].end(); ++d) + { + s.push(*d); + for(std::vector::iterator v = visited.begin(); + v != visited.end(); ++v) + { + if(*v == *d) + { + //cycle exists + cmCTestLog(this->CTest, ERROR_MESSAGE, "Error: a cycle exists in " + "the test dependency graph for the test \"" + << this->Properties[*d]->Name << "\"." << std::endl + << "Please fix the cycle and run ctest again." << std::endl); + return false; + } + } + visited.push_back(*d); + } + visited.pop_back(); + } + } + return true; +} diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index c99eb3dac..16591b043 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -76,6 +76,8 @@ protected: void RemoveTest(int index); //Check if we need to resume an interrupted test set void CheckResume(); + //Check if there are any circular dependencies + bool CheckCycles(); int FindMaxIndex(); inline size_t GetProcessorsUsed(int index); // map from test number to set of depend tests diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index 982beb340..3e4757b28 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 7bc6f72da..f19a36dd8 100644 --- a/Source/QtDialog/CMakeSetup.cxx +++ b/Source/QtDialog/CMakeSetup.cxx @@ -16,11 +16,6 @@ #include #include #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/CMakeSetupDialog.cxx b/Source/QtDialog/CMakeSetupDialog.cxx index a3de4db43..eb82f2a91 100644 --- a/Source/QtDialog/CMakeSetupDialog.cxx +++ b/Source/QtDialog/CMakeSetupDialog.cxx @@ -294,7 +294,14 @@ void CMakeSetupDialog::doConfigure() { return; } - dir.mkpath("."); + if(!dir.mkpath(".")) + { + QMessageBox::information(this, tr("Create Directory Failed"), + QString(tr("Failed to create directory %1")).arg(dir.path()), + QMessageBox::Ok); + + return; + } } // if no generator, prompt for it and other setup stuff diff --git a/Source/QtDialog/QCMake.cxx b/Source/QtDialog/QCMake.cxx index 3bd64f091..dc31fad44 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 fa6333f1e..6d21ab569 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 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 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 ace67ec38..234c37e56 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 4746f0687..dab0c0d1d 100644 --- a/Source/cmCoreTryCompile.cxx +++ b/Source/cmCoreTryCompile.cxx @@ -317,7 +317,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector 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 f27226228..4bedea357 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::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 listFiles = - it->second[0]->GetMakefile()->GetListFiles(); + // Collect all files + std::vector listFiles; + for (std::vector::const_iterator + jt = it->second.begin(); + jt != it->second.end(); + ++jt) + { + const std::vector & files = + (*jt)->GetMakefile()->GetListFiles(); + listFiles.insert(listFiles.end(), files.begin(), files.end()); + } - for (std::vector::const_iterator jt = listFiles.begin(); - jt != listFiles.end(); - ++jt) - { - const std::string &relative = - cmSystemTools::RelativePath( + // Convert + for (std::vector::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 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 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 61be23302..0a5101ff9 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 abe6bc9f6..bce41376e 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 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::vector::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(data); vec->insert(vec->end(), chPtr, chPtr + size); - + return size; } - - + + } #endif -bool -cmFileCommand::HandleDownloadCommand(std::vector +#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 const& args) { #if defined(CMAKE_BUILD_WITH_CMAKE) @@ -2486,25 +2517,25 @@ cmFileCommand::HandleDownloadCommand(std::vector "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 } 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 } 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 } 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 "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 &*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 d7538621a..c6da30125 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( files... DESTINATION \n" diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index b6ae951ef..abe66a88f 100755 --- 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 000000000..0e821c72a --- /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 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 000000000..51b68c028 --- /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::vectorconst& languages, + cmMakefile *, bool optional); +}; +#endif diff --git a/Source/cmGlobalVisualStudio7Generator.cxx b/Source/cmGlobalVisualStudio7Generator.cxx index dbe9aed11..ea9065ebf 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 73302bcc3..85ba24495 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 Configurations; diff --git a/Source/cmGlobalVisualStudio8Generator.cxx b/Source/cmGlobalVisualStudio8Generator.cxx index 1084fa9fc..8aec865b6 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 no_depends; - std::map >::iterator it; - for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) - { - std::vector& generators = it->second; - if(!generators.empty()) - { - // Add the build-system check target to the first local - // generator of this project. - cmLocalVisualStudio7Generator* lg = - static_cast(generators[0]); - cmMakefile* mf = lg->GetMakefile(); + std::vector const& generators = this->LocalGenerators; + cmLocalVisualStudio7Generator* lg = + static_cast(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 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::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 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::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 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::vector::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 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::vector::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::const_iterator @@ -289,6 +280,29 @@ cmGlobalVisualStudio8Generator } } +//---------------------------------------------------------------------------- +bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies( + cmTarget& target) +{ + // Look for utility dependencies that magically link. + for(std::set::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[] = { diff --git a/Source/cmGlobalVisualStudio8Generator.h b/Source/cmGlobalVisualStudio8Generator.h index 4313b58ca..9d836bda3 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 d799485c8..0c7cf7fed 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 d2c75b2d6..724007314 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"; @@ -1277,7 +1281,10 @@ void cmGlobalXCodeGenerator ) { std::string makefileName=makefileBasename; - makefileName+=configName; + if(this->XcodeVersion > 20) + { + makefileName+=configName; + } cmGeneratedFileStream makefileStream(makefileName.c_str()); if(!makefileStream) { @@ -1833,25 +1840,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 b51fabbd8..76bbd0c29 100644 --- a/Source/cmIfCommand.cxx +++ b/Source/cmIfCommand.cxx @@ -16,6 +16,22 @@ #include #include + +static std::string cmIfCommandError( + cmMakefile* mf, std::vector const& args) +{ + cmLocalGenerator* lg = mf->GetLocalGenerator(); + std::string err = "given arguments:\n "; + for(std::vector::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 &args, makefile, errorString, Policy12Status, - status); + status, true); } //========================================================================= diff --git a/Source/cmIfCommand.h b/Source/cmIfCommand.h index 90d144793..74692b7d9 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 -NOTFOUND.\n" - " if(NOT variable)\n" - "True if the variable's value is empty, 0, N, NO, OFF, FALSE, " - "NOTFOUND, or -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()\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()\n" + "True if the variable's value is not a false constant." + "\n" + " if(NOT )\n" + "True if the expression is not true." + "\n" + " if( AND )\n" + "True if both expressions would be considered true individually." + "\n" + " if( OR )\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 382192e05..8df0ffaff 100755 --- 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 #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( + this->GetGlobalGenerator())); tg.Generate(); } this->WriteStampFiles(); diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 8639adb10..208480891 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(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\tNeedLinkLibraryDependencies(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\tNeedLinkLibraryDependencies(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/cmMakefile.cxx b/Source/cmMakefile.cxx index 88c8c7b6f..d09188ad2 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -3388,14 +3388,20 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef) // Now update the definition in the parent scope. up->Set(var, varDef); } - else if(cmMakefile* parent = - this->LocalGenerator->GetParent()->GetMakefile()) + else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent()) { // Update the definition in the parent directory top scope. This // directory's scope was initialized by the closure of the parent // scope, so we do not need to localize the definition first. + cmMakefile* parent = plg->GetMakefile(); parent->Internal->VarStack.top().Set(var, varDef); } + else + { + cmOStringStream m; + m << "Cannot set \"" << var << "\": current scope has no parent."; + this->IssueMessage(cmake::AUTHOR_WARNING, m.str()); + } } diff --git a/Source/cmPolicies.cxx b/Source/cmPolicies.cxx index 0d35b6567..6b35b5b05 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 cf808bd4c..4d1c3fc89 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/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 219c1efce..031bfc32b 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -46,7 +46,6 @@ #if defined(CMAKE_BUILD_WITH_CMAKE) # include -# include // auto_ptr # include # include # include @@ -1807,9 +1806,8 @@ bool cmSystemTools::CreateTar(const char* outFileName, &gzs }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr realNamePtr(realName); strcpy(realName, outFileName); int options = 0; if(verbose) @@ -1825,9 +1823,12 @@ bool cmSystemTools::CreateTar(const char* outFileName, options) == -1) { cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); + delete [] realName; return false; } + delete [] realName; + std::vector::const_iterator it; for (it = files.begin(); it != files.end(); ++ it ) { @@ -1859,6 +1860,7 @@ bool cmSystemTools::CreateTar(const char* outFileName, cmSystemTools::Error("Problem with tar_close(): ", strerror(errno)); return false; } + return true; #else (void)outFileName; @@ -1886,9 +1888,8 @@ bool cmSystemTools::ExtractTar(const char* outFileName, &gzs }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr realNamePtr(realName); strcpy(realName, outFileName); if (tar_open(&t, realName, (gzip? &gztype : NULL), @@ -1901,9 +1902,12 @@ bool cmSystemTools::ExtractTar(const char* outFileName, | 0) == -1) { cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); + delete [] realName; return false; } + delete [] realName; + if (tar_extract_all(t, 0) != 0) { cmSystemTools::Error("Problem with tar_extract_all(): ", strerror(errno)); @@ -1940,9 +1944,8 @@ bool cmSystemTools::ListTar(const char* outFileName, &gzs }; - // Ok, this libtar is not const safe. for now use auto_ptr hack + // This libtar is not const safe. Make a non-const copy of outFileName char* realName = new char[ strlen(outFileName) + 1 ]; - std::auto_ptr realNamePtr(realName); strcpy(realName, outFileName); if (tar_open(&t, realName, (gzip? &gztype : NULL), @@ -1955,9 +1958,12 @@ bool cmSystemTools::ListTar(const char* outFileName, | 0) == -1) { cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); + delete [] realName; return false; } + delete [] realName; + while ((th_read(t)) == 0) { const char* filename = th_get_pathname(t); diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ccac68a56..f44fb6ba6 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -881,30 +881,25 @@ void cmTarget::DefineProperties(cmake *cm) "an archive target. " \ "All Windows-based systems including Cygwin are DLL platforms." +#define CM_TARGET_OUTDIR_DOC(TYPE, type) \ + "This property specifies the directory into which " #type " target " \ + "files should be built. " \ + CM_TARGET_FILE_TYPES_DOC " " \ + "This property is initialized by the value of the variable " \ + "CMAKE_" #TYPE "_OUTPUT_DIRECTORY if it is set when a target is created." + cm->DefineProperty ("ARCHIVE_OUTPUT_DIRECTORY", cmProperty::TARGET, "Output directory in which to build ARCHIVE target files.", - "This property specifies the directory into which archive target files " - "should be built. " - CM_TARGET_FILE_TYPES_DOC " " - "This property is initialized by the value of the variable " - "CMAKE_ARCHIVE_OUTPUT_DIRECTORY if it is set when a target is created."); + CM_TARGET_OUTDIR_DOC(ARCHIVE, archive)); cm->DefineProperty ("LIBRARY_OUTPUT_DIRECTORY", cmProperty::TARGET, "Output directory in which to build LIBRARY target files.", - "This property specifies the directory into which library target files " - "should be built. " - CM_TARGET_FILE_TYPES_DOC " " - "This property is initialized by the value of the variable " - "CMAKE_LIBRARY_OUTPUT_DIRECTORY if it is set when a target is created."); + CM_TARGET_OUTDIR_DOC(LIBRARY, library)); cm->DefineProperty ("RUNTIME_OUTPUT_DIRECTORY", cmProperty::TARGET, "Output directory in which to build RUNTIME target files.", - "This property specifies the directory into which runtime target files " - "should be built. " - CM_TARGET_FILE_TYPES_DOC " " - "This property is initialized by the value of the variable " - "CMAKE_RUNTIME_OUTPUT_DIRECTORY if it is set when a target is created."); + CM_TARGET_OUTDIR_DOC(RUNTIME, runtime)); cm->DefineProperty ("ARCHIVE_OUTPUT_NAME", cmProperty::TARGET, diff --git a/Source/cmVS10CLFlagTable.h b/Source/cmVS10CLFlagTable.h index 10f2c9be6..a7b1b3651 100755 --- 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 c1f1dda72..c60e8eb20 100755 --- 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 e7a8784f0..32fceada9 100755 --- 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 + static std::string cmVS10EscapeXML(std::string arg) { cmSystemTools::ReplaceString(arg, "&", "&"); @@ -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("\n", 2); this->WriteString("\n", 2); this->WriteString("Win32Proj\n", 2); + this->WriteString("", 2); + (*this->BuildFileStream) << this->Platform << "\n"; this->WriteString("\n", 1); this->WriteString("\n", @@ -151,12 +165,9 @@ void cmVisualStudio10TargetGenerator::Generate() this->WriteString("\n", 1); this->WriteString("\n", 1); this->WriteString("\n", 1); - this->WriteString("\n", 2); + this->WriteString("", 2); this->WriteString("\n", 1); this->WriteString("\n", 1); this->WritePathAndIncrementalLinkOptions(); @@ -187,10 +198,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations() i != configs->end(); ++i) { this->WriteString("BuildFileStream ) << *i << this->Platform << "\">\n"; + (*this->BuildFileStream ) << *i << "|" << this->Platform << "\">\n"; this->WriteString("", 3); (*this->BuildFileStream ) << *i << "\n"; - this->WriteString("Win32\n", 3); + this->WriteString("", 3); + (*this->BuildFileStream) << this->Platform << "\n"; this->WriteString("\n", 2); } this->WriteString("\n", 1); @@ -236,7 +248,15 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues() { this->WriteString("false\n", 2); } - this->WriteString("MultiByte\n", 2); + if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY && + this->ClOptions[*i]->UsingUnicode()) + { + this->WriteString("Unicode\n", 2); + } + else + { + this->WriteString("MultiByte\n", 2); + } this->WriteString("\n", 1); } } @@ -375,6 +395,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups() std::vector clCompile; std::vector customBuild; std::vector none; + std::vector headers; for(std::vector::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("\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("WriteString("WriteString("WriteString("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) << "\n"; } +//---------------------------------------------------------------------------- +void cmVisualStudio10TargetGenerator::ComputeClOptions() +{ + std::vector const* configs = + this->GlobalGenerator->GetConfigurations(); + for(std::vector::const_iterator i = configs->begin(); + i != configs->end(); ++i) + { + this->ComputeClOptions(*i); + } +} -void -cmVisualStudio10TargetGenerator:: -WriteClOptions(std::string const& configName, - std::vector 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 pOptions( + new Options(this->LocalGenerator, 10, Options::Compiler, + cmVS10CLFlagTable)); + Options& clOptions = *pOptions; - this->WriteString("\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 const& includes) +{ + Options& clOptions = *(this->ClOptions[configName]); + this->WriteString("\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("\n", 2); + if(!this->GlobalGenerator->NeedLinkLibraryDependencies(*this->Target)) + { + this->WriteString("\n", 2); + this->WriteString( + " false\n", 2); + this->WriteString("\n", 2); + } } void cmVisualStudio10TargetGenerator::AddLibraries( diff --git a/Source/cmVisualStudio10TargetGenerator.h b/Source/cmVisualStudio10TargetGenerator.h index 127554f9b..989db71a0 100755 --- 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 const & includes); void WriteRCOptions(std::string const& config, @@ -75,6 +78,9 @@ private: std::vector const& sources, std::vector& ); private: + typedef cmVisualStudioGeneratorOptions Options; + typedef std::map 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 SourcesVisited; diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 48a0e8300..a2e4a1130 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 4e3f34e42..4877e5913 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 true|false # 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 22135fee0..e2935eb1e 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 8ed631593..a6dee1b33 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 d8f83605a..871464086 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 f21efd7ad..ae39fdffa 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? @@ -237,7 +242,7 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel ") ADD_TEST(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh) IF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY) - SET_TESTS_PROPERTIES (${name} PROPERTIES TIMEOUT 3500) + SET_TESTS_PROPERTIES (${name} PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT}) ENDIF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY) ENDMACRO(ADD_NIGHTLY_BUILD_TEST) IF(CMAKE_BUILD_NIGHTLY_RELEASES) @@ -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" @@ -1099,6 +1188,15 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) + 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" @@ -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.in" + "${CMake_BINARY_DIR}/Tests/CTestTestRunScript/test.cmake" + @ONLY ESCAPE_QUOTES) + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/CTestTestRunScript/hello.cmake.in" + "${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}([Cc]ould *n.t resolve host") + set(regex "${regex}|[Cc]ould *n.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 000000000..dcf4a23c6 --- /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 000000000..08549cc5e --- /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 000000000..19391d7f1 --- /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 456e2e9ae..adaf24774 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 0000000000000000000000000000000000000000..803ac43f35e146bab31a5a998a00377da7fb6d64 GIT binary patch literal 2824 zcmb7GUuauZ7(Z##HFFWWtwYqJ5mId*db`d}tfI{RSyv3xIyX16F5EV0b4UJ}ds90o zm@X}}WRbwCOrI2<=gFWIE0i6Q7LE@k2_th=s(+Fds>A@REq{tCms_VqOUa#4sZiH zQ3W`GN}v`&YR8-|Vk>NdKE@_2!CV21!$EMqsImRl*fe~Ao3Q{Z75FPaI|cqJ_=ulj z6ZCTpq5=E{tW9*nCZwgFgosZaox>)xPib>G#(4+hMF`20fDU!aEs51K+mff4QjDK zN)H9WqpQS=s#;7m>uNL+2{k7Zsu335zMl4uzz$_Q0z)dWEB^S52uh8nJxEWFZHmNu zPS*w`oJL=bew;lvynpJ}zRVrxB5D4y!cF9zJ-K3<=ERRi)#BqAUHpkn8gmZ%uNKUm zBbaH{kD}!qvz`&dRBzwFG_#(O!}Q&rhe?N&mOqY6{gSy^eC>_b!?PK%zDLu0Abc9# zVgcm4`Fo_4Tl&R37fbERZkvX3K990%I)P?xxgvMaY+KNu$bHQUe8=~`;P?r3fVd@SNTV<6whjg_cF6= z8e6}kHki-+?lkAKl^9ChwfAV{R(`H-X7xF;I)pQ1Jv*#hfb)ZJ-?FF9x@H|c1iS#a zfpNT(P*CD`-NIUMsIC6|Lw<7vZ*iiqs@SPKB4Gg-AEd0zfiQ85lSY65{nxl<>mICCPN)6Swpdu(x1}sa?^rB zp%qs3uuy`>V*0VD-5W{UGaO3lT0C}-5r8ilijZ$BiHN}kHMB-(1nnRUxZ*+8P=yi- z2L_XBG$fP(Bc9Z;fZZJ(Kp+HBquKx#h+`re#foOn?AO5_h)1KLm?0n5f9QGMJRhE~ z_5FdtGn7Ifg=5tKdDeFV4i9uGd|y(Y1SD?{>S_;oUdv-QlJ^`;)*$1tE+Zu#>ybhp z!SCi0YKJ`5Z5})i^tHT~Fvh)*$9g^k-Y)3O1*#Q`^}8EjO_Rs^FT%;XmqIROFTmO* zk9FG#g+(aW;CV=;iCe6i0!L0C~JG5h&&HxL4XbAbGrB26)Vy>+&v3 z-Y9hD%5mQFaqzZ7mqH%pZ9wwQfp=~l9=XTMc>FI@1dnGTg*i|r0U3|)mBW}^XL;;K zuKR9@hcIFUyb(CKKPi&;J_Z<%yfk=eIHZqUsec5WJf0ojp!~nHUc67sc>JK8xDW5k zG9Eu1)8NUq;QCuX3!TrH>stSxK;nNVo-c)Sn8yV`=Ev`L0>!;H9__g@9^b15czmZy zA&0mI$as_BO@g=He&@mCIP>ENGk+f*{}3>qtP%2f2c^&_!B|qRfOlOQ=*gk{1y*S9 A5dZ)H literal 0 HcmV?d00001 diff --git a/Tests/CMakeTests/ELF/elf32msb.bin b/Tests/CMakeTests/ELF/elf32msb.bin new file mode 100644 index 0000000000000000000000000000000000000000..d04aaf76c183034b9539f49c08c4f25d0cee2633 GIT binary patch literal 17984 zcmeHPYiJzT6+W{st>TrnPVCrq?RwQpwVYZj#g8Tpg2*8abx2x+X$y_Rbfq1wH{BPz zD^&(V#;#oSV}nJ1^Z_AOh*eB1f=WcGp-w_-689O3DYT(b(L&_@CPdw&?99fl+#8GyVvf&8q0g*>;42X22l#({- zl`XOv^)dRAMp0fg8iA#T(Z%MZQQ$2`mA@hqf`0&hrSSPi>5sz?apvJy3b4(nYL7D8 zUxi;O$|dpr#kz*1f2>yRFXV^!@8fkOT`Q;W zhfj%<(sl*HQeat5%InJ^vM0MFqAWTbAijNR(-U585O2YMTv_?&s?!uWE{c()M6SR_ zlM=cK8%s)T3idA0@iy!RD0@plDIL62G*=F6R3y6z7VT6$JLfV~&}&A{G=SoXV@wn;8M`i3)~dat~Mx*w?e zblsb%OFCc5*Tr=YRdXZa7DvisCBj-gQ>}|PL7!I|&sWPODQ5B|xT=M$TONMKJ?>?) zy5TrXUblc7)o9_?^10E9C+Vy=JeG6wrO|Rwu8a+rGDWWz;6lE%8kebNO1U-HXcd7$ zTxNK<>W$0VQ(4R9?@teKf?1)uUN%$Dh`zd>TA#kUu2&dUGxnsG4e9ELZo+xy5|DE!;7tngmwJ1z2@ z!7rHTn+9Jr_>#dnjYB^+_^k2IXzY9*=MC@A7K2@$Kfu1hMc{ehZ3d46U&R@eGWc0@ zPHi@LN}s#V+XheT^Vqp!@YnTu99lN`1#_m3>7?8fR{i~f4-Q3RXBY5+H7tKK<6{%4{yBb1 z`SpBu=x+okaks{J-zSd2AK)cmymz??)p(2Rv4i;!(M><@ud{JImUqqkjbE;<$Nauf z>kHa%UytPh;2Cru*(B;!{SGkS@j-t-YQe$tiFhS=?`+^Re4QHw@;TrKVdDnx!+I*f z!FrzrZU9FNA01{s!T65>&(m+_gW_$7!&|>9P9k*X7eJ2mp5oc&$kvDdOzT{WyhWRE z$}Vl_;peW=Mx%2x%4Qc7j=$D+jyMtVU!@KGb^o7eBX4}+G_4%C&U;4uQ`*?MrLU>_ zgOC41;ruM$osJxwQ|;tnlxM3W;ZJ9^J^T`F_}p%C=Y(JT9_}s1`_<3S(8iuN?TXq) zpShs=i9J*}K))1pee76ZFTAMhjs23gv8N37eyGNin6?|g{F%Cnm%^jU#*QhQc)FA4 zyd$x9BD5X9OY_Wfr0oHIPdTx>Ub&*|(J94K?C8{c${&-Cv)}TQ;l+ubaOy_;fo=L6 zYpLTIucX^qSw4FnA3d`Y3BP!~d-vs)@td~UH1 zUv9qKe6Y{)Z}c>l{0Vt;psTTjm&c++2H9#b-q+~zC+2V>D=f=BtQ*8BjrvA-@M_mw zxAE!N={c?i!Gl^Kb1-kcoc8H;+qxo!}QuzoO#pyyM4@J|lLQ2u^zUt`j5$gcUFsSOzQumI2FvWxz6E8L$jk1}p=X0n318z%pPNunbrRECZGS%fSCV1I)c<9$<1^ zn%S+FeW&s4t#jcosm}8kBc12>7nnE4Tsh{)nVh)h0e3K`-jT>nT8cB&KD4XtP!O}3 zg&_AZu`}5=q&=J#>U9nx6M!MN)7KM0-dxC=mSDxa(EW`w*J%^Uj1oaC%?+;$A?eCK!zdr9h$cY~*7gff& z&MjAo=A+0$M>@DlHuuJnj$Siq{mnHh#Xns;jx=**v4fmD5OPTk>3m_GGu+fZV#@p% zLPuQ34WJ2B{H8d#lx#&Dv+LO3JmR1#M_qf7A8K$4Hi)~5IBHM_mx^Pb{1*ZR{qesE z>fZ_6BW%lgvp?c}&@hy7_&)?y{TBjNN`iGf1jI~0#PNR;R0q16L(Vwr5S01ph~s}I zsG((Gj>~*Q#w4Mi!u(ROh~s}8)V~~*CFQfV&u?ou>61fU%erXY|htuU(_Qc)5Th`ZbFmR;PRx;rI{ zL2a@?7?0X7vZN{@(WE3s2|U=KO{)9^f6%_bc+Q=3$}pl56HhYt zJLlZ<-E;1pxp!vXd^WOO@puG_BDM;&>RwH{>{f{PACV^cdW2tS;tA0v8o}d(OOri_ zw#Hbep&9)Y=LKv)T_J~}*$QEsZ9xWGxI#qCcTY4@ZA@T6AdEr;q>Vi6N>P8RF(&meSRNU0L9N<79192kU==ZAB{tBuBMQ#7#9)(}L$Z11653-Arh7zxx*(Iij# zG#SYll$H>T%zFWNR3b(EGjN?9nedHrDH*iz(T|NOFojy~rF=0gke z0uP8@0Y0qhFA|OJ&*pQ{q7g3`(Wrpw4&m&&MKp>!b!6k|oaiXVvm=>gM`0vxq{NO$ zcw1j|y}DlAAP2Q);DO3Jp@>bkDKvjfYIrZOR+bp~o50~*3%z{ZKRX1@ z*S*W0_yAd`ozO0*9_3{t523`uE zuh$zip`SlDCE@%jfZ4M^_^n#STzbV9hJo~>bwjbHWU8uDcI)QMix@bzWe>!O(dW;M zHO7QqS+)ylp%NPB=Dhm&9!uYNxwxvieGKc+$G3TO(-(putMzjkRaw@Kl#Q1QSHJKr z1l5D-_FkAA9v)Vk+m9ek?AFU$EKdLiFlUSvXV8VUwVXW;iNfaOgod1Q%Y87jf z5onP7ilaHk)6GoqQp7wQoYTicWf(XzzU452nFvltpmR228o^t-xi1K_zupsBd#BgD z8#Zt2=k9pJ=GU{Y+_fzI=nbQ7-4)CmF|S6{Im>wb6FhdB+xua%L703O5&j(c{M1-`P>G<*9BJ<{3f7y?j7Y=7snYDEp;KG84x#xcI{B4I@LC<(*_ll0Ktmu#E$FEiH+@+ z?9<}1LOw99AR&P?(GDmIP$5;T5S3V00h$I9DyZ;bC{iOK(F%bSA&>$T%I}to{Pu$wUK>}Ki=NSYA7VQe-Iljy;1orozG+K2wBh8EV*|-b8FV1xk`@D*$1G-P`>{rSd!;<~ z;7%^bGmUCy2iwe`ZE*`?YedmHa{;}&*u^WQEfg2T1Z1Vm-JSG=ixP)qhwgfj-z}ho zn>R^(0*cQ%yR18)q?-lZV|jDQ+27`Hqr;R#gN*4%zXRU!-B{T_vN&hExzP1;}N8C77Hd8*!l7auvF{Pp*~@^lOQ z&)T+3vpC(POnIu@q+D*aUK*#|-nit zXqu>_p|;D9jn#|CDLkc(Qh7&am?u~uesaY^zL_Um=8CdDTjp}b%7o0gSf|{CSZtY_ z5FcCSCdL{Kk|LL@)vF~8@4Rx&{8*)kg%%psT%p{kRr2G-$s&Tay^)`+Rf^l|wS4mk z$Fo_i*C_Mk{sRXy)mpP$o#K@~gC&>8DTCQp5G!FC%{pa{rJN_L5}&~U51*y`@VGOJ+DhSbqh~~|Yf;gC?Cw!9b>0=)o{{%4 z@6~s+0@;9v_b{IqIYYoVBYdv-Z0h^%cD{U`qGv$P4>-O5qJDZd_zseD6g9d!--~>w z@cZvQj#GFiDtwQ;3(qDzoAL1Z-hwBMXDc3-_gavW?<2i)J`myWrrLN4G z@E7F+WdzNZ2%im2#;jjCe>VT~HvFc0!}hu^KHD2YzHh|!&-_BzkN)2h>-E)nvlhJU zTYZn(zD&>RJpDf8N7J^glvh{h&4%0X_pi>=?sa7Ux&>t4o9I1>=SrmgW07%xc^m!# z{qquO%l-80pBC&Ny|0$QeAzx3oWA~5;ded$Z_&$V`M-#vUFXD)c6IZb4aGiMu(@Rz44oqVxP2ri9;5$jpf_mbr;($h}=jMIz1 zknt#CaqZ_n)|7Fm@~~jyDZ$jCKKq_bT!}N^`-cp_Hw^Xc{tsi~o*({P@ZhY(CvkB0 zk77q5lAzve-jZ=XYmY`pvDy7rsOB(pgHzUb@j=dgaz)Y~k=g zd>zJwjBFxP_%0<&FP=X$f;VyO^uiFugUfVt&ybl}8koO6vp_!`9-6<7gT6rV5%wBM z4$W_!S-6R}l<2fLz}yJlbn{zV$=Jy2L+ARPP1?4Cn^@(whgx*&4CaA(%h+hoZLd8v zvl!(@5Epgwp&x`@}NuCo>@|uu`mA3q7mhldf=3ILgL-8eBLp{4DyQOC|>Xwcw;rA0vDz!Q2 z$%e*`c43}dDs02GH#_b$JL&pRji)vfCdsVG#`fGPKD~1Kly>c2XViG1iupT>g}a_t zWW2kGo7uzNNAe&0bzI((XMd`m#3d=YWjF}QWC#y zinru@Paqi_>DiL=T|ADg@P^B-k1~>JpJ^OH+BcHPC7}PGg5zs{AopE?Fi$s{ue)rp zXujZ@8jdVmL2`~Aek}W)19UsbI%L*DyNvpCt~qCSu{i&B-tVxZvp~)UQ&E4uqS6>& z#rbP~u%hIZv%juW{WpN)e7TtGK>gi(;||;3!EntaA5-f)P|>+Lf6X^mQ?tjPJvGKS>Mp|1WLQQwR8r-3ZaU-Oq0CC?w(eeJw>jRWHo@K;^^ z-Ma1fBVgtb>l#sQkI(b?I3D$v-!Z%omgPmWpGx2=y#CMP>GU7AcKx1>mB_6Z)Uyy literal 0 HcmV?d00001 diff --git a/Tests/CMakeTests/ELFTest.cmake.in b/Tests/CMakeTests/ELFTest.cmake.in new file mode 100644 index 000000000..0271abb1f --- /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 b19ad0a25..721f311f9 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 000000000..c4e27bd27 --- /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 000000000..e5211b4fa --- /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/CPackComponents/CMakeLists.txt b/Tests/CPackComponents/CMakeLists.txt index 862d13911..3ef808363 100644 --- a/Tests/CPackComponents/CMakeLists.txt +++ b/Tests/CPackComponents/CMakeLists.txt @@ -16,8 +16,16 @@ target_link_libraries(mylibapp mylib) # On Linux, enable using an absolute install path to verify that # CMAKE_INSTALL_PREFIX and CPACK_SET_DESTDIR interact properly. +# +# But only use absolute paths if not targeting an NSIS installer +# as indicated by CPACK_BINARY_NSIS. (If we allow this, the test +# fails on Linux machines with makensis installed when we are not +# cross-compiling...) +# if(UNIX AND NOT APPLE) - set(mylib_install_to_absolute_path ON) + if(NOT CPACK_BINARY_NSIS) + set(mylib_install_to_absolute_path ON) + endif() endif() if(mylib_install_to_absolute_path) diff --git a/Tests/CPackTestAllGenerators/CMakeLists.txt b/Tests/CPackTestAllGenerators/CMakeLists.txt new file mode 100644 index 000000000..5eeb7e90b --- /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 000000000..e0c241ec4 --- /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 51aa887bf..85cb30cef 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 000000000..a8930cf72 --- /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 000000000..8ea5e404f --- /dev/null +++ b/Tests/CTestTest/SmallAndFast/intentional_compile_warning.cxx @@ -0,0 +1,11 @@ +#include + +int main(int argc, const char* argv[]) +{ + unsigned int i = 0; // "i + +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/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 75adb99af..62bed8782 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -142,6 +142,17 @@ IF(NOT "${TRY_OUT}" MATCHES "hello world") MESSAGE(SEND_ERROR " TRY_OUT didn't contain \"hello world\": \"${TRY_OUT}\"") ENDIF(NOT "${TRY_OUT}" MATCHES "hello world") +TRY_RUN(ARG_TEST_RUN ARG_TEST_COMPILE + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + ${TryCompile_SOURCE_DIR}/expect_arg.c + OUTPUT_VARIABLE TRY_OUT + ARGS arg1 arg2) +IF(NOT ARG_TEST_COMPILE) + MESSAGE(SEND_ERROR "expect_arg failed compiling: ${TRY_OUT}") +ENDIF(NOT ARG_TEST_COMPILE) +IF(NOT "${ARG_TEST_RUN}" STREQUAL "0") + MESSAGE(SEND_ERROR "expect_arg failed running with exit code ${ARG_TEST_RUN} ${TRY_OUT}") +ENDIF(NOT "${ARG_TEST_RUN}" STREQUAL "0") # try to run a file that should compile and run, but return an error TRY_RUN(SHOULD_EXIT_WITH_ERROR SHOULD_COMPILE diff --git a/Tests/TryCompile/expect_arg.c b/Tests/TryCompile/expect_arg.c new file mode 100755 index 000000000..7ca49aa43 --- /dev/null +++ b/Tests/TryCompile/expect_arg.c @@ -0,0 +1,22 @@ +#include +#include +int main(int ac, char*av[]) +{ + int i; + printf("ac = [%d]\n", ac); + for(i =0; i < ac; i++) + { + printf("arg[%d] = %s\n", i, av[i]); + } + if(ac == 3) + { + if(strcmp(av[1], "arg1") ==0 + && strcmp(av[2], "arg2") ==0) + { + printf("arg1 and arg2 present and accounted for!\n"); + return 0; + } + } + printf("arg1 and arg2 missing!\n"); + return -1; +} diff --git a/Utilities/Release/dash2win64_release.cmake b/Utilities/Release/dash2win64_release.cmake index 2869ab46d..19fec1488 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 936f21ec1..bb575b32c 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 ef6e2f181..599ccfe25 100644 --- a/Utilities/cmtar/compat/snprintf.c +++ b/Utilities/cmtar/compat/snprintf.c @@ -42,6 +42,10 @@ #include +#if defined(__INTEL_COMPILER) +# pragma warning disable 177 /* function declared but not referenced */ +#endif + #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) #include diff --git a/Utilities/cmtar/libtar.c b/Utilities/cmtar/libtar.c index 0d031b7f8..25f570fd3 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