Merge branch 'upstream' into experimental

ci/unstable
Modestas Vainius 15 years ago
commit 1307deacd9

@ -141,12 +141,13 @@ MACRO(CMAKE_SETUP_TESTING)
# cmake. # cmake.
SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest") SET(CMAKE_CTEST_COMMAND "${EXECUTABLE_OUTPUT_PATH}/ctest")
SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake") SET(CMAKE_CMAKE_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cmake")
SET(CMAKE_CPACK_COMMAND "${EXECUTABLE_OUTPUT_PATH}/cpack")
ENDIF(BUILD_TESTING) ENDIF(BUILD_TESTING)
# configure some files for testing # configure some files for testing
CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in" CONFIGURE_FILE("${CMAKE_CURRENT_SOURCE_DIR}/Templates/CTestScript.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake" "${CMAKE_CURRENT_BINARY_DIR}/CTestScript.cmake"
@ONLY) @ONLY)
CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage CONFIGURE_FILE(${CMake_SOURCE_DIR}/Tests/.NoDartCoverage
${CMake_BINARY_DIR}/Tests/.NoDartCoverage) ${CMake_BINARY_DIR}/Tests/.NoDartCoverage)
CONFIGURE_FILE(${CMake_SOURCE_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_MAJOR 2)
SET(CMake_VERSION_MINOR 8) SET(CMake_VERSION_MINOR 8)
SET(CMake_VERSION_PATCH 0) SET(CMake_VERSION_PATCH 0)
SET(CMake_VERSION_RC 3) SET(CMake_VERSION_RC 5)
# We use odd minor numbers for development versions. # We use odd minor numbers for development versions.
# Use a date for the development patch level. # Use a date for the development patch level.

@ -53,4 +53,7 @@ SET(CTEST_CUSTOM_COVERAGE_EXCLUDE
# Exclude try_compile sources from coverage results: # Exclude try_compile sources from coverage results:
"/CMakeFiles/CMakeTmp/" "/CMakeFiles/CMakeTmp/"
# Exclude Qt source files from coverage results:
"[A-Za-z]./[Qq]t/qt-.+-opensource-src"
) )

@ -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 Changes in CMake 2.8.0 RC 3
- CTest Added OS Platform (cpu architecture) detection support to windows system - CTest Added OS Platform (cpu architecture) detection support to windows system
- Several minor FindBoost changes to address posts on mailing list - Several minor FindBoost changes to address posts on mailing list

@ -21,13 +21,18 @@ IF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6") ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio 6")
INCLUDE (${CMAKE_ROOT}/Modules/CMakeBackwardCompatibilityCXX.cmake) 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. # Disable deprecation warnings for standard C functions.
# really only needed for newer versions of VS, but should # really only needed for newer versions of VS, but should
# not hurt other versions, and this will work into the # not hurt other versions, and this will work into the
# future # future
IF(MSVC) IF(MSVC OR _INTEL_WINDOWS)
ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE) ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
ENDIF(MSVC) ELSE()
ENDIF()
#silence duplicate symbol warnings on AIX #silence duplicate symbol warnings on AIX
IF(CMAKE_SYSTEM MATCHES "AIX.*") IF(CMAKE_SYSTEM MATCHES "AIX.*")

@ -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.5;JavaHome]/bin"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.4;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" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;JavaHome]/bin"
$ENV{JAVA_HOME}/bin
/usr/bin /usr/bin
/usr/lib/java/bin /usr/lib/java/bin
/usr/share/java/bin /usr/share/java/bin
/usr/local/bin /usr/local/bin
/usr/local/java/bin /usr/local/java/bin
/usr/local/java/share/bin
/usr/java/j2sdk1.4.2_04 /usr/java/j2sdk1.4.2_04
/usr/lib/j2sdk1.4-sun/bin /usr/lib/j2sdk1.4-sun/bin
/usr/java/j2sdk1.4.2_09/bin
/usr/lib/j2sdk1.5-sun/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 no compiler has been specified yet, then look for one
IF(CMAKE_Java_COMPILER_INIT) IF(CMAKE_Java_COMPILER_INIT)

@ -6,6 +6,8 @@
PRINT *, 'INFO:compiler[Intel]' PRINT *, 'INFO:compiler[Intel]'
#elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95) #elif defined(__SUNPRO_F90) || defined(__SUNPRO_F95)
PRINT *, 'INFO:compiler[SunPro]' PRINT *, 'INFO:compiler[SunPro]'
#elif defined(__G95__)
PRINT *, 'INFO:compiler[G95]'
#elif defined(__GNUC__) #elif defined(__GNUC__)
PRINT *, 'INFO:compiler[GNU]' PRINT *, 'INFO:compiler[GNU]'
#elif defined(__IBMC__) #elif defined(__IBMC__)

@ -21,8 +21,8 @@ ENDIF(NOT CMAKE_CROSSCOMPILING)
FIND_PROGRAM(CMAKE_MAKE_PROGRAM FIND_PROGRAM(CMAKE_MAKE_PROGRAM
NAMES MSBuild NAMES MSBuild
HINTS HINTS
"$ENV{SYSTEMROOT}/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/v4.0.20506/ "c:/WINDOWS/Microsoft.NET/Framework/[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\10.0;CLR Version]/"
) )
FIND_PROGRAM(CMAKE_MAKE_PROGRAM FIND_PROGRAM(CMAKE_MAKE_PROGRAM

@ -0,0 +1,115 @@
# CMakeVerifyManifest.cmake
#
# This script is used to verify that embeded manifests and
# side by side manifests for a project match. To run this
# script, cd to a directory and run the script with cmake -P.
# On the command line you can pass in versions that are OK even
# if not found in the .manifest files. For example,
# cmake -Dallow_versions=8.0.50608.0 -PCmakeVerifyManifest.cmake
# could be used to allow an embeded manifest of 8.0.50608.0
# to be used in a project even if that version was not found
# in the .manifest file.
# This script first recursively globs *.manifest files from
# the current directory. Then globs *.exe and *.dll. Each
# .exe and .dll is scanned for embeded manifests and the versions
# of CRT are compared to those found in the .manifest files
# from the first glob.
#=============================================================================
# Copyright 2008-2009 Kitware, Inc.
#
# Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even the
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# See the License for more information.
#=============================================================================
# (To distributed this file outside of CMake, substitute the full
# License text for the above reference.)
# crt_version:
# function to extract the CRT version from a file
# this can be passed a .exe, .dll, or a .manifest file
# it will put the list of versions found into the variable
# specified by list_var
function(crt_version file list_var)
file(STRINGS "${file}" strings REGEX "Microsoft.VC...CRT" NEWLINE_CONSUME)
foreach(s ${strings})
set(has_match 1)
string(REGEX
REPLACE ".*<assembly.*\"Microsoft.VC...CRT\".*version=\"([^\"]*)\".*</assembly>.*$" "\\1"
version "${s}")
if(NOT "${version}" STREQUAL "")
list(APPEND version_list ${version})
else()
message(FATAL_ERROR "Parse error could not find version in [${s}]")
endif()
endforeach(s)
if(NOT DEFINED has_match)
message("Information: no embeded manifest in: ${file}")
return()
endif()
list(APPEND version_list ${${list_var}})
list(REMOVE_DUPLICATES version_list)
if(version_list)
set(${list_var} ${version_list} PARENT_SCOPE)
endif()
endfunction(crt_version)
set(fatal_error FALSE)
# check_version:
#
# test a file against the shipped manifest versions
# for a directory
function(check_version file manifest_versions)
set(manifest_versions ${manifest_versions} ${allow_versions})
# collect versions for a given file
crt_version(${file} file_versions)
# see if the versions
foreach(ver ${file_versions})
list(FIND manifest_versions "${ver}" found_version)
if("${found_version}" EQUAL -1)
message("ERROR: ${file} uses ${ver} not found in shipped manifests:[${manifest_versions}].")
set(fatal_error TRUE PARENT_SCOPE)
endif()
endforeach(ver)
list(LENGTH file_versions len)
if(${len} GREATER 1)
message("WARNING: found more than one version of MICROSOFT.VC80.CRT referenced in ${file}: [${file_versions}]")
endif()
endfunction()
# collect up the versions of CRT that are shipped
# in .manifest files
set(manifest_version_list )
file(GLOB_RECURSE manifest_files "*.manifest")
foreach(f ${manifest_files})
crt_version("${f}" manifest_version_list)
endforeach(f)
list(LENGTH manifest_version_list LEN)
if(LEN EQUAL 0)
message(FATAL_ERROR "No .manifest files found, no version check can be done.")
endif()
message("Versions found in ${manifest_files}: ${manifest_version_list}")
if(DEFINED allow_versions)
message("Extra versions allowed: ${allow_versions}")
endif()
# now find all .exe and .dll files
# and call check_version on each of them
file(GLOB_RECURSE exe_files "*.exe")
file(GLOB_RECURSE dll_files "*.dll")
set(exe_files ${exe_files} ${dll_files})
foreach(f ${exe_files})
check_version(${f} "${manifest_version_list}")
endforeach()
# report a fatal error if there were any so that cmake will return
# a non zero value
if(fatal_error)
message(FATAL_ERROR "This distribution embeds dll "
" versions that it does not ship, and may not work on other machines.")
endif()

@ -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 Kitware, Inc.
# Copyright 2007-2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.

@ -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")

@ -45,7 +45,10 @@ UpdateCommand: @UPDATE_COMMAND@
UpdateOptions: @UPDATE_OPTIONS@ UpdateOptions: @UPDATE_OPTIONS@
UpdateType: @UPDATE_TYPE@ UpdateType: @UPDATE_TYPE@
# Dynamic analisys and coverage # Compiler info
Compiler: @CMAKE_CXX_COMPILER@
# Dynamic analysis and coverage
PurifyCommand: @PURIFYCOMMAND@ PurifyCommand: @PURIFYCOMMAND@
ValgrindCommand: @VALGRIND_COMMAND@ ValgrindCommand: @VALGRIND_COMMAND@
ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@ ValgrindCommandOptions: @VALGRIND_COMMAND_OPTIONS@

@ -32,7 +32,7 @@
# (To distributed this file outside of CMake, substitute the full # (To distributed this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
MACRO(SET_FEATURE_INFO _name _desc) FUNCTION(SET_FEATURE_INFO _name _desc)
SET(_url "${ARGV2}") SET(_url "${ARGV2}")
SET(_comment "${ARGV3}") SET(_comment "${ARGV3}")
SET_PROPERTY(GLOBAL PROPERTY ${_name}_DESCRIPTION "${_desc}" ) SET_PROPERTY(GLOBAL PROPERTY ${_name}_DESCRIPTION "${_desc}" )
@ -42,10 +42,10 @@ MACRO(SET_FEATURE_INFO _name _desc)
IF(_comment MATCHES ".+") IF(_comment MATCHES ".+")
SET_PROPERTY(GLOBAL PROPERTY ${_name}_COMMENT "${_comment}" ) SET_PROPERTY(GLOBAL PROPERTY ${_name}_COMMENT "${_comment}" )
ENDIF(_comment MATCHES ".+") ENDIF(_comment MATCHES ".+")
ENDMACRO(SET_FEATURE_INFO) ENDFUNCTION(SET_FEATURE_INFO)
MACRO(_PRINT_FEATURES _property _text) FUNCTION(_PRINT_FEATURES _property _text)
SET(_currentFeatureText "${_text}") SET(_currentFeatureText "${_text}")
GET_PROPERTY(_EnabledFeatures GLOBAL PROPERTY ${_property}) GET_PROPERTY(_EnabledFeatures GLOBAL PROPERTY ${_property})
FOREACH(_currentFeature ${_EnabledFeatures}) FOREACH(_currentFeature ${_EnabledFeatures})
@ -64,15 +64,15 @@ MACRO(_PRINT_FEATURES _property _text)
ENDIF(_info) ENDIF(_info)
ENDFOREACH(_currentFeature) ENDFOREACH(_currentFeature)
MESSAGE(STATUS "${_currentFeatureText}\n") MESSAGE(STATUS "${_currentFeatureText}\n")
ENDMACRO(_PRINT_FEATURES) ENDFUNCTION(_PRINT_FEATURES)
MACRO(PRINT_ENABLED_FEATURES) FUNCTION(PRINT_ENABLED_FEATURES)
_PRINT_FEATURES( ENABLED_FEATURES "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:") _PRINT_FEATURES( DISABLED_FEATURES "Disabled features:")
ENDMACRO(PRINT_DISABLED_FEATURES) ENDFUNCTION(PRINT_DISABLED_FEATURES)

@ -569,6 +569,8 @@ ELSE (_boost_IN_CACHE)
endif() endif()
elseif (MSVC90) elseif (MSVC90)
SET (_boost_COMPILER "-vc90") SET (_boost_COMPILER "-vc90")
elseif (MSVC10)
SET (_boost_COMPILER "-vc100")
elseif (MSVC80) elseif (MSVC80)
SET (_boost_COMPILER "-vc80") SET (_boost_COMPILER "-vc80")
elseif (MSVC71) elseif (MSVC71)

@ -469,8 +469,8 @@ endif (NOT CUDA_TOOLKIT_ROOT_DIR)
# CUDA_NVCC_EXECUTABLE # CUDA_NVCC_EXECUTABLE
find_program(CUDA_NVCC_EXECUTABLE find_program(CUDA_NVCC_EXECUTABLE
NAMES nvcc NAMES nvcc
PATHS "${CUDA_TOOLKIT_ROOT_DIR}/bin64" PATHS "${CUDA_TOOLKIT_ROOT_DIR}/bin"
"${CUDA_TOOLKIT_ROOT_DIR}/bin" "${CUDA_TOOLKIT_ROOT_DIR}/bin64"
ENV CUDA_BIN_PATH ENV CUDA_BIN_PATH
NO_DEFAULT_PATH NO_DEFAULT_PATH
) )

@ -291,14 +291,15 @@ else()
# If the HDF5 include directory was found, open H5pubconf.h to determine if # If the HDF5 include directory was found, open H5pubconf.h to determine if
# HDF5 was compiled with parallel IO support # HDF5 was compiled with parallel IO support
set( HDF5_IS_PARALLEL FALSE )
if( HDF5_INCLUDE_DIR ) if( HDF5_INCLUDE_DIR )
file( STRINGS "${HDF5_INCLUDE_DIR}/H5pubconf.h" if( EXISTS "${HDF5_INCLUDE_DIR}/h5pubconf.h" )
HDF5_HAVE_PARALLEL_DEFINE file( STRINGS "${HDF5_INCLUDE_DIR}/H5pubconf.h"
REGEX "HAVE_PARALLEL 1" ) HDF5_HAVE_PARALLEL_DEFINE
if( HDF5_HAVE_PARALLEL_DEFINE ) REGEX "HAVE_PARALLEL 1" )
set( HDF5_IS_PARALLEL TRUE ) if( HDF5_HAVE_PARALLEL_DEFINE )
else() set( HDF5_IS_PARALLEL TRUE )
set( HDF5_IS_PARALLEL FALSE ) endif()
endif() endif()
endif() endif()
set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL set( HDF5_IS_PARALLEL ${HDF5_IS_PARALLEL} CACHE BOOL

@ -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\\1.3;JavaHome]/lib"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};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 JAVA_APPEND_LIBRARY_DIRECTORIES(JAVA_AWT_LIBRARY_DIRECTORIES
$ENV{JAVA_HOME}/jre/lib/{libarch} ${_JAVA_HOME}/jre/lib/{libarch}
$ENV{JAVA_HOME}/jre/lib ${_JAVA_HOME}/jre/lib
$ENV{JAVA_HOME}/lib ${_JAVA_HOME}/lib
$ENV{JAVA_HOME} ${_JAVA_HOME}
/usr/lib /usr/lib
/usr/local/lib /usr/local/lib
/usr/lib/jvm/java/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.4;JavaHome]/include"
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\1.3;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" "[HKEY_LOCAL_MACHINE\\SOFTWARE\\JavaSoft\\Java Development Kit\\${java_install_version};JavaHome]/include"
$ENV{JAVA_HOME}/include ${_JAVA_HOME}/include
/usr/include /usr/include
/usr/local/include /usr/local/include
/usr/lib/java/include /usr/lib/java/include
@ -192,14 +195,14 @@ FIND_PATH(JAVA_INCLUDE_PATH jni.h
) )
FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h FIND_PATH(JAVA_INCLUDE_PATH2 jni_md.h
${JAVA_AWT_INCLUDE_DIRECTORIES} ${JAVA_INCLUDE_PATH}
${JAVA_INCLUDE_PATH}/win32 ${JAVA_INCLUDE_PATH}/win32
${JAVA_INCLUDE_PATH}/linux ${JAVA_INCLUDE_PATH}/linux
${JAVA_INCLUDE_PATH}/freebsd ${JAVA_INCLUDE_PATH}/freebsd
${JAVA_INCLUDE_PATH}/solaris
) )
FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h FIND_PATH(JAVA_AWT_INCLUDE_PATH jawt.h
${JAVA_AWT_INCLUDE_DIRECTORIES}
${JAVA_INCLUDE_PATH} ${JAVA_INCLUDE_PATH}
) )

@ -1,5 +1,5 @@
# - Message Passing Interface (MPI) module. # - Message Passing Interface (MPI) module.
# #
# The Message Passing Interface (MPI) is a library used to write # The Message Passing Interface (MPI) is a library used to write
# high-performance parallel applications that use message passing, and # high-performance parallel applications that use message passing, and
# is typically deployed on a cluster. MPI is a standard interface # 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 # If no compiler driver is found or the compiler driver is not
# recognized, this module will then search for common include paths # 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 # If CMake initially finds a different MPI than was intended, and you
# want to use the MPI compiler auto-detection for a different MPI # 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} ${MPIEXEC_NUMPROC_FLAG} PROCS ${MPIEXEC_PREFLAGS} EXECUTABLE
# ${MPIEXEC_POSTFLAGS} ARGS # ${MPIEXEC_POSTFLAGS} ARGS
# where PROCS is the number of processors on which to execute the program, # 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. # MPI program.
#============================================================================= #=============================================================================
@ -65,27 +65,64 @@
# (To distributed this file outside of CMake, substitute the full # (To distributed this file outside of CMake, substitute the full
# License text for the above reference.) # License text for the above reference.)
# Try to find the MPI driver program # This module is maintained by David Partyka <dave.partyka@kitware.com>.
find_program(MPI_COMPILER
NAMES mpic++ mpicxx mpiCC mpicc # A set of directories to search through in addition to the standard system paths
DOC "MPI compiler. Used only to detect MPI compilation flags.") # that find_program will search through.
mark_as_advanced(MPI_COMPILER) # 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 find_program(MPIEXEC
NAMES mpiexec mpirun lamexec NAMES mpiexec mpirun lamexec
PATHS /usr/bin /usr/local/bin /usr/local/mpi/bin PATHS ${MPI_PREFIX_PATH}
"$ENV{SystemDrive}/Program Files/MPICH/SDK/Bin" PATH_SUFFIXES bin
"${ProgramFiles}/MPICH2/Bin" DOC "Executable for running MPI programs."
"$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.") # 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_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_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_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.") 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) MPIEXEC_POSTFLAGS MPIEXEC_MAX_NUMPROCS)
if (MPI_INCLUDE_PATH AND MPI_LIBRARY) if (MPI_INCLUDE_PATH AND MPI_LIBRARY)
@ -95,15 +132,16 @@ elseif (MPI_COMPILER)
# Check whether the -showme:compile option works. This indicates # Check whether the -showme:compile option works. This indicates
# that we have either Open MPI or a newer version of LAM-MPI, and # that we have either Open MPI or a newer version of LAM-MPI, and
# implies that -showme:link will also work. # implies that -showme:link will also work.
exec_program(${MPI_COMPILER} # Note that Windows distros do not have an mpi compiler to interogate.
ARGS -showme:compile exec_program(${MPI_COMPILER}
ARGS -showme:compile
OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
RETURN_VALUE MPI_COMPILER_RETURN) RETURN_VALUE MPI_COMPILER_RETURN)
if (MPI_COMPILER_RETURN EQUAL 0) if (MPI_COMPILER_RETURN EQUAL 0)
# If we appear to have -showme:compile, then we should also have # If we appear to have -showme:compile, then we should also have
# -showme:link. Try it. # -showme:link. Try it.
exec_program(${MPI_COMPILER} exec_program(${MPI_COMPILER}
ARGS -showme:link ARGS -showme:link
OUTPUT_VARIABLE MPI_LINK_CMDLINE OUTPUT_VARIABLE MPI_LINK_CMDLINE
RETURN_VALUE MPI_COMPILER_RETURN) RETURN_VALUE MPI_COMPILER_RETURN)
@ -117,21 +155,21 @@ elseif (MPI_COMPILER)
# Do nothing: we have our command lines now # Do nothing: we have our command lines now
else (MPI_COMPILER_RETURN EQUAL 0) else (MPI_COMPILER_RETURN EQUAL 0)
# Older versions of LAM-MPI have "-showme". Try it. # Older versions of LAM-MPI have "-showme". Try it.
exec_program(${MPI_COMPILER} exec_program(${MPI_COMPILER}
ARGS -showme ARGS -showme
OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
RETURN_VALUE MPI_COMPILER_RETURN) RETURN_VALUE MPI_COMPILER_RETURN)
endif (MPI_COMPILER_RETURN EQUAL 0) endif (MPI_COMPILER_RETURN EQUAL 0)
if (MPI_COMPILER_RETURN EQUAL 0) if (MPI_COMPILER_RETURN EQUAL 0)
# Do nothing: we have our command lines now # Do nothing: we have our command lines now
else (MPI_COMPILER_RETURN EQUAL 0) else (MPI_COMPILER_RETURN EQUAL 0)
# MPICH uses "-show". Try it. # MPICH uses "-show". Try it.
exec_program(${MPI_COMPILER} exec_program(${MPI_COMPILER}
ARGS -show ARGS -show
OUTPUT_VARIABLE MPI_COMPILE_CMDLINE OUTPUT_VARIABLE MPI_COMPILE_CMDLINE
RETURN_VALUE MPI_COMPILER_RETURN) RETURN_VALUE MPI_COMPILER_RETURN)
endif (MPI_COMPILER_RETURN EQUAL 0) endif (MPI_COMPILER_RETURN EQUAL 0)
if (MPI_COMPILER_RETURN EQUAL 0) if (MPI_COMPILER_RETURN EQUAL 0)
# We have our command lines, but we might need to copy # We have our command lines, but we might need to copy
@ -167,12 +205,12 @@ elseif (MPI_COMPILE_CMDLINE)
string(REGEX REPLACE "//" "/" IPATH ${IPATH}) string(REGEX REPLACE "//" "/" IPATH ${IPATH})
list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH}) list(APPEND MPI_INCLUDE_PATH_WORK ${IPATH})
endforeach(IPATH) endforeach(IPATH)
if (NOT MPI_INCLUDE_PATH_WORK) if (NOT MPI_INCLUDE_PATH_WORK)
if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS) if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
# The compile command line didn't have any include paths on it, # The compile command line didn't have any include paths on it,
# but we may have -showme:incdirs. Use it. # but we may have -showme:incdirs. Use it.
exec_program(${MPI_COMPILER} exec_program(${MPI_COMPILER}
ARGS -showme:incdirs ARGS -showme:incdirs
OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK OUTPUT_VARIABLE MPI_INCLUDE_PATH_WORK
RETURN_VALUE MPI_COMPILER_RETURN) RETURN_VALUE MPI_COMPILER_RETURN)
@ -183,7 +221,10 @@ elseif (MPI_COMPILE_CMDLINE)
if (NOT MPI_INCLUDE_PATH_WORK) if (NOT MPI_INCLUDE_PATH_WORK)
# If all else fails, just search for mpi.h in the normal include # If all else fails, just search for mpi.h in the normal include
# paths. # 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}) set(MPI_INCLUDE_PATH_WORK ${MPI_INCLUDE_PATH})
endif (NOT MPI_INCLUDE_PATH_WORK) endif (NOT MPI_INCLUDE_PATH_WORK)
@ -200,7 +241,7 @@ elseif (MPI_COMPILE_CMDLINE)
if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS) if (MPI_COMPILER_MAY_HAVE_INCLIBDIRS)
# The compile command line didn't have any linking paths on it, # The compile command line didn't have any linking paths on it,
# but we may have -showme:libdirs. Use it. # but we may have -showme:libdirs. Use it.
exec_program(${MPI_COMPILER} exec_program(${MPI_COMPILER}
ARGS -showme:libdirs ARGS -showme:libdirs
OUTPUT_VARIABLE MPI_LINK_PATH OUTPUT_VARIABLE MPI_LINK_PATH
RETURN_VALUE MPI_COMPILER_RETURN) 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_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) set(MPI_LINK_FLAGS ${MPI_LINK_FLAGS_WORK} CACHE STRING "MPI linking flags" FORCE)
else (MPI_COMPILE_CMDLINE) else (MPI_COMPILE_CMDLINE)
find_path(MPI_INCLUDE_PATH mpi.h # No MPI compiler to interogate so attempt to find everything with find functions.
/usr/local/include find_path(MPI_INCLUDE_PATH mpi.h
/usr/include HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH}
/usr/include/mpi PATH_SUFFIXES include
/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"
) )
# Decide between 32-bit and 64-bit libraries for Microsoft's MPI # 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) set(MS_MPI_ARCH_DIR amd64)
else (CMAKE_CL_64) else()
set(MS_MPI_ARCH_DIR i386) set(MS_MPI_ARCH_DIR i386)
endif (CMAKE_CL_64) endif()
find_library(MPI_LIBRARY find_library(MPI_LIBRARY
NAMES mpi mpich msmpi NAMES mpi mpich msmpi
PATHS /usr/lib /usr/local/lib /usr/local/mpi/lib HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH}
"$ENV{SystemDrive}/Program Files/MPICH/SDK/Lib" PATH_SUFFIXES lib lib/${MS_MPI_ARCH_DIR} Lib Lib/${MS_MPI_ARCH_DIR}
"${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}"
) )
find_library(MPI_LIBRARY
NAMES mpich2
PATHS
"${ProgramFiles}/MPICH2/Lib")
find_library(MPI_EXTRA_LIBRARY find_library(MPI_EXTRA_LIBRARY
NAMES mpi++ NAMES mpi++
PATHS /usr/lib /usr/local/lib /usr/local/mpi/lib HINTS ${MPI_BASE_DIR} ${MPI_PREFIX_PATH}
"$ENV{SystemDrive}/Program Files/MPICH/SDK/Lib" PATH_SUFFIXES lib
DOC "Extra MPI libraries to link against.") DOC "Extra MPI libraries to link against.")
set(MPI_COMPILE_FLAGS "" CACHE STRING "MPI compilation flags") 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) set(MPI_LIBRARY ${MPI_LIBRARY} msglayer.rts devices.rts rts.rts devices.rts)
endif("${MPI_LIBRARY}" MATCHES "mpich.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) if (MPI_EXTRA_LIBRARY)
set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY}) set(MPI_LIBRARIES ${MPI_LIBRARY} ${MPI_EXTRA_LIBRARY})
else (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) endif (MPI_INCLUDE_PATH AND MPI_LIBRARY)
include(FindPackageHandleStandardArgs) 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) 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) MPI_EXTRA_LIBRARY)
# unset to cleanup namespace
unset(MPI_PACKAGE_DIR)
unset(MPI_PREFIX_PATH)
unset(MPI_BASE_DIR)

@ -8,6 +8,7 @@
#============================================================================= #=============================================================================
# Copyright 2006-2009 Kitware, Inc. # Copyright 2006-2009 Kitware, Inc.
# Copyright 2006 Alexander Neundorf <neundorf@kde.org> # Copyright 2006 Alexander Neundorf <neundorf@kde.org>
# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.
@ -27,19 +28,32 @@ IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
SET(LIB_FOUND 1) SET(LIB_FOUND 1)
ENDIF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) 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) IF(WIN32 AND MSVC)
# /MD and /MDd are the standard values - if somone wants to use # /MD and /MDd are the standard values - if somone wants to use
# others, the libnames have to change here too # others, the libnames have to change here too
# use also ssl and ssleay32 in debug as fallback for openssl < 0.9.8b # 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(LIB_EAY_DEBUG NAMES libeay32MDd libeay32
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"
)
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(MSVC_IDE)
IF(SSL_EAY_DEBUG AND SSL_EAY_RELEASE) 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) ELSE(SSL_EAY_DEBUG AND SSL_EAY_RELEASE)
SET(OPENSSL_LIBRARIES NOTFOUND) SET(OPENSSL_LIBRARIES NOTFOUND)
MESSAGE(STATUS "Could not find the debug and release version of openssl") MESSAGE(STATUS "Could not find the debug and release version of openssl")
@ -47,15 +61,20 @@ IF(WIN32 AND MSVC)
ELSE(MSVC_IDE) ELSE(MSVC_IDE)
STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER) STRING(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
IF(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug) 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) 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(CMAKE_BUILD_TYPE_TOLOWER MATCHES debug)
ENDIF(MSVC_IDE) ENDIF(MSVC_IDE)
MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE) MARK_AS_ADVANCED(SSL_EAY_DEBUG SSL_EAY_RELEASE)
MARK_AS_ADVANCED(LIB_EAY_DEBUG LIB_EAY_RELEASE)
ELSE(WIN32 AND MSVC) 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) ENDIF(WIN32 AND MSVC)

@ -96,13 +96,22 @@ if(OSG_INCLUDE_DIR)
message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] " message("[ FindOpenSceneGraph.cmake:${CMAKE_CURRENT_LIST_LINE} ] "
"Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}") "Detected OSG_INCLUDE_DIR = ${OSG_INCLUDE_DIR}")
endif() 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]+.*" 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]+.*" 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) if(_osg_old_defines)
string(REGEX REPLACE ".*#define OSG_VERSION_MAJOR[ \t]+([0-9]+).*" string(REGEX REPLACE ".*#define OSG_VERSION_MAJOR[ \t]+([0-9]+).*"
"\\1" _osg_VERSION_MAJOR ${_osg_Version_contents}) "\\1" _osg_VERSION_MAJOR ${_osg_Version_contents})

@ -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} NAMES python${_CURRENT_VERSION_NO_DOTS} python${_CURRENT_VERSION}
PATHS PATHS
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Python\\PythonCore\\${_CURRENT_VERSION}\\InstallPath]/libs [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. # Avoid finding the .dll in the PATH. We want the .lib.
NO_SYSTEM_ENVIRONMENT_PATH NO_SYSTEM_ENVIRONMENT_PATH
) )

@ -3,27 +3,27 @@
# This module can be used to find Squish (currently support is aimed at version 3). # This module can be used to find Squish (currently support is aimed at version 3).
# #
# ---- Variables and Macros # ---- Variables and Macros
# SQUISH_FOUND If false, don't try to use Squish # SQUISH_FOUND If false, don't try to use Squish
# SQUISH_VERSION_MAJOR The major version of Squish found # SQUISH_VERSION_MAJOR The major version of Squish found
# SQUISH_VERSION_MINOR The minor version of Squish found # SQUISH_VERSION_MINOR The minor version of Squish found
# SQUISH_VERSION_PATCH The patch 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_INSTALL_DIR The Squish installation directory (containing bin, lib, etc)
# SQUISH_SERVER_EXECUTABLE The squishserver executable # SQUISH_SERVER_EXECUTABLE The squishserver executable
# SQUISH_CLIENT_EXECUTABLE The squishrunner executable # SQUISH_CLIENT_EXECUTABLE The squishrunner executable
# #
# SQUISH_INSTALL_DIR_FOUND Was the install directory found? # SQUISH_INSTALL_DIR_FOUND Was the install directory found?
# SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found? # SQUISH_SERVER_EXECUTABLE_FOUND Was the server executable found?
# SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found? # SQUISH_CLIENT_EXECUTABLE_FOUND Was the client executable found?
# #
# macro SQUISH_ADD_TEST(testName applicationUnderTest testSuite testCase) # macro SQUISH_ADD_TEST(testName applicationUnderTest testSuite testCase)
# #
# ---- Typical Use # ---- Typical Use
# ENABLE_TESTING() # ENABLE_TESTING()
# FIND_PACKAGE(Squish) # FIND_PACKAGE(Squish)
# IF (SQUISH_FOUND) # IF (SQUISH_FOUND)
# SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName) # SQUISH_ADD_TEST(myTestName myApplication testSuiteName testCaseName)
# ENDIF (SQUISH_FOUND) # ENDIF (SQUISH_FOUND)
# #
#============================================================================= #=============================================================================

@ -1,9 +1,9 @@
# - Find zlib # - Find zlib
# Find the native ZLIB includes and library # Find the native ZLIB includes and library
# #
# ZLIB_INCLUDE_DIR - where to find zlib.h, etc. # ZLIB_INCLUDE_DIRS - where to find zlib.h, etc.
# ZLIB_LIBRARIES - List of libraries when using zlib. # ZLIB_LIBRARIES - List of libraries when using zlib.
# ZLIB_FOUND - True if zlib found. # ZLIB_FOUND - True if zlib found.
#============================================================================= #=============================================================================
# Copyright 2001-2009 Kitware, Inc. # Copyright 2001-2009 Kitware, Inc.
@ -27,16 +27,14 @@ FIND_PATH(ZLIB_INCLUDE_DIR zlib.h)
SET(ZLIB_NAMES z zlib zdll) SET(ZLIB_NAMES z zlib zdll)
FIND_LIBRARY(ZLIB_LIBRARY NAMES ${ZLIB_NAMES} ) 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 # handle the QUIETLY and REQUIRED arguments and set ZLIB_FOUND to TRUE if
# all listed variables are TRUE # all listed variables are TRUE
INCLUDE(FindPackageHandleStandardArgs) 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 )

@ -18,7 +18,7 @@
Var ADD_TO_PATH_ALL_USERS Var ADD_TO_PATH_ALL_USERS
Var ADD_TO_PATH_CURRENT_USER Var ADD_TO_PATH_CURRENT_USER
Var INSTALL_DESKTOP Var INSTALL_DESKTOP
Var IS_DEFAULT_INSTALLDIR
;-------------------------------- ;--------------------------------
;Include Modern UI ;Include Modern UI
@ -892,8 +892,19 @@ Function .onInit
; Reads components status for registry ; Reads components status for registry
!insertmacro SectionList "InitSection" !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 $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 ClearErrors
UserInfo::GetName UserInfo::GetName
@ -917,8 +928,9 @@ Function .onInit
;Get installation folder from registry if available ;Get installation folder from registry if available
done: done:
StrCmp $SV_ALLUSERS "AllUsers" 0 +2 StrCmp $SV_ALLUSERS "AllUsers" 0 +3
StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@" StrCmp "$IS_DEFAULT_INSTALLDIR" "1" 0 +2
StrCpy $INSTDIR "$PROGRAMFILES\@CPACK_PACKAGE_INSTALL_DIRECTORY@"
StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage StrCmp "@CPACK_NSIS_MODIFY_PATH@" "ON" 0 noOptionsPage
!insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini" !insertmacro MUI_INSTALLOPTIONS_EXTRACT "NSIS.InstallOptions.ini"

@ -8,7 +8,7 @@ IF(XIAR)
ENDIF(XIAR) ENDIF(XIAR)
SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") 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_LINK_Fortran_FLAGS "-i_dynamic")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-rpath,") SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,-rpath,")
SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":")

@ -20,4 +20,5 @@ SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "-O1")
SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O2") SET (CMAKE_Fortran_FLAGS_RELEASE_INIT "-O2")
SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-02 -g") SET (CMAKE_Fortran_FLAGS_RELWITHDEBINFO_INIT "-02 -g")
SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY
"<CMAKE_Fortran_COMPILER> <CMAKE_SHARED_LIBRARY_Fortran_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")

@ -12,7 +12,7 @@ SET(CMAKE_Fortran_MODDIR_FLAG "-module:")
SET(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1) SET(CMAKE_Fortran_USE_RESPONSE_FILE_FOR_OBJECTS 1)
SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY
"link ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /dll <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}") "link ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} /out:<TARGET> /implib:<TARGET_IMPLIB> /dll <LINK_FLAGS> <LINK_LIBRARIES> ${CMAKE_END_TEMP_FILE}")
SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY}) SET(CMAKE_Fortran_CREATE_SHARED_MODULE ${CMAKE_Fortran_CREATE_SHARED_LIBRARY})
@ -26,7 +26,7 @@ SET(CMAKE_Fortran_COMPILE_OBJECT
SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>") SET(CMAKE_COMPILE_RESOURCE "rc <FLAGS> /fo<OBJECT> <SOURCE>")
SET(CMAKE_Fortran_LINK_EXECUTABLE SET(CMAKE_Fortran_LINK_EXECUTABLE
"<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> -link <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}") "<CMAKE_Fortran_COMPILER> ${CMAKE_CL_NOLOGO} <OBJECTS> ${CMAKE_START_TEMP_FILE} <FLAGS> /Fe<TARGET> -link /implib:<TARGET_IMPLIB> <CMAKE_Fortran_LINK_FLAGS> <LINK_FLAGS> <LINK_LIBRARIES>${CMAKE_END_TEMP_FILE}")
INCLUDE(Platform/Windows-Intel) 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 # does the compiler support pdbtype and is it the newer compiler
SET(CMAKE_BUILD_TYPE_INIT Debug) SET(CMAKE_BUILD_TYPE_INIT Debug)
SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp") SET (CMAKE_Fortran_FLAGS_INIT "/W1 /nologo /fpp /libs:dll /threads")
SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full") SET (CMAKE_Fortran_FLAGS_DEBUG_INIT "/debug:full /dbglibs")
SET (CMAKE_Fortran_FLAGS_MINSIZEREL_INIT "/O2 /D NDEBUG") 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_FLAGS_RELWITHDEBINFO_INIT "/O1 /debug:full /D NDEBUG")
SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib") SET (CMAKE_Fortran_STANDARD_LIBRARIES_INIT "user32.lib")

@ -6,7 +6,7 @@
# - Link libraries to swig module # - Link libraries to swig module
# All other macros are for internal use only. # All other macros are for internal use only.
# To get the actual name of the swig module, # 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 # 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 behavior of SWIG. Also global CMAKE_SWIG_FLAGS can be used to add
# special flags to all swig calls. # special flags to all swig calls.
@ -14,9 +14,14 @@
# where to write all the swig generated module (swig -outdir option) # where to write all the swig generated module (swig -outdir option)
# The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used # The name-specific variable SWIG_MODULE_<name>_EXTRA_DEPS may be used
# to specify extra dependencies for the generated modules. # 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 2004-2009 Kitware, Inc.
# Copyright 2009 Mathieu Malaterre <mathieu.malaterre@gmail.com>
# #
# Distributed under the OSI-approved BSD License (the "License"); # Distributed under the OSI-approved BSD License (the "License");
# see accompanying file Copyright.txt for details. # see accompanying file Copyright.txt for details.
@ -48,6 +53,9 @@ MACRO(SWIG_MODULE_INITIALIZE name language)
SET(SWIG_MODULE_${name}_REAL_NAME "${name}") SET(SWIG_MODULE_${name}_REAL_NAME "${name}")
IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$") 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}") SET(SWIG_MODULE_${name}_REAL_NAME "_${name}")
ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$") ENDIF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPYTHONx$")
IF("x${SWIG_MODULE_${name}_LANGUAGE}x" MATCHES "^xPERLx$") 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 was specified then pass it to -outdir
IF(CMAKE_SWIG_OUTDIR) IF(CMAKE_SWIG_OUTDIR)
SET(swig_outdir ${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) ELSE(CMAKE_SWIG_OUTDIR)
SET(swig_outdir ${CMAKE_CURRENT_BINARY_DIR}) SET(swig_outdir ${CMAKE_CURRENT_BINARY_DIR})
ENDIF(CMAKE_SWIG_OUTDIR) ENDIF(CMAKE_SWIG_OUTDIR)
@ -203,8 +213,33 @@ MACRO(SWIG_ADD_MODULE name language)
MODULE MODULE
${swig_generated_sources} ${swig_generated_sources}
${swig_other_sources}) ${swig_other_sources})
SET_TARGET_PROPERTIES(${SWIG_MODULE_${name}_REAL_NAME} STRING(TOLOWER "${language}" swig_lowercase_language)
PROPERTIES PREFIX "") 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
# <quote>
# 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.
# </quote>
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) ENDMACRO(SWIG_ADD_MODULE)
# #

@ -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 the package that is compatible with the version requested. If a
compatible version of the package cannot be found the module should compatible version of the package cannot be found the module should
not report success. The version of the package found should be stored 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 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 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() To get this behaviour you can use the FIND_PACKAGE_HANDLE_STANDARD_ARGS()
macro, as an example see FindJPEG.cmake. 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).

@ -303,6 +303,8 @@ IF (WIN32)
cmLocalVisualStudio10Generator.h cmLocalVisualStudio10Generator.h
cmGlobalVisualStudio10Generator.h cmGlobalVisualStudio10Generator.h
cmGlobalVisualStudio10Generator.cxx cmGlobalVisualStudio10Generator.cxx
cmGlobalVisualStudio10Win64Generator.h
cmGlobalVisualStudio10Win64Generator.cxx
cmGlobalVisualStudioGenerator.cxx cmGlobalVisualStudioGenerator.cxx
cmGlobalVisualStudioGenerator.h cmGlobalVisualStudioGenerator.h
cmGlobalWatcomWMakeGenerator.cxx cmGlobalWatcomWMakeGenerator.cxx

@ -23,7 +23,6 @@
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
#include <cm_zlib.h> #include <cm_zlib.h>
#include <libtar/libtar.h> #include <libtar/libtar.h>
#include <memory> // auto_ptr
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
@ -219,9 +218,8 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
&mydata &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 ]; char* realName = new char[ strlen(outFileName) + 1 ];
std::auto_ptr<char> realNamePtr(realName);
strcpy(realName, outFileName); strcpy(realName, outFileName);
int flags = O_WRONLY | O_CREAT; int flags = O_WRONLY | O_CREAT;
int options = 0; int options = 0;
@ -239,9 +237,12 @@ int cmCPackTGZGenerator::CompressFiles(const char* outFileName,
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): "
<< strerror(errno) << std::endl); << strerror(errno) << std::endl);
delete [] realName;
return 0; return 0;
} }
delete [] realName;
std::vector<std::string>::const_iterator fileIt; std::vector<std::string>::const_iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{ {

@ -23,7 +23,6 @@
#include <cmsys/SystemTools.hxx> #include <cmsys/SystemTools.hxx>
#include <cmcompress/cmcompress.h> #include <cmcompress/cmcompress.h>
#include <libtar/libtar.h> #include <libtar/libtar.h>
#include <memory> // auto_ptr
#include <fcntl.h> #include <fcntl.h>
#include <errno.h> #include <errno.h>
@ -165,9 +164,8 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName,
&mydata &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 ]; char* realName = new char[ strlen(outFileName) + 1 ];
std::auto_ptr<char> realNamePtr(realName);
strcpy(realName, outFileName); strcpy(realName, outFileName);
int flags = O_WRONLY | O_CREAT; int flags = O_WRONLY | O_CREAT;
int options = 0; int options = 0;
@ -185,9 +183,12 @@ int cmCPackTarCompressGenerator::CompressFiles(const char* outFileName,
{ {
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): " cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem with tar_open(): "
<< strerror(errno) << std::endl); << strerror(errno) << std::endl);
delete [] realName;
return 0; return 0;
} }
delete [] realName;
std::vector<std::string>::const_iterator fileIt; std::vector<std::string>::const_iterator fileIt;
for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt ) for ( fileIt = files.begin(); fileIt != files.end(); ++ fileIt )
{ {

@ -25,7 +25,7 @@ cmCTestBatchTestHandler::~cmCTestBatchTestHandler()
void cmCTestBatchTestHandler::RunTests() void cmCTestBatchTestHandler::RunTests()
{ {
this->WriteBatchScript(); this->WriteBatchScript();
//this->SubmitBatchScript(); this->SubmitBatchScript();
} }
//--------------------------------------------------------- //---------------------------------------------------------
@ -128,16 +128,16 @@ void cmCTestBatchTestHandler::SubmitBatchScript()
args.push_back(this->Script); args.push_back(this->Script);
args.push_back("-o"); args.push_back("-o");
args.push_back(this->CTest->GetBinaryDir() args.push_back(this->CTest->GetBinaryDir()
+ "/Testing/CTestBatchOutput.txt"); + "/Testing/CTestBatch.txt");
sbatch.SetCommand("sbatch"); sbatch.SetCommand("sbatch");
sbatch.SetCommandArguments(args); sbatch.SetCommandArguments(args);
if(sbatch.StartProcess()) /*if(sbatch.StartProcess())
{ {
//success condition //success condition
} }
else else
{ {
//fail condition //fail condition
} }*/
} }

@ -251,7 +251,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
tarIt != this->BuildTargets.end(); ++ tarIt ) tarIt != this->BuildTargets.end(); ++ tarIt )
{ {
double remainingTime = 0; double remainingTime = 0;
if (this->Timeout) if (this->Timeout > 0)
{ {
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start; remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
if (remainingTime <= 0) if (remainingTime <= 0)
@ -376,7 +376,7 @@ int cmCTestBuildAndTestHandler::RunCMakeAndTest(std::string* outstring)
// how much time is remaining // how much time is remaining
double remainingTime = 0; double remainingTime = 0;
if (this->Timeout) if (this->Timeout > 0)
{ {
remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start; remainingTime = this->Timeout - cmSystemTools::GetTime() + clock_start;
if (remainingTime <= 0) if (remainingTime <= 0)

@ -676,6 +676,24 @@ void cmCTestCoverageHandler::PopulateCustomVectors(cmMakefile *mf)
#define fnc(s) s #define fnc(s) s
#endif #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( int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestCoverageHandlerContainer* cont) cmCTestCoverageHandlerContainer* cont)
@ -735,16 +753,27 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
" Processing coverage (each . represents one file):" << std::endl); " Processing coverage (each . represents one file):" << std::endl);
cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
int file_count = 0; int file_count = 0;
// make sure output from gcov is in English! // make sure output from gcov is in English!
cmSystemTools::PutEnv("LC_ALL=POSIX"); 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 ) for ( it = files.begin(); it != files.end(); ++ it )
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, "." << std::flush); 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 fileDir = cmSystemTools::GetFilenamePath(it->c_str());
std::string command = "\"" + gcovCommand + "\" -l -o \"" + fileDir std::string command = "\"" + gcovCommand + "\" -l -o \"" + fileDir
+ "\" \"" + *it + "\""; + "\" \"" + *it + "\"";
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str() cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, command.c_str()
<< std::endl); << std::endl);
std::string output = ""; std::string output = "";
std::string errors = ""; std::string errors = "";
int retVal = 0; int retVal = 0;
@ -777,149 +806,151 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
<< output << std::endl << output << std::endl
<< "--------------------------------------------------------------" << "--------------------------------------------------------------"
<< std::endl); << std::endl);
std::vector<cmStdString> lines; std::vector<cmStdString> lines;
std::vector<cmStdString>::iterator line; std::vector<cmStdString>::iterator line;
// Globals for storing current source file and current gcov file;
cmSystemTools::Split(output.c_str(), lines); cmSystemTools::Split(output.c_str(), lines);
for ( line = lines.begin(); line != lines.end(); ++line) for ( line = lines.begin(); line != lines.end(); ++line)
{ {
std::string sourceFile; std::string sourceFile;
std::string gcovFile; std::string gcovFile;
cmCTestLog(this->CTest, DEBUG, "Line: [" << line->c_str() << "]" cmCTestLog(this->CTest, DEBUG, "Line: [" << line->c_str() << "]"
<< std::endl); << std::endl);
if ( line->size() == 0 ) if ( line->size() == 0 )
{ {
// Ignore empty line; probably style 2 // Ignore empty line; probably style 2
} }
else if ( st1re1.find(line->c_str()) ) 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; gcovStyle = 1;
} }
if ( gcovStyle != 1 )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e1"
<< std::endl);
cont->Error ++;
break;
}
actualSourceFile = ""; actualSourceFile = "";
sourceFile = st1re1.match(2); sourceFile = st1re1.match(2);
} }
else if ( st1re2.find(line->c_str() ) ) 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; gcovStyle = 1;
} }
if ( gcovStyle != 1 )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e2"
<< std::endl);
cont->Error ++;
break;
}
gcovFile = st1re2.match(1); gcovFile = st1re2.match(1);
} }
else if ( st2re1.find(line->c_str() ) ) 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; gcovStyle = 2;
} }
if ( gcovStyle != 2 )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e3"
<< std::endl);
cont->Error ++;
break;
}
actualSourceFile = ""; actualSourceFile = "";
sourceFile = st2re1.match(1); sourceFile = st2re1.match(1);
} }
else if ( st2re2.find(line->c_str() ) ) 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; 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() ) ) 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; gcovStyle = 2;
} }
if ( gcovStyle != 2 )
{
cmCTestLog(this->CTest, ERROR_MESSAGE, "Unknown gcov output style e5"
<< std::endl);
cont->Error ++;
break;
}
gcovFile = st2re3.match(2); gcovFile = st2re3.match(2);
} }
else if ( st2re4.find(line->c_str() ) ) 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; 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) cmCTestLog(this->CTest, WARNING, "Warning: " << st2re4.match(1)
<< " had unexpected EOF" << std::endl); << " had unexpected EOF" << std::endl);
} }
else if ( st2re5.find(line->c_str() ) ) 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; 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: " cmCTestLog(this->CTest, WARNING, "Warning: Cannot open file: "
<< st2re5.match(1) << std::endl); << st2re5.match(1) << std::endl);
} }
else if ( st2re6.find(line->c_str() ) ) 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; 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) cmCTestLog(this->CTest, WARNING, "Warning: File: " << st2re6.match(1)
<< " is newer than " << st2re6.match(2) << std::endl); << " is newer than " << st2re6.match(2) << std::endl);
@ -927,16 +958,24 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
else else
{ {
cmCTestLog(this->CTest, ERROR_MESSAGE, cmCTestLog(this->CTest, ERROR_MESSAGE,
"Unknown line: [" << line->c_str() << "]" << std::endl); "Unknown gcov output line: [" << line->c_str() << "]" << std::endl);
cont->Error ++; cont->Error ++;
//abort(); //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 cmCTestCoverageHandlerContainer::SingleFileCoverageVector& vec
= &cont->TotalCoverage[actualSourceFile]; = cont->TotalCoverage[actualSourceFile];
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in file: "
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " in gcovFile: "
<< gcovFile << std::endl); << gcovFile << std::endl);
std::ifstream ifile(gcovFile.c_str()); std::ifstream ifile(gcovFile.c_str());
if ( ! ifile ) if ( ! ifile )
{ {
@ -969,41 +1008,45 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
// line // line
std::string prefix = nl.substr(0, 12); std::string prefix = nl.substr(0, 12);
int cov = atoi(prefix.c_str()); int cov = atoi(prefix.c_str());
// Read the line number starting at the 10th character of the gcov // Read the line number starting at the 10th character of the gcov
// output line // output line
std::string lineNumber = nl.substr(10, 5); std::string lineNumber = nl.substr(10, 5);
int lineIdx = atoi(lineNumber.c_str())-1; int lineIdx = atoi(lineNumber.c_str())-1;
if ( lineIdx >= 0 ) if ( lineIdx >= 0 )
{ {
while ( vec->size() <= while ( vec.size() <= static_cast<size_t>(lineIdx) )
static_cast<size_t>(lineIdx) )
{ {
vec->push_back(-1); vec.push_back(-1);
} }
// Initially all entries are -1 (not used). If we get coverage // Initially all entries are -1 (not used). If we get coverage
// information, increment it to 0 first. // information, increment it to 0 first.
if ( (*vec)[lineIdx] < 0 ) if ( vec[lineIdx] < 0 )
{ {
if ( cov > 0 || prefix.find("#") != prefix.npos ) if ( cov > 0 || prefix.find("#") != prefix.npos )
{ {
(*vec)[lineIdx] = 0; vec[lineIdx] = 0;
} }
} }
(*vec)[lineIdx] += cov;
vec[lineIdx] += cov;
} }
} }
} }
actualSourceFile = ""; actualSourceFile = "";
} }
if ( !sourceFile.empty() && actualSourceFile.empty() ) if ( !sourceFile.empty() && actualSourceFile.empty() )
{ {
gcovFile = ""; gcovFile = "";
// Is it in the source dir? // Is it in the source dir or the binary dir?
if ( sourceFile.size() > cont->SourceDir.size() && //
(fnc(sourceFile.substr(0, cont->SourceDir.size())) == if ( IsFileInDir(sourceFile, cont->SourceDir) )
fnc(cont->SourceDir)) &&
sourceFile[cont->SourceDir.size()] == '/' )
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: " cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced s: "
<< sourceFile.c_str() << std::endl); << sourceFile.c_str() << std::endl);
@ -1012,12 +1055,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
actualSourceFile actualSourceFile
= cmSystemTools::CollapseFullPath(sourceFile.c_str()); = cmSystemTools::CollapseFullPath(sourceFile.c_str());
} }
else if ( IsFileInDir(sourceFile, cont->BinaryDir) )
// Binary dir?
if ( sourceFile.size() > cont->BinaryDir.size() &&
(fnc(sourceFile.substr(0, cont->BinaryDir.size())) ==
fnc(cont->BinaryDir)) &&
sourceFile[cont->BinaryDir.size()] == '/' )
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: " cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " produced b: "
<< sourceFile.c_str() << std::endl); << sourceFile.c_str() << std::endl);
@ -1029,7 +1067,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
if ( actualSourceFile.empty() ) if ( actualSourceFile.empty() )
{ {
if ( missingFiles.find(actualSourceFile) == missingFiles.end() ) if ( missingFiles.find(sourceFile) == missingFiles.end() )
{ {
cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT,
"Something went wrong" << std::endl); "Something went wrong" << std::endl);
@ -1048,12 +1086,15 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
<< sourceFile.c_str() << sourceFile.c_str()
<< " in source dir: " << cont->SourceDir.c_str() << " in source dir: " << cont->SourceDir.c_str()
<< " or binary dir: " << cont->BinaryDir.c_str() << std::endl; << " or binary dir: " << cont->BinaryDir.c_str() << std::endl;
missingFiles.insert(actualSourceFile);
missingFiles.insert(sourceFile);
} }
} }
} }
} }
file_count ++;
file_count++;
if ( file_count % 50 == 0 ) if ( file_count % 50 == 0 )
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count cmCTestLog(this->CTest, HANDLER_OUTPUT, " processed: " << file_count
@ -1061,6 +1102,7 @@ int cmCTestCoverageHandler::HandleGCovCoverage(
cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
} }
} }
cmSystemTools::ChangeDirectory(currentDirectory.c_str()); cmSystemTools::ChangeDirectory(currentDirectory.c_str());
return file_count; return file_count;
} }

@ -659,8 +659,12 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
"== .*Invalid free\\(\\) / delete / delete\\[\\]"); "== .*Invalid free\\(\\) / delete / delete\\[\\]");
cmsys::RegularExpression vgFMM( cmsys::RegularExpression vgFMM(
"== .*Mismatched free\\(\\) / delete / delete \\[\\]"); "== .*Mismatched free\\(\\) / delete / delete \\[\\]");
cmsys::RegularExpression vgMLK( cmsys::RegularExpression vgMLK1(
"== .*[0-9][0-9]* bytes in [0-9][0-9]* blocks are definitely lost" "== .*[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]"); " in loss record [0-9][0-9]* of [0-9]");
cmsys::RegularExpression vgPAR( cmsys::RegularExpression vgPAR(
"== .*Syscall param .* contains unaddressable byte\\(s\\)"); "== .*Syscall param .* contains unaddressable byte\\(s\\)");
@ -705,7 +709,11 @@ bool cmCTestMemCheckHandler::ProcessMemCheckValgrindOutput(
{ {
failure = cmCTestMemCheckHandler::FMM; 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; failure = cmCTestMemCheckHandler::MLK;
} }

@ -15,6 +15,7 @@
#include "cmCTest.h" #include "cmCTest.h"
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include <stdlib.h> #include <stdlib.h>
#include <stack>
cmCTestMultiProcessHandler::cmCTestMultiProcessHandler() cmCTestMultiProcessHandler::cmCTestMultiProcessHandler()
{ {
@ -56,6 +57,10 @@ void cmCTestMultiProcessHandler::SetParallelLevel(size_t level)
void cmCTestMultiProcessHandler::RunTests() void cmCTestMultiProcessHandler::RunTests()
{ {
this->CheckResume(); this->CheckResume();
if(!this->CheckCycles())
{
return;
}
this->TestHandler->SetMaxIndex(this->FindMaxIndex()); this->TestHandler->SetMaxIndex(this->FindMaxIndex());
this->StartNextTests(); this->StartNextTests();
while(this->Tests.size() != 0) while(this->Tests.size() != 0)
@ -81,6 +86,10 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
cmCTestRunTest* testRun = new cmCTestRunTest(this->TestHandler); cmCTestRunTest* testRun = new cmCTestRunTest(this->TestHandler);
testRun->SetIndex(test); testRun->SetIndex(test);
testRun->SetTestProperties(this->Properties[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)) if(testRun->StartTest(this->Total))
{ {
this->RunningTests.insert(testRun); this->RunningTests.insert(testRun);
@ -92,6 +101,7 @@ void cmCTestMultiProcessHandler::StartTestProcess(int test)
testRun->EndTest(this->Completed, this->Total, false); testRun->EndTest(this->Completed, this->Total, false);
this->Failed->push_back(this->Properties[test]->Name); 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()); this->TestHandler->SetMaxIndex(this->FindMaxIndex());
int count = 0; int count = 0;
for (PropertiesMap::iterator it = this->Properties.begin(); for (PropertiesMap::iterator it = this->Properties.begin();
it != this->Properties.end(); it ++ ) it != this->Properties.end(); ++it)
{ {
count++; count++;
cmCTestTestHandler::cmCTestTestProperties& p = *it->second; cmCTestTestHandler::cmCTestTestProperties& p = *it->second;
//push working dir
std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory();
cmSystemTools::ChangeDirectory(p.Directory.c_str());
cmCTestRunTest testRun(this->TestHandler); cmCTestRunTest testRun(this->TestHandler);
testRun.SetIndex(p.Index); testRun.SetIndex(p.Index);
@ -360,6 +373,8 @@ void cmCTestMultiProcessHandler::PrintTestList()
<< indexStr.str().c_str()); << indexStr.str().c_str());
cmCTestLog(this->CTest, HANDLER_OUTPUT, " "); cmCTestLog(this->CTest, HANDLER_OUTPUT, " ");
cmCTestLog(this->CTest, HANDLER_OUTPUT, p.Name.c_str() << std::endl); 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: " cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: "
<< this->Total << std::endl); << this->Total << std::endl);
@ -423,3 +438,47 @@ int cmCTestMultiProcessHandler::FindMaxIndex()
} }
return max; 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<int> s;
std::vector<int> 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<int>::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;
}

@ -76,6 +76,8 @@ protected:
void RemoveTest(int index); void RemoveTest(int index);
//Check if we need to resume an interrupted test set //Check if we need to resume an interrupted test set
void CheckResume(); void CheckResume();
//Check if there are any circular dependencies
bool CheckCycles();
int FindMaxIndex(); int FindMaxIndex();
inline size_t GetProcessorsUsed(int index); inline size_t GetProcessorsUsed(int index);
// map from test number to set of depend tests // map from test number to set of depend tests

@ -301,7 +301,7 @@ bool cmCTestRunTest::StartTest(size_t total)
{ {
cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8) cmCTestLog(this->CTest, HANDLER_OUTPUT, std::setw(2*getNumWidth(total) + 8)
<< "Start " << "Start "
<< std::setw(getNumWidth(total)) << std::setw(getNumWidth(this->TestHandler->GetMaxIndex()))
<< this->TestProperties->Index << ": " << this->TestProperties->Index << ": "
<< this->TestProperties->Name << std::endl); << this->TestProperties->Name << std::endl);
this->ComputeArguments(); this->ComputeArguments();
@ -419,11 +419,11 @@ bool cmCTestRunTest::CreateProcess(double testTimeOut,
// determine how much time we have // determine how much time we have
double timeout = this->CTest->GetRemainingTimeAllowed() - 120; 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(); timeout = this->CTest->GetTimeOut();
} }
if (testTimeOut if (testTimeOut > 0
&& testTimeOut < this->CTest->GetRemainingTimeAllowed()) && testTimeOut < this->CTest->GetRemainingTimeAllowed())
{ {
timeout = testTimeOut; timeout = testTimeOut;

@ -16,11 +16,6 @@
#include <QTranslator> #include <QTranslator>
#include <QLocale> #include <QLocale>
#include "QMacInstallDialog.h" #include "QMacInstallDialog.h"
#ifdef Q_OS_WIN
#include "windows.h" // for SetErrorMode
#endif
#include "CMakeSetupDialog.h" #include "CMakeSetupDialog.h"
#include "cmDocumentation.h" #include "cmDocumentation.h"
#include "cmake.h" #include "cmake.h"
@ -103,10 +98,6 @@ int main(int argc, char** argv)
} }
QApplication app(argc, 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 // clean out standard Qt paths for plugins, which we don't use anyway
// when creating Mac bundles, it potentially causes problems // when creating Mac bundles, it potentially causes problems

@ -294,7 +294,14 @@ void CMakeSetupDialog::doConfigure()
{ {
return; 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 // if no generator, prompt for it and other setup stuff

@ -20,6 +20,10 @@
#include "cmSystemTools.h" #include "cmSystemTools.h"
#include "cmExternalMakefileProjectGenerator.h" #include "cmExternalMakefileProjectGenerator.h"
#ifdef Q_OS_WIN
#include "qt_windows.h" // For SetErrorMode
#endif
QCMake::QCMake(QObject* p) QCMake::QCMake(QObject* p)
: QObject(p) : QObject(p)
{ {
@ -148,6 +152,10 @@ void QCMake::setGenerator(const QString& gen)
void QCMake::configure() void QCMake::configure()
{ {
#ifdef Q_OS_WIN
UINT lastErrorMode = SetErrorMode(0);
#endif
this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toAscii().data()); this->CMakeInstance->SetHomeDirectory(this->SourceDirectory.toAscii().data());
this->CMakeInstance->SetStartDirectory(this->SourceDirectory.toAscii().data()); this->CMakeInstance->SetStartDirectory(this->SourceDirectory.toAscii().data());
this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toAscii().data()); this->CMakeInstance->SetHomeOutputDirectory(this->BinaryDirectory.toAscii().data());
@ -162,14 +170,27 @@ void QCMake::configure()
int err = this->CMakeInstance->Configure(); int err = this->CMakeInstance->Configure();
#ifdef Q_OS_WIN
SetErrorMode(lastErrorMode);
#endif
emit this->propertiesChanged(this->properties()); emit this->propertiesChanged(this->properties());
emit this->configureDone(err); emit this->configureDone(err);
} }
void QCMake::generate() void QCMake::generate()
{ {
#ifdef Q_OS_WIN
UINT lastErrorMode = SetErrorMode(0);
#endif
cmSystemTools::ResetErrorOccuredFlag(); cmSystemTools::ResetErrorOccuredFlag();
int err = this->CMakeInstance->Generate(); int err = this->CMakeInstance->Generate();
#ifdef Q_OS_WIN
SetErrorMode(lastErrorMode);
#endif
emit this->generateDone(err); emit this->generateDone(err);
} }

@ -564,6 +564,7 @@ bool cmCTest::UpdateCTestConfiguration()
<< fileName.c_str() << "\n"); << fileName.c_str() << "\n");
// parse the dart test file // parse the dart test file
std::ifstream fin(fileName.c_str()); std::ifstream fin(fileName.c_str());
if(!fin) if(!fin)
{ {
return false; return false;
@ -1081,11 +1082,11 @@ int cmCTest::RunTest(std::vector<const char*> argv,
// determine how much time we have // determine how much time we have
double timeout = this->GetRemainingTimeAllowed() - 120; double timeout = this->GetRemainingTimeAllowed() - 120;
if (this->TimeOut && this->TimeOut < timeout) if (this->TimeOut > 0 && this->TimeOut < timeout)
{ {
timeout = this->TimeOut; timeout = this->TimeOut;
} }
if (testTimeOut if (testTimeOut > 0
&& testTimeOut < this->GetRemainingTimeAllowed()) && testTimeOut < this->GetRemainingTimeAllowed())
{ {
timeout = testTimeOut; timeout = testTimeOut;
@ -1117,7 +1118,7 @@ int cmCTest::RunTest(std::vector<const char*> argv,
// make sure we pass the timeout in for any build and test // make sure we pass the timeout in for any build and test
// invocations. Since --build-generator is required this is a // invocations. Since --build-generator is required this is a
// good place to check for it, and to add the arguments in // 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"); args.push_back("--test-timeout");
cmOStringStream msg; cmOStringStream msg;
@ -1265,6 +1266,11 @@ void cmCTest::StartXML(std::ostream& ostr, bool append)
<< this->GetCTestConfiguration("Site") << "\"\n\tGenerator=\"ctest-" << this->GetCTestConfiguration("Site") << "\"\n\tGenerator=\"ctest-"
<< cmVersion::GetCMakeVersion() << "\"\n" << cmVersion::GetCMakeVersion() << "\"\n"
<< (append? "\tAppend=\"true\"\n":"") << (append? "\tAppend=\"true\"\n":"")
<< "\tCompilerName=\"" << this->GetCTestConfiguration("Compiler")
<< "\"\n"
#ifdef _COMPILER_VERSION
<< "\tCompilerVersion=\"_COMPILER_VERSION\"\n"
#endif
<< "\tOSName=\"" << info.GetOSName() << "\"\n" << "\tOSName=\"" << info.GetOSName() << "\"\n"
<< "\tHostname=\"" << info.GetHostname() << "\"\n" << "\tHostname=\"" << info.GetHostname() << "\"\n"
<< "\tOSRelease=\"" << info.GetOSRelease() << "\"\n" << "\tOSRelease=\"" << info.GetOSRelease() << "\"\n"
@ -2363,7 +2369,7 @@ void cmCTest::EmptyCTestConfiguration()
void cmCTest::SetCTestConfiguration(const char *name, const char* value) void cmCTest::SetCTestConfiguration(const char *name, const char* value)
{ {
cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "SetCTestConfiguration:" cmCTestLog(this, HANDLER_VERBOSE_OUTPUT, "SetCTestConfiguration:"
<< name << ":" << value << "\n"); << name << ":" << (value ? value : "(null)") << "\n");
if ( !name ) if ( !name )
{ {

@ -65,7 +65,11 @@ char* cmCommandArgumentParserHelper::ExpandSpecialVariable(const char* key,
if ( !key ) if ( !key )
{ {
return this->ExpandVariable(var); return this->ExpandVariable(var);
} }
if(!var)
{
return this->EmptyVariable;
}
if ( strcmp(key, "ENV") == 0 ) if ( strcmp(key, "ENV") == 0 )
{ {
char *ptr = getenv(var); char *ptr = getenv(var);

@ -317,7 +317,8 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv)
if ((res==0) && (copyFile.size())) 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())) copyFile.c_str()))
{ {
cmOStringStream emsg; cmOStringStream emsg;

@ -194,7 +194,7 @@ void Tree::BuildVirtualFolderImpl(std::string& virtualFolders,
{ {
virtualFolders += "CMake Files\\" + prefix + path + "\\;"; virtualFolders += "CMake Files\\" + prefix + path + "\\;";
for (std::vector<Tree>::const_iterator it = folders.begin(); for (std::vector<Tree>::const_iterator it = folders.begin();
it != folders.end(); it != folders.end();
++it) ++it)
{ {
it->BuildVirtualFolderImpl(virtualFolders, prefix + path + "\\"); it->BuildVirtualFolderImpl(virtualFolders, prefix + path + "\\");
@ -263,37 +263,45 @@ void cmExtraCodeBlocksGenerator
it != this->GlobalGenerator->GetProjectMap().end(); it != this->GlobalGenerator->GetProjectMap().end();
++it) ++it)
{ {
// Convert // Collect all files
std::vector<std::string> listFiles = std::vector<std::string> listFiles;
it->second[0]->GetMakefile()->GetListFiles(); for (std::vector<cmLocalGenerator *>::const_iterator
jt = it->second.begin();
jt != it->second.end();
++jt)
{
const std::vector<std::string> & files =
(*jt)->GetMakefile()->GetListFiles();
listFiles.insert(listFiles.end(), files.begin(), files.end());
}
for (std::vector<std::string>::const_iterator jt = listFiles.begin(); // Convert
jt != listFiles.end(); for (std::vector<std::string>::const_iterator jt = listFiles.begin();
++jt) jt != listFiles.end();
{ ++jt)
const std::string &relative = {
cmSystemTools::RelativePath( const std::string &relative = cmSystemTools::RelativePath(
it->second[0]->GetMakefile()->GetHomeDirectory(), it->second[0]->GetMakefile()->GetHomeDirectory(),
jt->c_str()); jt->c_str());
std::vector<std::string> splitted; std::vector<std::string> splitted;
cmSystemTools::SplitPath(relative.c_str(), splitted, false); cmSystemTools::SplitPath(relative.c_str(), splitted, false);
// Split filename from path // Split filename from path
std::string fileName = *(splitted.end()-1); std::string fileName = *(splitted.end()-1);
splitted.erase(splitted.end() - 1, splitted.end()); splitted.erase(splitted.end() - 1, splitted.end());
// We don't want paths with ".." in them // We don't want paths with ".." in them
// reasons are that we don't want files outside the project // reasons are that we don't want files outside the project
// TODO: the path should be normalized first though // TODO: the path should be normalized first though
// We don't want paths with CMakeFiles in them // We don't want paths with CMakeFiles in them
// or do we? // or do we?
// In speedcrunch those where purely internal // In speedcrunch those where purely internal
if (splitted.size() >= 1 if (splitted.size() >= 1
&& relative.find("..") == std::string::npos && relative.find("..") == std::string::npos
&& relative.find("CMakeFiles") == std::string::npos) && relative.find("CMakeFiles") == std::string::npos)
{ {
tree.InsertPath(splitted, 1, fileName); tree.InsertPath(splitted, 1, fileName);
} }
} }
} }
// Now build a virtual tree string // Now build a virtual tree string
@ -329,68 +337,73 @@ void cmExtraCodeBlocksGenerator
for (cmTargets::iterator ti = targets.begin(); for (cmTargets::iterator ti = targets.begin();
ti != targets.end(); ti++) 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; insertTarget = true;
// Only add the global targets from CMAKE_BINARY_DIR, // only add the "edit_cache" target if it's not ccmake, because
// not from the subdirs // this will not work within the IDE
if (strcmp(makefile->GetStartOutputDirectory(), if (ti->first == "edit_cache")
makefile->GetHomeOutputDirectory())==0)
{ {
insertTarget = true; const char* editCommand = makefile->GetDefinition
// only add the "edit_cache" target if it's not ccmake, because ("CMAKE_EDIT_COMMAND");
// this will not work within the IDE if (editCommand == 0)
if (ti->first == "edit_cache")
{ {
if (strstr(makefile->GetRequiredDefinition insertTarget = false;
("CMAKE_EDIT_COMMAND"), "ccmake")!=NULL) }
{ else if (strstr(editCommand, "ccmake")!=NULL)
insertTarget = false; {
} insertTarget = false;
} }
} }
if (insertTarget) }
{ if (insertTarget)
this->AppendTarget(fout, ti->first.c_str(), 0, {
this->AppendTarget(fout, ti->first.c_str(), 0,
make.c_str(), makefile, compiler.c_str()); make.c_str(), makefile, compiler.c_str());
}
} }
break; }
case cmTarget::UTILITY: break;
// Add all utility targets, except the Nightly/Continuous/ case cmTarget::UTILITY:
// Experimental-"sub"targets as e.g. NightlyStart // Add all utility targets, except the Nightly/Continuous/
if (((ti->first.find("Nightly")==0) &&(ti->first!="Nightly")) // 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("Continuous")==0)&&(ti->first!="Continuous"))
|| ((ti->first.find("Experimental")==0) || ((ti->first.find("Experimental")==0)
&& (ti->first!="Experimental"))) && (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; 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; return 2;
} }
else if ((target->GetType()==cmTarget::SHARED_LIBRARY) else if ((target->GetType()==cmTarget::SHARED_LIBRARY)
|| (target->GetType()==cmTarget::MODULE_LIBRARY)) || (target->GetType()==cmTarget::MODULE_LIBRARY))
{ {
return 3; return 3;
} }

@ -727,8 +727,13 @@ void cmExtraEclipseCDT4Generator::CreateCProjectFile() const
// this will not work within the IDE // this will not work within the IDE
if (ti->first == "edit_cache") if (ti->first == "edit_cache")
{ {
if (strstr(makefile->GetRequiredDefinition const char* editCommand = makefile->GetDefinition
("CMAKE_EDIT_COMMAND"), "ccmake")!=NULL) ("CMAKE_EDIT_COMMAND");
if (editCommand == 0)
{
insertTarget = false;
}
else if (strstr(editCommand, "ccmake")!=NULL)
{ {
insertTarget = false; insertTarget = false;
} }

@ -2290,7 +2290,7 @@ bool cmFileCommand::HandleRelativePathCommand(
{ {
if(args.size() != 4 ) if(args.size() != 4 )
{ {
this->SetError("called with incorrect number of arguments"); this->SetError("RELATIVE_PATH called with incorrect number of arguments");
return false; return false;
} }
@ -2301,7 +2301,7 @@ bool cmFileCommand::HandleRelativePathCommand(
if(!cmSystemTools::FileIsFullPath(directoryName.c_str())) if(!cmSystemTools::FileIsFullPath(directoryName.c_str()))
{ {
std::string errstring = 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; + directoryName;
this->SetError(errstring.c_str()); this->SetError(errstring.c_str());
return false; return false;
@ -2309,7 +2309,7 @@ bool cmFileCommand::HandleRelativePathCommand(
if(!cmSystemTools::FileIsFullPath(fileName.c_str())) if(!cmSystemTools::FileIsFullPath(fileName.c_str()))
{ {
std::string errstring = 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; + fileName;
this->SetError(errstring.c_str()); this->SetError(errstring.c_str());
return false; return false;
@ -2328,7 +2328,7 @@ bool cmFileCommand::HandleRename(std::vector<std::string> const& args)
{ {
if(args.size() != 3) if(args.size() != 3)
{ {
this->SetError("given incorrect number of arguments."); this->SetError("RENAME given incorrect number of arguments.");
return false; return false;
} }
@ -2400,8 +2400,8 @@ bool cmFileCommand::HandleCMakePathCommand(std::vector<std::string>
std::vector<std::string>::const_iterator i = args.begin(); std::vector<std::string>::const_iterator i = args.begin();
if(args.size() != 3) if(args.size() != 3)
{ {
this->SetError("FILE(SYSTEM_PATH ENV result) must be called with " this->SetError("FILE([TO_CMAKE_PATH|TO_NATIVE_PATH] path result) must be "
"only three arguments."); "called with exactly three arguments.");
return false; return false;
} }
i++; // Get rid of subcommand i++; // Get rid of subcommand
@ -2465,17 +2465,48 @@ namespace{
cmFileCommandVectorOfChar *vec cmFileCommandVectorOfChar *vec
= static_cast<cmFileCommandVectorOfChar*>(data); = static_cast<cmFileCommandVectorOfChar*>(data);
vec->insert(vec->end(), chPtr, chPtr + size); vec->insert(vec->end(), chPtr, chPtr + size);
return size; return size;
} }
} }
#endif #endif
bool #if defined(CMAKE_BUILD_WITH_CMAKE)
cmFileCommand::HandleDownloadCommand(std::vector<std::string> namespace {
class cURLEasyGuard
{
public:
cURLEasyGuard(CURL * easy)
: Easy(easy)
{}
~cURLEasyGuard(void)
{
if (this->Easy)
{
::curl_easy_cleanup(this->Easy);
}
}
inline void release(void)
{
this->Easy = 0;
return;
}
private:
::CURL * Easy;
};
}
#endif
bool
cmFileCommand::HandleDownloadCommand(std::vector<std::string>
const& args) const& args)
{ {
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
@ -2486,25 +2517,25 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
"at least three arguments."); "at least three arguments.");
return false; return false;
} }
i++; // Get rid of subcommand ++i; // Get rid of subcommand
std::string url = *i; std::string url = *i;
i++; ++i;
std::string file = *i; std::string file = *i;
i++; ++i;
double timeout = 0; long timeout = 0;
std::string verboseLog; std::string verboseLog;
std::string statusVar; std::string statusVar;
while(i != args.end()) while(i != args.end())
{ {
if(*i == "TIMEOUT") if(*i == "TIMEOUT")
{ {
i++; ++i;
if(i != args.end()) if(i != args.end())
{ {
timeout = atof(i->c_str()); timeout = atol(i->c_str());
} }
else else
{ {
this->SetError("FILE(DOWNLOAD url file TIMEOUT time) missing " this->SetError("FILE(DOWNLOAD url file TIMEOUT time) missing "
"time for TIMEOUT."); "time for TIMEOUT.");
return false; return false;
@ -2512,7 +2543,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
} }
else if(*i == "LOG") else if(*i == "LOG")
{ {
i++; ++i;
if( i == args.end()) if( i == args.end())
{ {
this->SetError("FILE(DOWNLOAD url file LOG VAR) missing " this->SetError("FILE(DOWNLOAD url file LOG VAR) missing "
@ -2523,7 +2554,7 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
} }
else if(*i == "STATUS") else if(*i == "STATUS")
{ {
i++; ++i;
if( i == args.end()) if( i == args.end())
{ {
this->SetError("FILE(DOWNLOAD url file STATUS VAR) missing " this->SetError("FILE(DOWNLOAD url file STATUS VAR) missing "
@ -2532,15 +2563,16 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
} }
statusVar = *i; statusVar = *i;
} }
i++; ++i;
} }
std::string dir = cmSystemTools::GetFilenamePath(file.c_str()); std::string dir = cmSystemTools::GetFilenamePath(file.c_str());
if(!cmSystemTools::FileExists(dir.c_str()) && if(!cmSystemTools::FileExists(dir.c_str()) &&
!cmSystemTools::MakeDirectory(dir.c_str())) !cmSystemTools::MakeDirectory(dir.c_str()))
{ {
std::string errstring = "FILE(DOWNLOAD ) error; cannot create directory: " std::string errstring = "DOWNLOAD error: cannot create directory '"
+ dir + ". Maybe need administrative privileges."; + dir + "' - Specify file by full path name and verify that you "
"have directory creation and file write privileges.";
this->SetError(errstring.c_str()); this->SetError(errstring.c_str());
return false; return false;
} }
@ -2552,50 +2584,106 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
"file for write."); "file for write.");
return false; return false;
} }
CURL *curl; ::CURL *curl;
curl_global_init(CURL_GLOBAL_DEFAULT); ::curl_global_init(CURL_GLOBAL_DEFAULT);
curl = curl_easy_init(); curl = ::curl_easy_init();
if(!curl) if(!curl)
{ {
this->SetError("FILE(DOWNLOAD ) error " this->SetError("FILE(DOWNLOAD ) error "
"initializing curl."); "initializing curl.");
return false; return false;
} }
curl_easy_setopt(curl, CURLOPT_URL, url.c_str()); cURLEasyGuard g_curl(curl);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
cmFileCommandWriteMemoryCallback); ::CURLcode res = ::curl_easy_setopt(curl, CURLOPT_URL, url.c_str());
curl_easy_setopt(curl, CURLOPT_DEBUGFUNCTION, if (res != CURLE_OK)
cmFileCommandCurlDebugCallback); {
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; 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()) 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) 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 */ /* always cleanup */
curl_easy_cleanup(curl); g_curl.release();
::curl_easy_cleanup(curl);
if(statusVar.size()) if(statusVar.size())
{ {
cmOStringStream result; cmOStringStream result;
result << (int)res << ";\"" << curl_easy_strerror(res) << "\""; result << (int)res << ";\"" << ::curl_easy_strerror(res) << "\"";
this->Makefile->AddDefinition(statusVar.c_str(), this->Makefile->AddDefinition(statusVar.c_str(),
result.str().c_str()); result.str().c_str());
} }
curl_global_cleanup(); ::curl_global_cleanup();
if(chunkDebug.size()) if(chunkDebug.size())
{ {
chunkDebug.push_back(0); chunkDebug.push_back(0);
if(CURLE_OPERATION_TIMEOUTED == res) if(CURLE_OPERATION_TIMEOUTED == res)
{ {
std::string output = &*chunkDebug.begin(); std::string output = &*chunkDebug.begin();
if(verboseLog.size()) if(verboseLog.size())
{ {
this->Makefile->AddDefinition(verboseLog.c_str(), this->Makefile->AddDefinition(verboseLog.c_str(),
@ -2607,9 +2695,9 @@ cmFileCommand::HandleDownloadCommand(std::vector<std::string>
&*chunkDebug.begin()); &*chunkDebug.begin());
} }
return true; return true;
#else #else
this->SetError("FILE(DOWNLOAD ) " this->SetError("FILE(DOWNLOAD ) "
"not supported in bootstrap cmake "); "not supported in bootstrap cmake ");
return false; return false;
#endif #endif
} }

@ -152,7 +152,7 @@ public:
"and the second element is a string value for the error. A 0 " "and the second element is a string value for the error. A 0 "
"numeric error means no error in the operation. " "numeric error means no error in the operation. "
"If TIMEOUT time is specified, the operation will " "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" "\n"
"The file() command also provides COPY and INSTALL signatures:\n" "The file() command also provides COPY and INSTALL signatures:\n"
" file(<COPY|INSTALL> files... DESTINATION <dir>\n" " file(<COPY|INSTALL> files... DESTINATION <dir>\n"

@ -31,13 +31,14 @@ void cmGlobalVisualStudio10Generator::AddPlatformDefinitions(cmMakefile* mf)
void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout) void cmGlobalVisualStudio10Generator::WriteSLNHeader(std::ostream& fout)
{ {
fout << "Microsoft Visual Studio Solution File, Format Version 11.00\n"; 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 ///! Create a local generator appropriate to this Global Generator
cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator() cmLocalGenerator *cmGlobalVisualStudio10Generator::CreateLocalGenerator()
{ {
cmLocalGenerator*lg = new cmLocalVisualStudio10Generator; cmLocalVisualStudio10Generator* lg = new cmLocalVisualStudio10Generator;
lg->SetPlatformName(this->PlatformName.c_str());
lg->SetGlobalGenerator(this); lg->SetGlobalGenerator(this);
return lg; return lg;
} }

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

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

@ -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, bool cmGlobalVisualStudio7Generator::IsPartOfDefaultBuild(const char* project,
cmTarget* target) cmTarget* target)
{ {

@ -92,6 +92,10 @@ public:
///! What is the configurations directory variable called? ///! What is the configurations directory variable called?
virtual const char* GetCMakeCFGInitDirectory() { return "$(OutDir)"; } 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: protected:
virtual const char* GetIDEVersion() { return "7.0"; } virtual const char* GetIDEVersion() { return "7.0"; }
@ -133,7 +137,6 @@ protected:
std::string ConvertToSolutionPath(const char* path); std::string ConvertToSolutionPath(const char* path);
virtual bool IsRootOnlyTarget(cmTarget* target);
bool IsPartOfDefaultBuild(const char* project, bool IsPartOfDefaultBuild(const char* project,
cmTarget* target); cmTarget* target);
std::vector<std::string> Configurations; std::vector<std::string> Configurations;

@ -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 // Add a special target on which all other targets depend that
// checks the build system and optionally re-runs CMake. // checks the build system and optionally re-runs CMake.
const char* no_working_directory = 0; const char* no_working_directory = 0;
std::vector<std::string> no_depends; std::vector<std::string> no_depends;
std::map<cmStdString, std::vector<cmLocalGenerator*> >::iterator it; std::vector<cmLocalGenerator*> const& generators = this->LocalGenerators;
for(it = this->ProjectMap.begin(); it!= this->ProjectMap.end(); ++it) cmLocalVisualStudio7Generator* lg =
{ static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
std::vector<cmLocalGenerator*>& generators = it->second; cmMakefile* mf = lg->GetMakefile();
if(!generators.empty())
{
// Add the build-system check target to the first local
// generator of this project.
cmLocalVisualStudio7Generator* lg =
static_cast<cmLocalVisualStudio7Generator*>(generators[0]);
cmMakefile* mf = lg->GetMakefile();
// Skip the target if no regeneration is to be done. // Skip the target if no regeneration is to be done.
if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION")) if(mf->IsOn("CMAKE_SUPPRESS_REGENERATION"))
{ {
continue; return;
} }
std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND"); std::string cmake_command = mf->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLines noCommandLines; cmCustomCommandLines noCommandLines;
mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false, cmTarget* tgt =
no_working_directory, no_depends, mf->AddUtilityCommand(CMAKE_CHECK_BUILD_SYSTEM_TARGET, false,
noCommandLines); no_working_directory, no_depends,
cmTarget* tgt = mf->FindTarget(CMAKE_CHECK_BUILD_SYSTEM_TARGET); noCommandLines);
if(!tgt)
{
cmSystemTools::Error("Error adding target "
CMAKE_CHECK_BUILD_SYSTEM_TARGET);
continue;
}
// Create a list of all stamp files for this project. // Create a list of all stamp files for this project.
std::vector<std::string> stamps; std::vector<std::string> stamps;
std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash(); std::string stampList = cmake::GetCMakeFilesDirectoryPostSlash();
stampList += "generate.stamp.list"; stampList += "generate.stamp.list";
{ {
std::string stampListFile = std::string stampListFile =
generators[0]->GetMakefile()->GetCurrentOutputDirectory(); generators[0]->GetMakefile()->GetCurrentOutputDirectory();
stampListFile += "/"; stampListFile += "/";
stampListFile += stampList; stampListFile += stampList;
std::string stampFile; std::string stampFile;
cmGeneratedFileStream fout(stampListFile.c_str()); cmGeneratedFileStream fout(stampListFile.c_str());
for(std::vector<cmLocalGenerator*>::const_iterator for(std::vector<cmLocalGenerator*>::const_iterator
gi = generators.begin(); gi != generators.end(); ++gi) gi = generators.begin(); gi != generators.end(); ++gi)
{ {
stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory(); stampFile = (*gi)->GetMakefile()->GetCurrentOutputDirectory();
stampFile += "/"; stampFile += "/";
stampFile += cmake::GetCMakeFilesDirectoryPostSlash(); stampFile += cmake::GetCMakeFilesDirectoryPostSlash();
stampFile += "generate.stamp"; stampFile += "generate.stamp";
stampFile = generators[0]->Convert(stampFile.c_str(), stampFile = generators[0]->Convert(stampFile.c_str(),
cmLocalGenerator::START_OUTPUT); cmLocalGenerator::START_OUTPUT);
fout << stampFile << "\n"; fout << stampFile << "\n";
stamps.push_back(stampFile); stamps.push_back(stampFile);
} }
} }
// Add a custom rule to re-run CMake if any input files changed. // Add a custom rule to re-run CMake if any input files changed.
{ {
// Collect the input files used to generate all targets in this // Collect the input files used to generate all targets in this
// project. // project.
std::vector<std::string> listFiles; std::vector<std::string> listFiles;
for(unsigned int j = 0; j < generators.size(); ++j) for(unsigned int j = 0; j < generators.size(); ++j)
{ {
cmMakefile* lmf = generators[j]->GetMakefile(); cmMakefile* lmf = generators[j]->GetMakefile();
listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(), listFiles.insert(listFiles.end(), lmf->GetListFiles().begin(),
lmf->GetListFiles().end()); lmf->GetListFiles().end());
} }
// Sort the list of input files and remove duplicates. // Sort the list of input files and remove duplicates.
std::sort(listFiles.begin(), listFiles.end(), std::sort(listFiles.begin(), listFiles.end(),
std::less<std::string>()); std::less<std::string>());
std::vector<std::string>::iterator new_end = std::vector<std::string>::iterator new_end =
std::unique(listFiles.begin(), listFiles.end()); std::unique(listFiles.begin(), listFiles.end());
listFiles.erase(new_end, listFiles.end()); listFiles.erase(new_end, listFiles.end());
// Create a rule to re-run CMake. // Create a rule to re-run CMake.
std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash(); std::string stampName = cmake::GetCMakeFilesDirectoryPostSlash();
stampName += "generate.stamp"; stampName += "generate.stamp";
const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND"); const char* dsprule = mf->GetRequiredDefinition("CMAKE_COMMAND");
cmCustomCommandLine commandLine; cmCustomCommandLine commandLine;
commandLine.push_back(dsprule); commandLine.push_back(dsprule);
std::string argH = "-H"; std::string argH = "-H";
argH += lg->Convert(mf->GetHomeDirectory(), argH += lg->Convert(mf->GetHomeDirectory(),
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED, true); cmLocalGenerator::UNCHANGED, true);
commandLine.push_back(argH); commandLine.push_back(argH);
std::string argB = "-B"; std::string argB = "-B";
argB += lg->Convert(mf->GetHomeOutputDirectory(), argB += lg->Convert(mf->GetHomeOutputDirectory(),
cmLocalGenerator::START_OUTPUT, cmLocalGenerator::START_OUTPUT,
cmLocalGenerator::UNCHANGED, true); cmLocalGenerator::UNCHANGED, true);
commandLine.push_back(argB); commandLine.push_back(argB);
commandLine.push_back("--check-stamp-list"); commandLine.push_back("--check-stamp-list");
commandLine.push_back(stampList.c_str()); commandLine.push_back(stampList.c_str());
commandLine.push_back("--vs-solution-file"); commandLine.push_back("--vs-solution-file");
commandLine.push_back("\"$(SolutionPath)\""); commandLine.push_back("\"$(SolutionPath)\"");
cmCustomCommandLines commandLines; cmCustomCommandLines commandLines;
commandLines.push_back(commandLine); commandLines.push_back(commandLine);
// Add the rule. Note that we cannot use the CMakeLists.txt // Add the rule. Note that we cannot use the CMakeLists.txt
// file as the main dependency because it would get // file as the main dependency because it would get
// overwritten by the CreateVCProjBuildRule. // overwritten by the CreateVCProjBuildRule.
// (this could be avoided with per-target source files) // (this could be avoided with per-target source files)
const char* no_main_dependency = 0; const char* no_main_dependency = 0;
const char* no_working_directory = 0; const char* no_working_directory = 0;
mf->AddCustomCommandToOutput( mf->AddCustomCommandToOutput(
stamps, listFiles, stamps, listFiles,
no_main_dependency, commandLines, "Checking Build System", no_main_dependency, commandLines, "Checking Build System",
no_working_directory, true); no_working_directory, true);
std::string ruleName = stamps[0]; std::string ruleName = stamps[0];
ruleName += ".rule"; ruleName += ".rule";
if(cmSourceFile* file = mf->GetSource(ruleName.c_str())) if(cmSourceFile* file = mf->GetSource(ruleName.c_str()))
{ {
tgt->AddSourceFile(file); tgt->AddSourceFile(file);
}
else
{
cmSystemTools::Error("Error adding rule for ", stamps[0].c_str());
}
}
}
} }
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. // All targets depend on the build-system check target.
for(std::map<cmStdString,cmTarget *>::const_iterator for(std::map<cmStdString,cmTarget *>::const_iterator
@ -289,6 +280,29 @@ cmGlobalVisualStudio8Generator
} }
} }
//----------------------------------------------------------------------------
bool cmGlobalVisualStudio8Generator::NeedLinkLibraryDependencies(
cmTarget& target)
{
// Look for utility dependencies that magically link.
for(std::set<cmStdString>::const_iterator ui =
target.GetUtilities().begin();
ui != target.GetUtilities().end(); ++ui)
{
if(cmTarget* depTarget = this->FindTarget(0, ui->c_str()))
{
if(depTarget->GetProperty("EXTERNAL_MSPROJECT"))
{
// This utility dependency names an external .vcproj target.
// We use LinkLibraryDependencies="true" to link to it without
// predicting the .lib file location or name.
return true;
}
}
}
return false;
}
//---------------------------------------------------------------------------- //----------------------------------------------------------------------------
static cmVS7FlagTable cmVS8ExtraFlagTable[] = static cmVS7FlagTable cmVS8ExtraFlagTable[] =
{ {

@ -38,6 +38,8 @@ public:
///! Create a local generator appropriate to this Global Generator ///! Create a local generator appropriate to this Global Generator
virtual cmLocalGenerator *CreateLocalGenerator(); virtual cmLocalGenerator *CreateLocalGenerator();
std::string const& GetPlatformName() const { return this->PlatformName; }
/** /**
* Override Configure and Generate to add the build-system check * Override Configure and Generate to add the build-system check
* target. * target.
@ -58,11 +60,17 @@ public:
*/ */
virtual std::string GetUserMacrosRegKeyBase(); 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: protected:
virtual const char* GetIDEVersion() { return "8.0"; } virtual const char* GetIDEVersion() { return "8.0"; }
virtual bool VSLinksDependencies() const { return false; } virtual bool VSLinksDependencies() const { return false; }
void AddCheckTarget();
static cmIDEFlagTable const* GetExtraFlagTableVS8(); static cmIDEFlagTable const* GetExtraFlagTableVS8();
virtual void AddPlatformDefinitions(cmMakefile* mf); virtual void AddPlatformDefinitions(cmMakefile* mf);
virtual void WriteSLNHeader(std::ostream& fout); virtual void WriteSLNHeader(std::ostream& fout);

@ -88,10 +88,11 @@ protected:
virtual void GetTargetSets(TargetDependSet& projectTargets, virtual void GetTargetSets(TargetDependSet& projectTargets,
TargetDependSet& originalTargets, TargetDependSet& originalTargets,
cmLocalGenerator* root, GeneratorVector const&); cmLocalGenerator* root, GeneratorVector const&);
bool CheckTargetLinks(cmTarget& target, const char* name);
private: private:
void FixUtilityDependsForTarget(cmTarget& target); void FixUtilityDependsForTarget(cmTarget& target);
void CreateUtilityDependTarget(cmTarget& target); void CreateUtilityDependTarget(cmTarget& target);
bool CheckTargetLinks(cmTarget& target, const char* name);
}; };
#endif #endif

@ -655,6 +655,10 @@ cmGlobalXCodeGenerator::CreateXCodeFileReference(cmSourceFile* sf,
{ {
sourcecode += ".c.c"; sourcecode += ".c.c";
} }
else if(lang && strcmp(lang, "Fortran") == 0)
{
sourcecode += ".fortran.f90";
}
else if(ext == "png" || ext == "gif" || ext == "jpg") else if(ext == "png" || ext == "gif" || ext == "jpg")
{ {
sourcecode = "image"; sourcecode = "image";
@ -1277,7 +1281,10 @@ void cmGlobalXCodeGenerator
) )
{ {
std::string makefileName=makefileBasename; std::string makefileName=makefileBasename;
makefileName+=configName; if(this->XcodeVersion > 20)
{
makefileName+=configName;
}
cmGeneratedFileStream makefileStream(makefileName.c_str()); cmGeneratedFileStream makefileStream(makefileName.c_str());
if(!makefileStream) if(!makefileStream)
{ {
@ -1833,25 +1840,25 @@ void cmGlobalXCodeGenerator::CreateBuildSettings(cmTarget& target,
// VERSION -> current_version // VERSION -> current_version
target.GetTargetVersion(false, major, minor, patch); 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 v << major << "." << minor << "." << patch;
major = 1;
} }
cmOStringStream v;
v << major << "." << minor << "." << patch;
buildSettings->AddAttribute("DYLIB_CURRENT_VERSION", buildSettings->AddAttribute("DYLIB_CURRENT_VERSION",
this->CreateString(v.str().c_str())); this->CreateString(v.str().c_str()));
// SOVERSION -> compatibility_version // SOVERSION -> compatibility_version
target.GetTargetVersion(true, major, minor, patch); 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 vso << major << "." << minor << "." << patch;
major = 1;
} }
cmOStringStream vso;
vso << major << "." << minor << "." << patch;
buildSettings->AddAttribute("DYLIB_COMPATIBILITY_VERSION", buildSettings->AddAttribute("DYLIB_COMPATIBILITY_VERSION",
this->CreateString(vso.str().c_str())); this->CreateString(vso.str().c_str()));
} }

@ -16,6 +16,22 @@
#include <list> #include <list>
#include <cmsys/RegularExpression.hxx> #include <cmsys/RegularExpression.hxx>
static std::string cmIfCommandError(
cmMakefile* mf, std::vector<std::string> const& args)
{
cmLocalGenerator* lg = mf->GetLocalGenerator();
std::string err = "given arguments:\n ";
for(std::vector<std::string>::const_iterator i = args.begin();
i != args.end(); ++i)
{
err += " ";
err += lg->EscapeForCMake(i->c_str());
}
err += "\n";
return err;
}
//========================================================================= //=========================================================================
bool cmIfFunctionBlocker:: bool cmIfFunctionBlocker::
IsFunctionBlocked(const cmListFileFunction& lff, IsFunctionBlocked(const cmListFileFunction& lff,
@ -85,16 +101,7 @@ IsFunctionBlocked(const cmListFileFunction& lff,
if (errorString.size()) if (errorString.size())
{ {
std::string err = "given arguments\n "; std::string err = cmIfCommandError(&mf, expandedArguments);
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";
err += errorString; err += errorString;
mf.IssueMessage(messType, err); mf.IssueMessage(messType, err);
if (messType == cmake::FATAL_ERROR) if (messType == cmake::FATAL_ERROR)
@ -175,16 +182,7 @@ bool cmIfCommand
if (errorString.size()) if (errorString.size())
{ {
std::string err = "given arguments\n "; std::string err = cmIfCommandError(this->Makefile, expandedArguments);
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";
err += errorString; err += errorString;
if (status == cmake::FATAL_ERROR) if (status == cmake::FATAL_ERROR)
{ {
@ -215,84 +213,69 @@ bool cmIfCommand
namespace namespace
{ {
//========================================================================= //=========================================================================
// returns true if succesfull, the resulting bool parsed is stored in result bool GetBooleanValue(std::string& arg, cmMakefile* mf)
bool GetBooleanValue(std::string &newArg,
cmMakefile *makefile,
bool &result,
std::string &errorString,
cmPolicies::PolicyStatus Policy12Status,
cmake::MessageType &status)
{ {
if (Policy12Status != cmPolicies::OLD && // Check basic constants.
Policy12Status != cmPolicies::WARN) if (arg == "0")
{
// 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")
{ {
result = false; return false;
return true;
} }
if (newArg == "1") if (arg == "1")
{ {
result = true; return true;
return true;
} }
// old behavior is to dereference the var // Check named constants.
if (Policy12Status == cmPolicies::OLD) 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 // Check for numbers.
// warn if used if(!arg.empty())
if (cmSystemTools::IsOn(newArg.c_str())) {
char* end;
double d = strtod(arg.c_str(), &end);
if(*end == '\0')
{ {
// only warn if the value would change // The whole string is a number. Use C conversion to bool.
const char *def = makefile->GetDefinition(newArg.c_str()); return d? true:false;
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;
} }
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 def = arg.c_str();
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;
} }
return false; return !cmSystemTools::IsOff(def);
}
} }
//========================================================================= //=========================================================================
@ -302,16 +285,50 @@ namespace
cmMakefile *makefile, cmMakefile *makefile,
std::string &errorString, std::string &errorString,
cmPolicies::PolicyStatus Policy12Status, cmPolicies::PolicyStatus Policy12Status,
cmake::MessageType &status) cmake::MessageType &status,
bool oneArg = false)
{ {
bool result = false; // Use the policy if it is set.
if (GetBooleanValue(newArg, makefile, result, if (Policy12Status == cmPolicies::NEW)
errorString, Policy12Status, status))
{ {
return result; return GetBooleanValue(newArg, makefile);
} }
const char *def = makefile->GetDefinition(newArg.c_str()); else if (Policy12Status == cmPolicies::OLD)
return !cmSystemTools::IsOff(def); {
return GetBooleanValueOld(newArg, makefile, oneArg);
}
// Check policy only if old and new results differ.
bool newResult = GetBooleanValue(newArg, makefile);
bool oldResult = GetBooleanValueOld(newArg, makefile, oneArg);
if(newResult != oldResult)
{
switch(Policy12Status)
{
case cmPolicies::WARN:
{
cmPolicies* policies = makefile->GetPolicies();
errorString = "An argument named \"" + newArg
+ "\" appears in a conditional statement. "
+ policies->GetPolicyWarning(cmPolicies::CMP0012);
status = cmake::AUTHOR_WARNING;
}
case cmPolicies::OLD:
return oldResult;
case cmPolicies::REQUIRED_IF_USED:
case cmPolicies::REQUIRED_ALWAYS:
{
cmPolicies* policies = makefile->GetPolicies();
errorString = "An argument named \"" + newArg
+ "\" appears in a conditional statement. "
+ policies->GetRequiredPolicyError(cmPolicies::CMP0012);
status = cmake::FATAL_ERROR;
}
case cmPolicies::NEW:
break;
}
}
return newResult;
} }
//========================================================================= //=========================================================================
@ -893,7 +910,7 @@ bool cmIfCommand::IsTrue(const std::vector<std::string> &args,
makefile, makefile,
errorString, errorString,
Policy12Status, Policy12Status,
status); status, true);
} }
//========================================================================= //=========================================================================

@ -121,16 +121,24 @@ public:
"Then any EQUAL, LESS, GREATER, STRLESS, STRGREATER, STREQUAL, MATCHES " "Then any EQUAL, LESS, GREATER, STRLESS, STRGREATER, STREQUAL, MATCHES "
"will be evaluated. Then NOT operators and finally AND, OR operators " "will be evaluated. Then NOT operators and finally AND, OR operators "
"will be evaluated. Possible expressions are:\n" "will be evaluated. Possible expressions are:\n"
" if(variable)\n" " if(<constant>)\n"
"True if the variable's value is not empty, 0, N, NO, OFF, FALSE, " "True if the constant is 1, ON, YES, TRUE, Y, or a non-zero number. "
"NOTFOUND, or <variable>-NOTFOUND.\n" "False if the constant is 0, OFF, NO, FALSE, N, IGNORE, \"\", "
" if(NOT variable)\n" "or ends in the suffix '-NOTFOUND'. "
"True if the variable's value is empty, 0, N, NO, OFF, FALSE, " "Named boolean constants are case-insensitive."
"NOTFOUND, or <variable>-NOTFOUND.\n" "\n"
" if(variable1 AND variable2)\n" " if(<variable>)\n"
"True if both variables would be considered true individually.\n" "True if the variable's value is not a false constant."
" if(variable1 OR variable2)\n" "\n"
"True if either variable would be considered true individually.\n" " if(NOT <expression>)\n"
"True if the expression is not true."
"\n"
" if(<expr1> AND <expr2>)\n"
"True if both expressions would be considered true individually."
"\n"
" if(<expr1> OR <expr2>)\n"
"True if either expression would be considered true individually."
"\n"
" if(COMMAND command-name)\n" " if(COMMAND command-name)\n"
"True if the given name is a command, macro or function that can be " "True if the given name is a command, macro or function that can be "
"invoked.\n" "invoked.\n"

@ -13,7 +13,7 @@
#include "cmTarget.h" #include "cmTarget.h"
#include "cmMakefile.h" #include "cmMakefile.h"
#include "cmVisualStudio10TargetGenerator.h" #include "cmVisualStudio10TargetGenerator.h"
#include "cmGlobalVisualStudio7Generator.h" #include "cmGlobalVisualStudio10Generator.h"
#include <cm_expat.h> #include <cm_expat.h>
#include "cmXMLParser.h" #include "cmXMLParser.h"
class cmVS10XMLParser : public cmXMLParser class cmVS10XMLParser : public cmXMLParser
@ -93,9 +93,9 @@ void cmLocalVisualStudio10Generator::Generate()
for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l) for(cmTargets::iterator l = tgts.begin(); l != tgts.end(); ++l)
{ {
cmVisualStudio10TargetGenerator tg(&l->second, cmVisualStudio10TargetGenerator tg(
(cmGlobalVisualStudio7Generator*) &l->second, static_cast<cmGlobalVisualStudio10Generator*>(
this->GetGlobalGenerator()); this->GetGlobalGenerator()));
tg.Generate(); tg.Generate();
} }
this->WriteStampFiles(); this->WriteStampFiles();

@ -588,7 +588,8 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(std::ostream& fout,
std::string flags; std::string flags;
if(strcmp(configType, "10") != 0) if(strcmp(configType, "10") != 0)
{ {
const char* linkLanguage = target.GetLinkerLanguage(configName); const char* linkLanguage = (this->FortranProject? "Fortran":
target.GetLinkerLanguage(configName));
if(!linkLanguage) if(!linkLanguage)
{ {
cmSystemTools::Error cmSystemTools::Error
@ -845,6 +846,8 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
cmTarget &target, cmTarget &target,
bool isDebug) bool isDebug)
{ {
cmGlobalVisualStudio7Generator* gg =
static_cast<cmGlobalVisualStudio7Generator*>(this->GlobalGenerator);
std::string temp; std::string temp;
std::string extraLinkOptions; std::string extraLinkOptions;
if(target.GetType() == cmTarget::EXECUTABLE) if(target.GetType() == cmTarget::EXECUTABLE)
@ -948,6 +951,10 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
} }
fout << "\t\t\t<Tool\n" fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"" << tool << "\"\n"; << "\t\t\t\tName=\"" << tool << "\"\n";
if(!gg->NeedLinkLibraryDependencies(target))
{
fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n";
}
linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
// Use the NOINHERIT macro to avoid getting VS project default // Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad. // libraries which may be set by the user to something bad.
@ -1020,6 +1027,10 @@ void cmLocalVisualStudio7Generator::OutputBuildTool(std::ostream& fout,
} }
fout << "\t\t\t<Tool\n" fout << "\t\t\t<Tool\n"
<< "\t\t\t\tName=\"" << tool << "\"\n"; << "\t\t\t\tName=\"" << tool << "\"\n";
if(!gg->NeedLinkLibraryDependencies(target))
{
fout << "\t\t\t\tLinkLibraryDependencies=\"false\"\n";
}
linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n"); linkOptions.OutputAdditionalOptions(fout, "\t\t\t\t", "\n");
// Use the NOINHERIT macro to avoid getting VS project default // Use the NOINHERIT macro to avoid getting VS project default
// libraries which may be set by the user to something bad. // libraries which may be set by the user to something bad.

@ -3388,14 +3388,20 @@ void cmMakefile::RaiseScope(const char *var, const char *varDef)
// Now update the definition in the parent scope. // Now update the definition in the parent scope.
up->Set(var, varDef); up->Set(var, varDef);
} }
else if(cmMakefile* parent = else if(cmLocalGenerator* plg = this->LocalGenerator->GetParent())
this->LocalGenerator->GetParent()->GetMakefile())
{ {
// Update the definition in the parent directory top scope. This // Update the definition in the parent directory top scope. This
// directory's scope was initialized by the closure of the parent // directory's scope was initialized by the closure of the parent
// scope, so we do not need to localize the definition first. // scope, so we do not need to localize the definition first.
cmMakefile* parent = plg->GetMakefile();
parent->Internal->VarStack.top().Set(var, varDef); 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());
}
} }

@ -358,19 +358,24 @@ cmPolicies::cmPolicies()
this->DefinePolicy( this->DefinePolicy(
CMP0012, "CMP0012", CMP0012, "CMP0012",
"The if() command can recognize named boolean constants.", "if() recognizes numbers and boolean constants.",
"In CMake versions 2.6.4 and lower the only boolean constants were 0 " "In CMake versions 2.6.4 and lower the if() command implicitly "
"and 1. Other boolean constants such as true, false, yes, no, " "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 " "on, off, y, n, notfound, ignore (all case insensitive) were recognized "
"in some cases but not all. " "in some cases but not all. "
"For example, the code \"if(TRUE)\" might have evaluated as false. " "For example, the code \"if(TRUE)\" might have evaluated as false. "
"In later versions of cmake these values are " "Numbers such as 2 were recognized only in "
"treated as boolean constants more consistently and should not be used " "boolean expressions like \"if(NOT 2)\" (leading to false) "
"as variable names. " "but not as a single-argument like \"if(2)\" (also leading to false). "
"The OLD behavior for this policy is to allow variables to have names " "Later versions of CMake prefer to treat numbers and boolean constants "
"such as true and to dereference them. " "literally, so they should not be used as variable names."
"The NEW behavior for this policy is to treat strings like true as a " "\n"
"boolean constant.", "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); 2,8,0, cmPolicies::WARN);
this->DefinePolicy( this->DefinePolicy(

@ -47,7 +47,7 @@ public:
CMP0009, // GLOB_RECURSE should not follow symlinks by default CMP0009, // GLOB_RECURSE should not follow symlinks by default
CMP0010, // Bad variable reference syntax is an error CMP0010, // Bad variable reference syntax is an error
CMP0011, // Strong policy scope for include and find_package 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 CMP0013, // Duplicate binary directories not allowed
CMP0014, // Input directories must have CMakeLists.txt CMP0014, // Input directories must have CMakeLists.txt

@ -46,7 +46,6 @@
#if defined(CMAKE_BUILD_WITH_CMAKE) #if defined(CMAKE_BUILD_WITH_CMAKE)
# include <libtar/libtar.h> # include <libtar/libtar.h>
# include <memory> // auto_ptr
# include <fcntl.h> # include <fcntl.h>
# include <cm_zlib.h> # include <cm_zlib.h>
# include <cmsys/MD5.h> # include <cmsys/MD5.h>
@ -1807,9 +1806,8 @@ bool cmSystemTools::CreateTar(const char* outFileName,
&gzs &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 ]; char* realName = new char[ strlen(outFileName) + 1 ];
std::auto_ptr<char> realNamePtr(realName);
strcpy(realName, outFileName); strcpy(realName, outFileName);
int options = 0; int options = 0;
if(verbose) if(verbose)
@ -1825,9 +1823,12 @@ bool cmSystemTools::CreateTar(const char* outFileName,
options) == -1) options) == -1)
{ {
cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); cmSystemTools::Error("Problem with tar_open(): ", strerror(errno));
delete [] realName;
return false; return false;
} }
delete [] realName;
std::vector<cmStdString>::const_iterator it; std::vector<cmStdString>::const_iterator it;
for (it = files.begin(); it != files.end(); ++ 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)); cmSystemTools::Error("Problem with tar_close(): ", strerror(errno));
return false; return false;
} }
return true; return true;
#else #else
(void)outFileName; (void)outFileName;
@ -1886,9 +1888,8 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
&gzs &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 ]; char* realName = new char[ strlen(outFileName) + 1 ];
std::auto_ptr<char> realNamePtr(realName);
strcpy(realName, outFileName); strcpy(realName, outFileName);
if (tar_open(&t, realName, if (tar_open(&t, realName,
(gzip? &gztype : NULL), (gzip? &gztype : NULL),
@ -1901,9 +1902,12 @@ bool cmSystemTools::ExtractTar(const char* outFileName,
| 0) == -1) | 0) == -1)
{ {
cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); cmSystemTools::Error("Problem with tar_open(): ", strerror(errno));
delete [] realName;
return false; return false;
} }
delete [] realName;
if (tar_extract_all(t, 0) != 0) if (tar_extract_all(t, 0) != 0)
{ {
cmSystemTools::Error("Problem with tar_extract_all(): ", strerror(errno)); cmSystemTools::Error("Problem with tar_extract_all(): ", strerror(errno));
@ -1940,9 +1944,8 @@ bool cmSystemTools::ListTar(const char* outFileName,
&gzs &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 ]; char* realName = new char[ strlen(outFileName) + 1 ];
std::auto_ptr<char> realNamePtr(realName);
strcpy(realName, outFileName); strcpy(realName, outFileName);
if (tar_open(&t, realName, if (tar_open(&t, realName,
(gzip? &gztype : NULL), (gzip? &gztype : NULL),
@ -1955,9 +1958,12 @@ bool cmSystemTools::ListTar(const char* outFileName,
| 0) == -1) | 0) == -1)
{ {
cmSystemTools::Error("Problem with tar_open(): ", strerror(errno)); cmSystemTools::Error("Problem with tar_open(): ", strerror(errno));
delete [] realName;
return false; return false;
} }
delete [] realName;
while ((th_read(t)) == 0) while ((th_read(t)) == 0)
{ {
const char* filename = th_get_pathname(t); const char* filename = th_get_pathname(t);

@ -881,30 +881,25 @@ void cmTarget::DefineProperties(cmake *cm)
"an archive target. " \ "an archive target. " \
"All Windows-based systems including Cygwin are DLL platforms." "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 cm->DefineProperty
("ARCHIVE_OUTPUT_DIRECTORY", cmProperty::TARGET, ("ARCHIVE_OUTPUT_DIRECTORY", cmProperty::TARGET,
"Output directory in which to build ARCHIVE target files.", "Output directory in which to build ARCHIVE target files.",
"This property specifies the directory into which archive target files " CM_TARGET_OUTDIR_DOC(ARCHIVE, archive));
"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->DefineProperty cm->DefineProperty
("LIBRARY_OUTPUT_DIRECTORY", cmProperty::TARGET, ("LIBRARY_OUTPUT_DIRECTORY", cmProperty::TARGET,
"Output directory in which to build LIBRARY target files.", "Output directory in which to build LIBRARY target files.",
"This property specifies the directory into which library target files " CM_TARGET_OUTDIR_DOC(LIBRARY, library));
"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->DefineProperty cm->DefineProperty
("RUNTIME_OUTPUT_DIRECTORY", cmProperty::TARGET, ("RUNTIME_OUTPUT_DIRECTORY", cmProperty::TARGET,
"Output directory in which to build RUNTIME target files.", "Output directory in which to build RUNTIME target files.",
"This property specifies the directory into which runtime target files " CM_TARGET_OUTDIR_DOC(RUNTIME, runtime));
"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->DefineProperty cm->DefineProperty
("ARCHIVE_OUTPUT_NAME", cmProperty::TARGET, ("ARCHIVE_OUTPUT_NAME", cmProperty::TARGET,

@ -102,9 +102,11 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
"Fast", "Fast", 0}, "Fast", "Fast", 0},
{"PrecompiledHeader", "Yc", {"PrecompiledHeader", "Yc",
"Create", "Create", 0}, "Create", "Create",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"PrecompiledHeader", "Yu", {"PrecompiledHeader", "Yu",
"Use", "Use", 0}, "Use", "Use",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"PrecompiledHeader", "", {"PrecompiledHeader", "",
"Not Using Precompiled Headers", "NotUsing", 0}, "Not Using Precompiled Headers", "NotUsing", 0},
@ -136,7 +138,7 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
{"ErrorReporting", "errorReport:none", {"ErrorReporting", "errorReport:none",
"Do Not Send Report", "None", 0}, "Do Not Send Report", "None", 0},
{"ErrorReporting", "errorReport:prompt", {"ErrorReporting", "errorReport:prompt",
"Prompt Immediatelly", "Prompt", 0}, "Prompt Immediately", "Prompt", 0},
{"ErrorReporting", "errorReport:queue", {"ErrorReporting", "errorReport:queue",
"Queue For Next Login", "Queue", 0}, "Queue For Next Login", "Queue", 0},
{"ErrorReporting", "errorReport:send", {"ErrorReporting", "errorReport:send",
@ -180,7 +182,7 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
{"FunctionLevelLinking", "Gy", "", "true", 0}, {"FunctionLevelLinking", "Gy", "", "true", 0},
{"FloatingPointExceptions", "fp:except-", "", "false", 0}, {"FloatingPointExceptions", "fp:except-", "", "false", 0},
{"FloatingPointExceptions", "fp:except", "", "true", 0}, {"FloatingPointExceptions", "fp:except", "", "true", 0},
{"CodeGeneration", "hotpatch", "", "true", 0}, {"CreateHotpatchableImage", "hotpatch", "", "true", 0},
{"DisableLanguageExtensions", "Za", "", "true", 0}, {"DisableLanguageExtensions", "Za", "", "true", 0},
{"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0}, {"TreatWChar_tAsBuiltInType", "Zc:wchar_t-", "", "false", 0},
{"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0}, {"TreatWChar_tAsBuiltInType", "Zc:wchar_t", "", "true", 0},
@ -199,14 +201,16 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
{"UseUnicodeForAssemblerListing", "FAu", "", "true", 0}, {"UseUnicodeForAssemblerListing", "FAu", "", "true", 0},
//Bool Properties With Argument //Bool Properties With Argument
{"MultiProcessorCompilation", "MP", "", "true", cmVS7FlagTable::Continue}, {"MultiProcessorCompilation", "MP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"ProcessorNumber", "MP", "Multi-processor Compilation", "", {"ProcessorNumber", "MP", "Multi-processor Compilation", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
{"GenerateXMLDocumentationFiles", "doc", "", "true", {"GenerateXMLDocumentationFiles", "doc", "", "true",
cmVS7FlagTable::Continue}, cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "", {"XMLDocumentationFileName", "doc", "Generate XML Documentation Files", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
{"BrowseInformation", "FR", "", "true", cmVS7FlagTable::Continue}, {"BrowseInformation", "FR", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"BrowseInformationFile", "FR", "Enable Browse Information", "", {"BrowseInformationFile", "FR", "Enable Browse Information", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
@ -238,7 +242,15 @@ static cmVS7FlagTable cmVS10CLFlagTable[] =
//String Properties //String Properties
// Skip [TrackerLogDirectory] - no command line Switch. // 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", {"PrecompiledHeaderOutputFile", "Fp",
"Precompiled Header Output File", "Precompiled Header Output File",
"", cmVS7FlagTable::UserValue}, "", cmVS7FlagTable::UserValue},

@ -191,13 +191,16 @@ static cmVS7FlagTable cmVS10LinkFlagTable[] =
{"LinkDLL", "DLL", "", "true", 0}, {"LinkDLL", "DLL", "", "true", 0},
//Bool Properties With Argument //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)", "", {"EnableUAC", "MANIFESTUAC:NO", "Enable User Account Control (UAC)", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
{"EnableUAC", "MANIFESTUAC:", "", "true", cmVS7FlagTable::Continue}, {"EnableUAC", "MANIFESTUAC:", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "", {"UACUIAccess", "MANIFESTUAC:", "Enable User Account Control (UAC)", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},
{"GenerateMapFile", "MAP", "", "true", cmVS7FlagTable::Continue}, {"GenerateMapFile", "MAP", "", "true",
cmVS7FlagTable::UserValueIgnored | cmVS7FlagTable::Continue},
{"MapFileName", "MAP", "Generate Map File", "", {"MapFileName", "MAP", "Generate Map File", "",
cmVS7FlagTable::UserValueRequired}, cmVS7FlagTable::UserValueRequired},

@ -10,7 +10,7 @@
See the License for more information. See the License for more information.
============================================================================*/ ============================================================================*/
#include "cmVisualStudio10TargetGenerator.h" #include "cmVisualStudio10TargetGenerator.h"
#include "cmGlobalVisualStudio7Generator.h" #include "cmGlobalVisualStudio10Generator.h"
#include "cmTarget.h" #include "cmTarget.h"
#include "cmComputeLinkInformation.h" #include "cmComputeLinkInformation.h"
#include "cmGeneratedFileStream.h" #include "cmGeneratedFileStream.h"
@ -22,6 +22,8 @@
#include "cmVS10LinkFlagTable.h" #include "cmVS10LinkFlagTable.h"
#include "cmVS10LibFlagTable.h" #include "cmVS10LibFlagTable.h"
#include <cmsys/auto_ptr.hxx>
static std::string cmVS10EscapeXML(std::string arg) static std::string cmVS10EscapeXML(std::string arg)
{ {
cmSystemTools::ReplaceString(arg, "&", "&amp;"); cmSystemTools::ReplaceString(arg, "&", "&amp;");
@ -32,7 +34,7 @@ static std::string cmVS10EscapeXML(std::string arg)
cmVisualStudio10TargetGenerator:: cmVisualStudio10TargetGenerator::
cmVisualStudio10TargetGenerator(cmTarget* target, cmVisualStudio10TargetGenerator(cmTarget* target,
cmGlobalVisualStudio7Generator* gg) cmGlobalVisualStudio10Generator* gg)
{ {
this->GlobalGenerator = gg; this->GlobalGenerator = gg;
this->Target = target; this->Target = target;
@ -43,13 +45,18 @@ cmVisualStudio10TargetGenerator(cmTarget* target,
this->Name = this->Target->GetName(); this->Name = this->Target->GetName();
this->GlobalGenerator->CreateGUID(this->Name.c_str()); this->GlobalGenerator->CreateGUID(this->Name.c_str());
this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str()); this->GUID = this->GlobalGenerator->GetGUID(this->Name.c_str());
this->Platform = "|Win32"; this->Platform = gg->GetPlatformName();
this->ComputeObjectNames(); this->ComputeObjectNames();
this->BuildFileStream = 0; this->BuildFileStream = 0;
} }
cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator() cmVisualStudio10TargetGenerator::~cmVisualStudio10TargetGenerator()
{ {
for(OptionsMap::iterator i = this->ClOptions.begin();
i != this->ClOptions.end(); ++i)
{
delete i->second;
}
if(!this->BuildFileStream) if(!this->BuildFileStream)
{ {
return; return;
@ -80,7 +87,7 @@ void cmVisualStudio10TargetGenerator::WritePlatformConfigTag(
(*stream ) << ""; (*stream ) << "";
(*stream ) << "<" << tag (*stream ) << "<" << tag
<< " Condition=\"'$(Configuration)|$(Platform)'=='"; << " Condition=\"'$(Configuration)|$(Platform)'=='";
(*stream ) << config << this->Platform << "'\""; (*stream ) << config << "|" << this->Platform << "'\"";
if(attribute) if(attribute)
{ {
(*stream ) << attribute; (*stream ) << attribute;
@ -103,6 +110,7 @@ void cmVisualStudio10TargetGenerator::WriteString(const char* line,
(*this->BuildFileStream ) << line; (*this->BuildFileStream ) << line;
} }
#define VS10_USER_PROPS "$(UserRootDir)\\Microsoft.Cpp.$(Platform).user.props"
void cmVisualStudio10TargetGenerator::Generate() 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",this->Name.c_str());
this->Target->SetProperty("GENERATOR_FILE_NAME_EXT", this->Target->SetProperty("GENERATOR_FILE_NAME_EXT",
".vcxproj"); ".vcxproj");
if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY)
{
this->ComputeClOptions();
}
cmMakefile* mf = this->Target->GetMakefile(); cmMakefile* mf = this->Target->GetMakefile();
std::string path = mf->GetStartOutputDirectory(); std::string path = mf->GetStartOutputDirectory();
path += "/"; path += "/";
@ -141,6 +153,8 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<SccProjectName />\n", 2); this->WriteString("<SccProjectName />\n", 2);
this->WriteString("<SccLocalPath />\n", 2); this->WriteString("<SccLocalPath />\n", 2);
this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2); this->WriteString("<Keyword>Win32Proj</Keyword>\n", 2);
this->WriteString("<Platform>", 2);
(*this->BuildFileStream) << this->Platform << "</Platform>\n";
this->WriteString("</PropertyGroup>\n", 1); this->WriteString("</PropertyGroup>\n", 1);
this->WriteString("<Import Project=" this->WriteString("<Import Project="
"\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n", "\"$(VCTargetsPath)\\Microsoft.Cpp.Default.props\" />\n",
@ -151,12 +165,9 @@ void cmVisualStudio10TargetGenerator::Generate()
this->WriteString("<ImportGroup Label=\"ExtensionSettings\">\n", 1); this->WriteString("<ImportGroup Label=\"ExtensionSettings\">\n", 1);
this->WriteString("</ImportGroup>\n", 1); this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1); this->WriteString("<ImportGroup Label=\"PropertySheets\">\n", 1);
this->WriteString("<Import Project=" this->WriteString("<Import Project=\"" VS10_USER_PROPS "\""
"\"$(LocalAppData)\\Microsoft\\VisualStudio\\10.0\\" " Condition=\"exists('" VS10_USER_PROPS "')\""
"Microsoft.Cpp.$(Platform).user.props\" " " Label=\"LocalAppDataPlatform\" />", 2);
"Condition=\"exists('$(LocalAppData)\\Microsoft"
"\\VisualStudio\\10.0\\"
"Microsoft.Cpp.$(Platform).user.props')\" />\n", 2);
this->WriteString("</ImportGroup>\n", 1); this->WriteString("</ImportGroup>\n", 1);
this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1); this->WriteString("<PropertyGroup Label=\"UserMacros\" />\n", 1);
this->WritePathAndIncrementalLinkOptions(); this->WritePathAndIncrementalLinkOptions();
@ -187,10 +198,11 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurations()
i != configs->end(); ++i) i != configs->end(); ++i)
{ {
this->WriteString("<ProjectConfiguration Include=\"", 2); this->WriteString("<ProjectConfiguration Include=\"", 2);
(*this->BuildFileStream ) << *i << this->Platform << "\">\n"; (*this->BuildFileStream ) << *i << "|" << this->Platform << "\">\n";
this->WriteString("<Configuration>", 3); this->WriteString("<Configuration>", 3);
(*this->BuildFileStream ) << *i << "</Configuration>\n"; (*this->BuildFileStream ) << *i << "</Configuration>\n";
this->WriteString("<Platform>Win32</Platform>\n", 3); this->WriteString("<Platform>", 3);
(*this->BuildFileStream) << this->Platform << "</Platform>\n";
this->WriteString("</ProjectConfiguration>\n", 2); this->WriteString("</ProjectConfiguration>\n", 2);
} }
this->WriteString("</ItemGroup>\n", 1); this->WriteString("</ItemGroup>\n", 1);
@ -236,7 +248,15 @@ void cmVisualStudio10TargetGenerator::WriteProjectConfigurationValues()
{ {
this->WriteString("<UseOfMfc>false</UseOfMfc>\n", 2); this->WriteString("<UseOfMfc>false</UseOfMfc>\n", 2);
} }
this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2); if(this->Target->GetType() <= cmTarget::MODULE_LIBRARY &&
this->ClOptions[*i]->UsingUnicode())
{
this->WriteString("<CharacterSet>Unicode</CharacterSet>\n", 2);
}
else
{
this->WriteString("<CharacterSet>MultiByte</CharacterSet>\n", 2);
}
this->WriteString("</PropertyGroup>\n", 1); this->WriteString("</PropertyGroup>\n", 1);
} }
} }
@ -375,6 +395,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
std::vector<cmSourceFile*> clCompile; std::vector<cmSourceFile*> clCompile;
std::vector<cmSourceFile*> customBuild; std::vector<cmSourceFile*> customBuild;
std::vector<cmSourceFile*> none; std::vector<cmSourceFile*> none;
std::vector<cmSourceFile*> headers;
for(std::vector<cmSourceFile*>::const_iterator s = classes.begin(); for(std::vector<cmSourceFile*>::const_iterator s = classes.begin();
s != classes.end(); s++) s != classes.end(); s++)
@ -384,7 +405,10 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
cmSourceGroup& sourceGroup = cmSourceGroup& sourceGroup =
this->Makefile->FindSourceGroup(source.c_str(), sourceGroups); this->Makefile->FindSourceGroup(source.c_str(), sourceGroups);
groupsUsed.insert(&sourceGroup); 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) if(!lang)
{ {
lang = "None"; lang = "None";
@ -397,6 +421,10 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
{ {
customBuild.push_back(sf); customBuild.push_back(sf);
} }
else if(header)
{
headers.push_back(sf);
}
else else
{ {
none.push_back(sf); none.push_back(sf);
@ -419,6 +447,7 @@ void cmVisualStudio10TargetGenerator::WriteGroups()
"developer/msbuild/2003\">\n", "developer/msbuild/2003\">\n",
0); 0);
this->WriteGroupSources("ClCompile", clCompile, sourceGroups); this->WriteGroupSources("ClCompile", clCompile, sourceGroups);
this->WriteGroupSources("ClInclude", headers, sourceGroups);
this->WriteGroupSources("CustomBuild", customBuild, sourceGroups); this->WriteGroupSources("CustomBuild", customBuild, sourceGroups);
this->WriteString("<ItemGroup>\n", 1); this->WriteString("<ItemGroup>\n", 1);
@ -532,13 +561,13 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
{ {
// if it is not a custom command then add it as a c/c++ file, // if it is not a custom command then add it as a c/c++ file,
// TODO: need to check for idl or rc // TODO: need to check for idl or rc
if(!(*source)->GetCustomCommand() if(!(*source)->GetCustomCommand())
&& !(*source)->GetPropertyAsBool("HEADER_FILE_ONLY")
&& !this->GlobalGenerator->IgnoreFile
((*source)->GetExtension().c_str()))
{ {
bool header = (*source)->GetPropertyAsBool("HEADER_FILE_ONLY")
|| this->GlobalGenerator->IgnoreFile
((*source)->GetExtension().c_str());
const char* lang = (*source)->GetLanguage(); 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(); std::string sourceFile = (*source)->GetFullPath();
sourceFile = cmSystemTools::RelativePath( sourceFile = cmSystemTools::RelativePath(
@ -546,10 +575,21 @@ void cmVisualStudio10TargetGenerator::WriteCLSources()
sourceFile.c_str()); sourceFile.c_str());
this->ConvertToWindowsSlash(sourceFile); this->ConvertToWindowsSlash(sourceFile);
// output the source file // output the source file
this->WriteString("<ClCompile Include=\"", 2); if(header)
{
this->WriteString("<ClInclude Include=\"", 2);
}
else if(cl)
{
this->WriteString("<ClCompile Include=\"", 2);
}
else
{
this->WriteString("<None Include=\"", 2);
}
(*this->BuildFileStream ) << sourceFile << "\""; (*this->BuildFileStream ) << sourceFile << "\"";
// ouput any flags specific to this source file // 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 // if the source file has specific flags the tag
// is ended on a new line // is ended on a new line
@ -814,21 +854,31 @@ OutputLinkIncremental(std::string const& configName)
<< "</LinkIncremental>\n"; << "</LinkIncremental>\n";
} }
//----------------------------------------------------------------------------
void cmVisualStudio10TargetGenerator::ComputeClOptions()
{
std::vector<std::string> const* configs =
this->GlobalGenerator->GetConfigurations();
for(std::vector<std::string>::const_iterator i = configs->begin();
i != configs->end(); ++i)
{
this->ComputeClOptions(*i);
}
}
void //----------------------------------------------------------------------------
cmVisualStudio10TargetGenerator:: void cmVisualStudio10TargetGenerator::ComputeClOptions(
WriteClOptions(std::string const& configName, std::string const& configName)
std::vector<std::string> const & includes)
{ {
// much of this was copied from here: // much of this was copied from here:
// copied from cmLocalVisualStudio7Generator.cxx 805 // copied from cmLocalVisualStudio7Generator.cxx 805
// TODO: Integrate code below with cmLocalVisualStudio7Generator.
cmsys::auto_ptr<Options> pOptions(
new Options(this->LocalGenerator, 10, Options::Compiler,
cmVS10CLFlagTable));
Options& clOptions = *pOptions;
this->WriteString("<ClCompile>\n", 2);
cmVisualStudioGeneratorOptions
clOptions(this->LocalGenerator,
10, cmVisualStudioGeneratorOptions::Compiler,
cmVS10CLFlagTable);
std::string flags; std::string flags;
// collect up flags for // collect up flags for
if(this->Target->GetType() < cmTarget::UTILITY) if(this->Target->GetType() < cmTarget::UTILITY)
@ -898,6 +948,17 @@ WriteClOptions(std::string const& configName,
{ {
clOptions.AddDefine(exportMacro); clOptions.AddDefine(exportMacro);
} }
this->ClOptions[configName] = pOptions.release();
}
//----------------------------------------------------------------------------
void cmVisualStudio10TargetGenerator::WriteClOptions(
std::string const& configName,
std::vector<std::string> const& includes)
{
Options& clOptions = *(this->ClOptions[configName]);
this->WriteString("<ClCompile>\n", 2);
clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", ""); clOptions.OutputAdditionalOptions(*this->BuildFileStream, " ", "");
this->OutputIncludes(includes); this->OutputIncludes(includes);
clOptions.OutputFlagMap(*this->BuildFileStream, " "); clOptions.OutputFlagMap(*this->BuildFileStream, " ");
@ -1080,11 +1141,12 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
// first just full path // first just full path
linkDirs += sep; linkDirs += sep;
linkDirs += *d; linkDirs += *d;
sep = ";";
linkDirs += sep; linkDirs += sep;
// next path with configuration type Debug, Release, etc // next path with configuration type Debug, Release, etc
linkDirs += *d; linkDirs += *d;
linkDirs += "/$(Configuration)"; linkDirs += "/$(Configuration)";
sep = ";"; linkDirs += sep;
} }
linkDirs += "%(AdditionalLibraryDirectories)"; linkDirs += "%(AdditionalLibraryDirectories)";
linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str()); linkOptions.AddFlag("AdditionalLibraryDirectories", linkDirs.c_str());
@ -1115,13 +1177,15 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
targetNameImport, targetNamePDB, targetNameImport, targetNamePDB,
config.c_str()); 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 += "/"; dir += "/";
imLib += "/";
imLib += targetNameImport;
std::string pdb = dir; std::string pdb = dir;
pdb += targetNamePDB; pdb += targetNamePDB;
std::string imLib = this->Target->GetDirectory(config.c_str(), true);
imLib += "/";
imLib += targetNameImport;
linkOptions.AddFlag("ImportLibrary", imLib.c_str()); linkOptions.AddFlag("ImportLibrary", imLib.c_str());
linkOptions.AddFlag("ProgramDataBaseFileName", pdb.c_str()); linkOptions.AddFlag("ProgramDataBaseFileName", pdb.c_str());
linkOptions.Parse(flags.c_str()); linkOptions.Parse(flags.c_str());
@ -1134,6 +1198,13 @@ void cmVisualStudio10TargetGenerator::WriteLinkOptions(std::string const&
linkOptions.OutputFlagMap(*this->BuildFileStream, " "); linkOptions.OutputFlagMap(*this->BuildFileStream, " ");
this->WriteString("</Link>\n", 2); this->WriteString("</Link>\n", 2);
if(!this->GlobalGenerator->NeedLinkLibraryDependencies(*this->Target))
{
this->WriteString("<ProjectReference>\n", 2);
this->WriteString(
" <LinkLibraryDependencies>false</LinkLibraryDependencies>\n", 2);
this->WriteString("</ProjectReference>\n", 2);
}
} }
void cmVisualStudio10TargetGenerator::AddLibraries( void cmVisualStudio10TargetGenerator::AddLibraries(

@ -16,18 +16,19 @@
class cmTarget; class cmTarget;
class cmMakefile; class cmMakefile;
class cmGeneratedFileStream; class cmGeneratedFileStream;
class cmGlobalVisualStudio7Generator; class cmGlobalVisualStudio10Generator;
class cmSourceFile; class cmSourceFile;
class cmCustomCommand; class cmCustomCommand;
class cmLocalVisualStudio7Generator; class cmLocalVisualStudio7Generator;
class cmComputeLinkInformation; class cmComputeLinkInformation;
class cmVisualStudioGeneratorOptions;
#include "cmSourceGroup.h" #include "cmSourceGroup.h"
class cmVisualStudio10TargetGenerator class cmVisualStudio10TargetGenerator
{ {
public: public:
cmVisualStudio10TargetGenerator(cmTarget* target, cmVisualStudio10TargetGenerator(cmTarget* target,
cmGlobalVisualStudio7Generator* gg); cmGlobalVisualStudio10Generator* gg);
~cmVisualStudio10TargetGenerator(); ~cmVisualStudio10TargetGenerator();
void Generate(); void Generate();
// used by cmVisualStudioGeneratorOptions // used by cmVisualStudioGeneratorOptions
@ -49,6 +50,8 @@ private:
void WriteObjSources(); void WriteObjSources();
void WritePathAndIncrementalLinkOptions(); void WritePathAndIncrementalLinkOptions();
void WriteItemDefinitionGroups(); void WriteItemDefinitionGroups();
void ComputeClOptions();
void ComputeClOptions(std::string const& configName);
void WriteClOptions(std::string const& config, void WriteClOptions(std::string const& config,
std::vector<std::string> const & includes); std::vector<std::string> const & includes);
void WriteRCOptions(std::string const& config, void WriteRCOptions(std::string const& config,
@ -75,6 +78,9 @@ private:
std::vector<cmSourceFile*> const& sources, std::vector<cmSourceFile*> const& sources,
std::vector<cmSourceGroup>& ); std::vector<cmSourceGroup>& );
private: private:
typedef cmVisualStudioGeneratorOptions Options;
typedef std::map<cmStdString, Options*> OptionsMap;
OptionsMap ClOptions;
std::string ModuleDefinitionFile; std::string ModuleDefinitionFile;
std::string PathToVcxproj; std::string PathToVcxproj;
cmTarget* Target; cmTarget* Target;
@ -82,7 +88,7 @@ private:
std::string Platform; std::string Platform;
std::string GUID; std::string GUID;
std::string Name; std::string Name;
cmGlobalVisualStudio7Generator* GlobalGenerator; cmGlobalVisualStudio10Generator* GlobalGenerator;
cmGeneratedFileStream* BuildFileStream; cmGeneratedFileStream* BuildFileStream;
cmLocalVisualStudio7Generator* LocalGenerator; cmLocalVisualStudio7Generator* LocalGenerator;
std::set<cmSourceFile*> SourcesVisited; std::set<cmSourceFile*> SourcesVisited;

@ -63,6 +63,7 @@
# include "cmGlobalVisualStudio9Generator.h" # include "cmGlobalVisualStudio9Generator.h"
# include "cmGlobalVisualStudio9Win64Generator.h" # include "cmGlobalVisualStudio9Win64Generator.h"
# include "cmGlobalVisualStudio10Generator.h" # include "cmGlobalVisualStudio10Generator.h"
# include "cmGlobalVisualStudio10Win64Generator.h"
# include "cmGlobalVisualStudio8Win64Generator.h" # include "cmGlobalVisualStudio8Win64Generator.h"
# include "cmGlobalBorlandMakefileGenerator.h" # include "cmGlobalBorlandMakefileGenerator.h"
# include "cmGlobalNMakeMakefileGenerator.h" # include "cmGlobalNMakeMakefileGenerator.h"
@ -2413,6 +2414,8 @@ void cmake::AddDefaultGenerators()
&cmGlobalVisualStudio7Generator::New; &cmGlobalVisualStudio7Generator::New;
this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] = this->Generators[cmGlobalVisualStudio10Generator::GetActualName()] =
&cmGlobalVisualStudio10Generator::New; &cmGlobalVisualStudio10Generator::New;
this->Generators[cmGlobalVisualStudio10Win64Generator::GetActualName()] =
&cmGlobalVisualStudio10Win64Generator::New;
this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] = this->Generators[cmGlobalVisualStudio71Generator::GetActualName()] =
&cmGlobalVisualStudio71Generator::New; &cmGlobalVisualStudio71Generator::New;
this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] = this->Generators[cmGlobalVisualStudio8Generator::GetActualName()] =

@ -3,7 +3,9 @@
# more information see here: # more information see here:
# http://blogs.msdn.com/vcblog/archive/2008/12/16/msbuild-task.aspx # http://blogs.msdn.com/vcblog/archive/2008/12/16/msbuild-task.aspx
# cl.xml # "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/cl.xml"
# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/lib.xml"
# "${PROGRAMFILES}/MSBuild/Microsoft.Cpp/v4.0/1033/link.xml"
# #
# BoolProperty <Name>true|false</Name> # BoolProperty <Name>true|false</Name>
# simple example: # simple example:
@ -215,11 +217,25 @@ class MSBuildToCMake:
def toCMake(self): def toCMake(self):
toReturn = "static cmVS7FlagTable cmVS10CxxTable[] =\n{\n" toReturn = "static cmVS7FlagTable cmVS10CxxTable[] =\n{\n"
toReturn += "\n //Enum Properties\n" toReturn += "\n //Enum Properties\n"
lastProp = {}
for i in self.enumProperties: 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: 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" 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" toReturn += "\n //Bool Properties\n"
for i in self.boolProperties: for i in self.boolProperties:
@ -233,10 +249,10 @@ class MSBuildToCMake:
for i in self.boolProperties: for i in self.boolProperties:
if i.argumentProperty != "": if i.argumentProperty != "":
if i.attributes["ReverseSwitch"] != "": 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" toReturn += " {\""+i.attributes["Name"]+"\", \""+i.attributes["ReverseSwitch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n"
if i.attributes["Switch"] != "": 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 += " {\""+i.argumentProperty+"\", \""+i.attributes["Switch"]+"\", \""+i.DisplayName+"\", \"\",\n cmVS7FlagTable::UserValueRequired},\n"
toReturn += "\n //String List Properties\n" toReturn += "\n //String List Properties\n"
@ -249,7 +265,16 @@ class MSBuildToCMake:
toReturn += "\n //String Properties\n" toReturn += "\n //String Properties\n"
for i in self.stringProperties: for i in self.stringProperties:
if i.attributes["Switch"] == "": 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: else:
toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+i.attributes["Separator"]+"\",\n \""+i.DisplayName+"\",\n \"\", cmVS7FlagTable::UserValue},\n" toReturn +=" {\""+i.attributes["Name"]+"\", \""+i.attributes["Switch"]+i.attributes["Separator"]+"\",\n \""+i.DisplayName+"\",\n \"\", cmVS7FlagTable::UserValue},\n"

@ -1921,7 +1921,7 @@ static int kwsysProcessGetTimeoutTime(kwsysProcess* cp, double* userTimeout,
{ {
/* The first time this is called, we need to calculate the time at /* The first time this is called, we need to calculate the time at
which the child will timeout. */ 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); kwsysProcessTime length = kwsysProcessTimeFromDouble(cp->Timeout);
cp->TimeoutTime = kwsysProcessTimeAdd(cp->StartTime, length); cp->TimeoutTime = kwsysProcessTimeAdd(cp->StartTime, length);
@ -2710,7 +2710,7 @@ static void kwsysProcessesSignalHandler(int signum
kwsysProcess_ssize_t status= kwsysProcess_ssize_t status=
read(cp->PipeReadEnds[KWSYSPE_PIPE_SIGNAL], &buf, 1); read(cp->PipeReadEnds[KWSYSPE_PIPE_SIGNAL], &buf, 1);
status=write(cp->SignalPipe, &buf, 1); status=write(cp->SignalPipe, &buf, 1);
(void)status;
} }
} }

@ -3959,7 +3959,20 @@ bool SystemTools::GetLineFromStream(kwsys_ios::istream& is,
line = ""; line = "";
long leftToRead = sizeLimit; 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 // If no characters are read from the stream, the end of file has
// been reached. Clear the fail bit just before reading. // been reached. Clear the fail bit just before reading.
while(!haveNewline && while(!haveNewline &&

@ -28,6 +28,12 @@ function(help_xcode_depends)
endif(HELP_XCODE) endif(HELP_XCODE)
endfunction(help_xcode_depends) 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) file(MAKE_DIRECTORY ${BuildDepends_BINARY_DIR}/Project)
message("Creating Project/foo.cxx") message("Creating Project/foo.cxx")
write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx
@ -49,6 +55,7 @@ try_compile(RESULT
${BuildDepends_BINARY_DIR}/Project ${BuildDepends_BINARY_DIR}/Project
${BuildDepends_SOURCE_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project
testRebuild testRebuild
CMAKE_FLAGS ${_cmake_options}
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
if(HELP_XCODE) if(HELP_XCODE)
try_compile(RESULT try_compile(RESULT
@ -63,8 +70,9 @@ if(HELP_XCODE)
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
endif(HELP_XCODE) endif(HELP_XCODE)
message("Output from first build:\n${OUTPUT}")
if(NOT RESULT) if(NOT RESULT)
message(SEND_ERROR "Could not build test project: ${OUTPUT}") message(SEND_ERROR "Could not build test project (1)!")
endif(NOT RESULT) endif(NOT RESULT)
set(bar ${BuildDepends_BINARY_DIR}/Project/bar${CMAKE_EXECUTABLE_SUFFIX}) set(bar ${BuildDepends_BINARY_DIR}/Project/bar${CMAKE_EXECUTABLE_SUFFIX})
@ -130,6 +138,7 @@ try_compile(RESULT
${BuildDepends_BINARY_DIR}/Project ${BuildDepends_BINARY_DIR}/Project
${BuildDepends_SOURCE_DIR}/Project ${BuildDepends_SOURCE_DIR}/Project
testRebuild testRebuild
CMAKE_FLAGS ${_cmake_options}
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
# Xcode is in serious need of help here # Xcode is in serious need of help here
@ -146,8 +155,9 @@ if(HELP_XCODE)
OUTPUT_VARIABLE OUTPUT) OUTPUT_VARIABLE OUTPUT)
endif(HELP_XCODE) endif(HELP_XCODE)
message("Output from second build:\n${OUTPUT}")
if(NOT RESULT) if(NOT RESULT)
message(SEND_ERROR "Could not build test project: ${OUTPUT}") message(SEND_ERROR "Could not build test project (2)!")
endif(NOT RESULT) endif(NOT RESULT)
if(EXISTS if(EXISTS
"${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" )

@ -35,6 +35,11 @@ IF(BUILD_TESTING)
"Should the tests that run a full sub ctest process be run?" "Should the tests that run a full sub ctest process be run?"
OFF) OFF)
MARK_AS_ADVANCED(CTEST_TEST_CTEST) 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) ENDIF (CMAKE_RUN_LONG_TESTS)
# Should tests that use CVS be run? # 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) ADD_TEST(${name} /bin/sh ${_TEST_DIR}/nightly-cmake.sh)
IF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY) 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) ENDIF(COMMAND SET_TESTS_PROPERTIES AND COMMAND GET_TEST_PROPERTY)
ENDMACRO(ADD_NIGHTLY_BUILD_TEST) ENDMACRO(ADD_NIGHTLY_BUILD_TEST)
IF(CMAKE_BUILD_NIGHTLY_RELEASES) 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_RUN_CPackComponents ${CTEST_TEST_CPACK})
set(CTEST_package_X11_TEST ${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 # But on Windows, only run the CPackComponents test if the NSIS
# installer builder is available: # installer builder is available:
# #
if(WIN32) if(WIN32)
find_program(NSIS_MAKENSIS_EXECUTABLE NAMES makensis
PATHS [HKEY_LOCAL_MACHINE\\SOFTWARE\\NSIS]
DOC "makensis.exe location"
)
if(NSIS_MAKENSIS_EXECUTABLE) if(NSIS_MAKENSIS_EXECUTABLE)
set(CTEST_RUN_CPackComponents ON) set(CTEST_RUN_CPackComponents ON)
else(NSIS_MAKENSIS_EXECUTABLE) else(NSIS_MAKENSIS_EXECUTABLE)
@ -431,6 +437,10 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel
if(APPLE) if(APPLE)
set(CPackComponents_EXTRA_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON) set(CPackComponents_EXTRA_OPTIONS -DCPACK_BINARY_DRAGNDROP:BOOL=ON)
endif(APPLE) 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} ADD_TEST(CPackComponents ${CMAKE_CTEST_COMMAND}
--build-and-test --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_DEB:BOOL=${CPACK_BINARY_DEB}
-DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM} -DCPACK_BINARY_RPM:BOOL=${CPACK_BINARY_RPM}
${CPackComponents_EXTRA_OPTIONS} ${CPackComponents_EXTRA_OPTIONS}
--graphviz=CPackComponents.dot
--test-command ${CMAKE_CMAKE_COMMAND} --test-command ${CMAKE_CMAKE_COMMAND}
"-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents" "-DCPackComponents_BINARY_DIR:PATH=${CMake_BINARY_DIR}/Tests/CPackComponents"
-P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake") -P "${CMake_SOURCE_DIR}/Tests/CPackComponents/VerifyResult.cmake")
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents") LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/CPackComponents")
ENDIF(CTEST_RUN_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) IF(CTEST_package_X11_TEST)
SET(X11_build_target_arg --build-target package) SET(X11_build_target_arg --build-target package)
ELSE(CTEST_package_X11_TEST) 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) --test-command UseX11)
LIST(APPEND TEST_BUILD_DIRS "${CMake_BINARY_DIR}/Tests/X11") 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} ADD_TEST(LoadedCommandOneConfig ${CMAKE_CTEST_COMMAND}
--build-and-test --build-and-test
"${CMake_SOURCE_DIR}/Tests/LoadCommandOneConfig" "${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" --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( CONFIGURE_FILE(
"${CMake_SOURCE_DIR}/Tests/CTestTestTimeout/test.cmake.in" "${CMake_SOURCE_DIR}/Tests/CTestTestTimeout/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTestTimeout/test.cmake" "${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 SET_TESTS_PROPERTIES(CTestTestTimeout PROPERTIES
PASS_REGULAR_EXPRESSION "\\*\\*\\*Timeout") 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(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) IF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS)
CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in" CONFIGURE_FILE("${CMake_SOURCE_DIR}/Tests/CTestTest/test.cmake.in"
"${CMake_BINARY_DIR}/Tests/CTestTest/test.cmake" @ONLY ESCAPE_QUOTES) "${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}) PROPERTIES TIMEOUT ${CMAKE_LONG_TEST_TIMEOUT})
ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND) ENDIF ("${PREVIOUS_TIMEOUT}" MATCHES NOTFOUND)
ENDIF (CTEST_TEST_CTEST AND CMAKE_RUN_LONG_TESTS) 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) IF("${CMAKE_TEST_GENERATOR}" MATCHES Xcode)
SET(CMAKE_SKIP_BOOTSTRAP_TEST 1) SET(CMAKE_SKIP_BOOTSTRAP_TEST 1)

@ -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}'")

@ -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 .)

@ -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}'")

@ -22,10 +22,15 @@ AddCMakeTest(ConfigureFile "")
AddCMakeTest(SeparateArguments "") AddCMakeTest(SeparateArguments "")
AddCMakeTest(ImplicitLinkInfo "") AddCMakeTest(ImplicitLinkInfo "")
AddCMakeTest(ModuleNotices "") AddCMakeTest(ModuleNotices "")
AddCMakeTest(If "")
AddCMakeTest(String "") AddCMakeTest(String "")
AddCMakeTest(Math "") AddCMakeTest(Math "")
AddCMakeTest(CMakeMinimumRequired "") AddCMakeTest(CMakeMinimumRequired "")
if(HAVE_ELF_H)
AddCMakeTest(ELF "")
endif()
SET(EndStuff_PreArgs SET(EndStuff_PreArgs
"-Ddir:STRING=${CMAKE_CURRENT_BINARY_DIR}/EndStuffTest" "-Ddir:STRING=${CMAKE_CURRENT_BINARY_DIR}/EndStuffTest"
) )

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

@ -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()

@ -23,3 +23,22 @@ check_cmake_test(File
Copy-NoDest Copy-NoDest
Copy-NoFile 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()

@ -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()

@ -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("")

@ -16,8 +16,16 @@ target_link_libraries(mylibapp mylib)
# On Linux, enable using an absolute install path to verify that # On Linux, enable using an absolute install path to verify that
# CMAKE_INSTALL_PREFIX and CPACK_SET_DESTDIR interact properly. # 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) 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() endif()
if(mylib_install_to_absolute_path) if(mylib_install_to_absolute_path)

@ -0,0 +1,5 @@
cmake_minimum_required(VERSION 2.8)
project(CPackTestAllGenerators)
add_subdirectory(../CTestTest/SmallAndFast SmallAndFast)
install(FILES RunCPack.cmake DESTINATION .)
include(CPack)

@ -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()

@ -4,7 +4,22 @@ project(SmallAndFast)
include(CTest) include(CTest)
add_executable(echoargs echoargs.c) 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) add_test(test0 echoargs)
set_property(TEST test0 APPEND PROPERTY LABELS TestLabel 0ArgTest Everything)
add_test(test1 echoargs 1) add_test(test1 echoargs 1)
set_property(TEST test1 APPEND PROPERTY LABELS TestLabel 1ArgTest Everything)
add_test(test2 echoargs 1 2) 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()

@ -0,0 +1 @@
garbage - obviously this should not compile as is

@ -0,0 +1,11 @@
#include <stdio.h>
int main(int argc, const char* argv[])
{
unsigned int i = 0; // "i<argc" should produce a "signed/unsigned comparison" warning
for (; i<argc; ++i)
{
fprintf(stdout, "%s\n", argv[i]);
}
return 0;
}

@ -0,0 +1,47 @@
CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
# CTestConfig.cmake settings:
set(CTEST_PROJECT_NAME "SmallAndFast")
# Intentionally leave out other upload-related CTestConfig.cmake settings
# so that the ctest_submit call below fails with an error message...
#
set(CTEST_DROP_METHOD "@drop_method@")
# Settings:
SET(CTEST_USE_LAUNCHERS 1)
# Emit these compiler warnings:
set(ENV{CXXFLAGS} "$ENV{CXXFLAGS} -Wall")
SET(CTEST_SITE "@SITE@")
SET(CTEST_BUILD_NAME "CTestTestLaunchers-@drop_method@")
SET(CTEST_SOURCE_DIRECTORY "@source@")
SET(CTEST_BINARY_DIRECTORY "@build@")
SET(CTEST_CVS_COMMAND "@CVSCOMMAND@")
SET(CTEST_CMAKE_GENERATOR "@CMAKE_GENERATOR@")
SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}")
SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@")
SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@")
SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@")
SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@")
SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}")
CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY})
CTEST_START(Experimental)
# explicitly do not use CTEST_UPDATE - avoid network activity
CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}"
OPTIONS "-DCTEST_USE_LAUNCHERS:BOOL=${CTEST_USE_LAUNCHERS};-DSAF_INTENTIONAL_COMPILE_ERROR:BOOL=ON;-DSAF_INTENTIONAL_COMPILE_WARNING:BOOL=ON"
RETURN_VALUE res)
CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
CTEST_MEMCHECK(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res)
CTEST_COVERAGE(BUILD "${CTEST_BINARY_DIRECTORY}" @ctest_coverage_labels_args@ RETURN_VALUE res)
# ok to call ctest_submit - still avoids network activity because there is
# not a valid drop location given above...
CTEST_SUBMIT(RETURN_VALUE res)

@ -0,0 +1,2 @@
SET(CTEST_RUN_CURRENT_SCRIPT 0)
MESSAGE("hello world")

@ -0,0 +1,2 @@
SET(CTEST_RUN_CURRENT_SCRIPT 0)
CTEST_RUN_SCRIPT("CTestTestRunScript/hello.cmake" RETURN_VALUE res RETURN_VALUE)

@ -0,0 +1,11 @@
cmake_minimum_required (VERSION 2.6)
PROJECT(CTestTestSubdir)
SET(DART_ROOT "" CACHE STRING "" FORCE)
ENABLE_TESTING()
INCLUDE (${CMAKE_ROOT}/Modules/Dart.cmake)
GET_FILENAME_COMPONENT(CTEST_COMMAND "${CMAKE_COMMAND}" PATH)
SET(CTEST_COMMAND "${CTEST_COMMAND}/ctest")
ADD_SUBDIRECTORY(subdir)

@ -0,0 +1,7 @@
set(CTEST_PROJECT_NAME "CTestTestSubdir")
set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT")
set(CTEST_DART_SERVER_VERSION "2")
set(CTEST_DROP_METHOD "http")
set(CTEST_DROP_SITE "www.cdash.org")
set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard")
set(CTEST_DROP_SITE_CDASH TRUE)

@ -0,0 +1,2 @@
ADD_EXECUTABLE (main main.c)
ADD_TEST (TestMain main)

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

Loading…
Cancel
Save