diff --git a/CMakeLists.txt b/CMakeLists.txt index 0d77ed458..f4faca0b1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -329,7 +329,7 @@ ENDMACRO (CMAKE_BUILD_UTILITIES) SET(CMake_VERSION_MAJOR 2) SET(CMake_VERSION_MINOR 8) SET(CMake_VERSION_PATCH 1) -SET(CMake_VERSION_RC 1) +SET(CMake_VERSION_RC 2) # We use odd minor numbers for development versions. # Use a date for the development patch level. diff --git a/CTestConfig.cmake b/CTestConfig.cmake index 145792b72..0add34b92 100644 --- a/CTestConfig.cmake +++ b/CTestConfig.cmake @@ -16,7 +16,8 @@ set(CTEST_DROP_METHOD "http") set(CTEST_DROP_SITE "www.cdash.org") set(CTEST_DROP_LOCATION "/CDash/submit.php?project=CMake") set(CTEST_DROP_SITE_CDASH TRUE) -set(CTEST_CDASH_VERSION "1.4") +set(CTEST_CDASH_VERSION "1.6") +set(CTEST_CDASH_QUERY_VERSION TRUE) # use old trigger stuff so that cmake 2.4 and below will not # get errors on trigger diff --git a/ChangeLog.manual b/ChangeLog.manual index cb2bc0612..60b4b4312 100644 --- a/ChangeLog.manual +++ b/ChangeLog.manual @@ -1,3 +1,13 @@ +Changes in CMake 2.8.1 RC 2 +- CPack: Avoid deleting long PATH values with NSIS (#10257) +- CTest: Fix and test cost-based test scheduler +- CTest: Fix and test git updates for case of out-dated index +- CTest: Fix regression caused by fix for (#2336) in rc1 +- CTest: Setup command-line dashboard support with Git +- FindCUDA: Improve docs, use -rpath on Apple, fix dependency scanning +- Fix OS X deployment-target and sysroot defaults (#9959,#9898,#10155) +- Recognize the Compaq Fortran compiler + Changes in CMake 2.8.1 RC 1 - Add "NMake Makefiles JOM" generator - Add PathScale compiler support diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 9e355a08f..051df4cc7 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -38,6 +38,7 @@ IF(CMAKE_C_COMPILER_ABI) ENDIF(CMAKE_C_COMPILER_ABI) SET(CMAKE_C_HAS_ISYSROOT "@CMAKE_C_HAS_ISYSROOT@") +@CMAKE_C_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ SET(CMAKE_C_IMPLICIT_LINK_LIBRARIES "@CMAKE_C_IMPLICIT_LINK_LIBRARIES@") SET(CMAKE_C_IMPLICIT_LINK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_DIRECTORIES@") diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index 5e71d1fe6..b264da1c9 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -39,6 +39,7 @@ IF(CMAKE_CXX_COMPILER_ABI) ENDIF(CMAKE_CXX_COMPILER_ABI) SET(CMAKE_CXX_HAS_ISYSROOT "@CMAKE_CXX_HAS_ISYSROOT@") +@CMAKE_CXX_OSX_DEPLOYMENT_TARGET_FLAG_CODE@ SET(CMAKE_CXX_IMPLICIT_LINK_LIBRARIES "@CMAKE_CXX_IMPLICIT_LINK_LIBRARIES@") SET(CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_DIRECTORIES@") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index a70c6ab92..bddd6a1e8 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -42,6 +42,11 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) ENDIF(NOT CMAKE_${lang}_COMPILER_ID) ENDFOREACH(flags) + # If the compiler is still unknown, try to query its vendor. + IF(NOT CMAKE_${lang}_COMPILER_ID) + CMAKE_DETERMINE_COMPILER_ID_VENDOR(${lang}) + ENDIF() + # if the format is unknown after all files have been checked, put "Unknown" in the cache IF(NOT CMAKE_EXECUTABLE_FORMAT) SET(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") @@ -245,3 +250,38 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) PARENT_SCOPE) SET(CMAKE_EXECUTABLE_FORMAT "${CMAKE_EXECUTABLE_FORMAT}" PARENT_SCOPE) ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_CHECK lang) + +#----------------------------------------------------------------------------- +# Function to query the compiler vendor. +# This uses a table with entries of the form +# list(APPEND CMAKE_${lang}_COMPILER_ID_VENDORS ${vendor}) +# set(CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor} -some-vendor-flag) +# set(CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor} "Some Vendor Output") +# We try running the compiler with the flag for each vendor and +# matching its regular expression in the output. +FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) + FOREACH(vendor ${CMAKE_${lang}_COMPILER_ID_VENDORS}) + SET(flags ${CMAKE_${lang}_COMPILER_ID_VENDOR_FLAGS_${vendor}}) + SET(regex ${CMAKE_${lang}_COMPILER_ID_VENDOR_REGEX_${vendor}}) + EXECUTE_PROCESS( + COMMAND ${CMAKE_${lang}_COMPILER} + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${flags} + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE output ERROR_VARIABLE output + RESULT_VARIABLE result + ) + IF("${output}" MATCHES "${regex}") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "matched \"${regex}\":\n${output}") + SET(CMAKE_${lang}_COMPILER_ID "${vendor}" PARENT_SCOPE) + BREAK() + ELSE() + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "did not match \"${regex}\":\n${output}") + ENDIF() + ENDFOREACH() +ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR) diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 44e45d8f5..0637d20d5 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -162,6 +162,11 @@ IF(NOT CMAKE_Fortran_COMPILER_ID_RUN) "-fpp" ) + # Table of per-vendor compiler id flags with expected output. + LIST(APPEND CMAKE_Fortran_COMPILER_ID_VENDORS Compaq) + SET(CMAKE_Fortran_COMPILER_ID_VENDOR_FLAGS_Compaq "-what") + SET(CMAKE_Fortran_COMPILER_ID_VENDOR_REGEX_Compaq "Compaq Visual Fortran") + # Try to identify the compiler. SET(CMAKE_Fortran_COMPILER_ID) INCLUDE(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) diff --git a/Modules/CTest.cmake b/Modules/CTest.cmake index 28835cea7..2d0702e96 100644 --- a/Modules/CTest.cmake +++ b/Modules/CTest.cmake @@ -126,52 +126,39 @@ IF(BUILD_TESTING) FIND_PROGRAM(SVNCOMMAND svn) FIND_PROGRAM(BZRCOMMAND bzr) FIND_PROGRAM(HGCOMMAND hg) + FIND_PROGRAM(GITCOMMAND git) IF(NOT UPDATE_TYPE) IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") SET(UPDATE_TYPE cvs) - ELSE(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") - IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") - SET(UPDATE_TYPE svn) - ELSE(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") - IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") - SET(UPDATE_TYPE bzr) - ELSE(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") - IF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") - SET(UPDATE_TYPE hg) - ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") - ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") - ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") - ENDIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/CVS") - ENDIF(NOT UPDATE_TYPE) - - IF(NOT UPDATE_TYPE) - IF(NOT __CTEST_UPDATE_TYPE_COMPLAINED) - SET(__CTEST_UPDATE_TYPE_COMPLAINED 1 CACHE INTERNAL "Already complained about update type.") - MESSAGE(STATUS "CTest cannot determine repository type. Please set UPDATE_TYPE to 'cvs' or 'svn'. CTest update will not work.") - ENDIF(NOT __CTEST_UPDATE_TYPE_COMPLAINED) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.svn") + SET(UPDATE_TYPE svn) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.bzr") + SET(UPDATE_TYPE bzr) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.hg") + SET(UPDATE_TYPE hg) + ELSEIF(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git") + SET(UPDATE_TYPE git) + ENDIF() ENDIF(NOT UPDATE_TYPE) STRING(TOLOWER "${UPDATE_TYPE}" _update_type) IF("${_update_type}" STREQUAL "cvs") SET(UPDATE_COMMAND "${CVSCOMMAND}") SET(UPDATE_OPTIONS "${CVS_UPDATE_OPTIONS}") - ELSE("${_update_type}" STREQUAL "cvs") - IF("${_update_type}" STREQUAL "svn") - SET(UPDATE_COMMAND "${SVNCOMMAND}") - SET(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") - ELSE("${_update_type}" STREQUAL "svn") - IF("${_update_type}" STREQUAL "bzr") - SET(UPDATE_COMMAND "${BZRCOMMAND}") - SET(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") - ELSE("${_update_type}" STREQUAL "bzr") - IF("${_update_type}" STREQUAL "hg") - SET(UPDATE_COMMAND "${HGCOMMAND}") - SET(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") - ENDIF("${_update_type}" STREQUAL "hg") - ENDIF("${_update_type}" STREQUAL "bzr") - ENDIF("${_update_type}" STREQUAL "svn") - ENDIF("${_update_type}" STREQUAL "cvs") + ELSEIF("${_update_type}" STREQUAL "svn") + SET(UPDATE_COMMAND "${SVNCOMMAND}") + SET(UPDATE_OPTIONS "${SVN_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "bzr") + SET(UPDATE_COMMAND "${BZRCOMMAND}") + SET(UPDATE_OPTIONS "${BZR_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "hg") + SET(UPDATE_COMMAND "${HGCOMMAND}") + SET(UPDATE_OPTIONS "${HG_UPDATE_OPTIONS}") + ELSEIF("${_update_type}" STREQUAL "git") + SET(UPDATE_COMMAND "${GITCOMMAND}") + SET(UPDATE_OPTIONS "${GIT_UPDATE_OPTIONS}") + ENDIF() SET(DART_TESTING_TIMEOUT 1500 CACHE STRING "Maximum time allowed before CTest will kill the test.") @@ -264,6 +251,7 @@ IF(BUILD_TESTING) SVNCOMMAND BZRCOMMAND HGCOMMAND + GITCOMMAND CVS_UPDATE_OPTIONS SVN_UPDATE_OPTIONS BZR_UPDATE_OPTIONS diff --git a/Modules/DartConfiguration.tcl.in b/Modules/DartConfiguration.tcl.in index 98d7cd26f..be2b691ee 100644 --- a/Modules/DartConfiguration.tcl.in +++ b/Modules/DartConfiguration.tcl.in @@ -16,6 +16,7 @@ BuildName: @BUILDNAME@ # Submission information IsCDash: @CTEST_DROP_SITE_CDASH@ CDashVersion: @CTEST_CDASH_VERSION@ +QueryCDashVersion: @CTEST_CDASH_QUERY_VERSION@ DropSite: @DROP_SITE@ DropLocation: @DROP_LOCATION@ DropSiteUser: @DROP_SITE_USER@ diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 9601bc790..6539057ba 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -106,9 +106,12 @@ # specified. All of the non CUDA C files are compiled using the standard # build rules specified by CMAKE and the cuda files are compiled to object # files using nvcc and the host compiler. In addition CUDA_INCLUDE_DIRS is -# added automatically to include_directories(). Standard CMake target calls -# can be used on the target after calling this macro -# (e.g. set_target_properties and target_link_libraries). +# added automatically to include_directories(). Some standard CMake target +# calls can be used on the target after calling this macro +# (e.g. set_target_properties and target_link_libraries), but setting +# properties that adjust compilation flags will not affect code compiled by +# nvcc. Such flags should be modified before calling CUDA_ADD_EXECUTABLE, +# CUDA_ADD_LIBRARY or CUDA_WRAP_SRCS. # # CUDA_ADD_LIBRARY( cuda_target file0 file1 ... # [STATIC | SHARED | MODULE] [EXCLUDE_FROM_ALL] [OPTIONS ...] ) @@ -543,6 +546,14 @@ endmacro() # CUDA_LIBRARIES find_library_local_first(CUDA_CUDART_LIBRARY cudart "\"cudart\" library") set(CUDA_LIBRARIES ${CUDA_CUDART_LIBRARY}) +if(APPLE) + # We need to add the path to cudart to the linker using rpath, since the + # library name for the cuda libraries is prepended with @rpath. + get_filename_component(_cuda_path_to_cudart "${CUDA_CUDART_LIBRARY}" PATH) + if(_cuda_path_to_cudart) + list(APPEND CUDA_LIBRARIES -Wl,-rpath "-Wl,${_cuda_path_to_cudart}") + endif() +endif() # 1.1 toolkit on linux doesn't appear to have a separate library on # some platforms. diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index 31bd74efc..7349da322 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -164,11 +164,18 @@ if(CUDA_VERSION VERSION_LESS "3.0") cmake_policy(POP) endif() +# nvcc doesn't define __CUDACC__ for some reason when generating dependency files. This +# can cause incorrect dependencies when #including files based on this macro which is +# defined in the generating passes of nvcc invokation. We will go ahead and manually +# define this for now until a future version fixes this bug. +set(CUDACC_DEFINE -D__CUDACC__) + # Generate the dependency file cuda_execute_process( "Generating dependency file: ${NVCC_generated_dependency_file}" COMMAND "${CUDA_NVCC_EXECUTABLE}" -M + ${CUDACC_DEFINE} "${source_file}" -o "${NVCC_generated_dependency_file}" ${CCBIN} diff --git a/Modules/NSIS.template.in b/Modules/NSIS.template.in index 26a936e73..776bc0718 100644 --- a/Modules/NSIS.template.in +++ b/Modules/NSIS.template.in @@ -213,6 +213,15 @@ Function AddToPath IfFileExists "$0\*.*" "" AddToPath_done ReadEnvStr $1 PATH + ; if the path is too long for a NSIS variable NSIS will return a 0 + ; length string. If we find that, then warn and skip any path + ; modification as it will trash the existing path. + StrLen $2 $1 + IntCmp $2 0 CheckPathLength_ShowPathWarning CheckPathLength_Done CheckPathLength_Done + CheckPathLength_ShowPathWarning: + Messagebox MB_OK|MB_ICONEXCLAMATION "Warning! PATH too long installer unable to modify PATH!" + Goto AddToPath_done + CheckPathLength_Done: Push "$1;" Push "$0;" Call StrStr diff --git a/Modules/Platform/Darwin-GNU-C.cmake b/Modules/Platform/Darwin-GNU-C.cmake index 155d5948a..4e326c4ca 100644 --- a/Modules/Platform/Darwin-GNU-C.cmake +++ b/Modules/Platform/Darwin-GNU-C.cmake @@ -1,3 +1,4 @@ include(Platform/Darwin-GNU) __darwin_compiler_gnu(C) cmake_gnu_has_isysroot(C) +cmake_gnu_set_osx_deployment_target_flag(C) diff --git a/Modules/Platform/Darwin-GNU-CXX.cmake b/Modules/Platform/Darwin-GNU-CXX.cmake index 6cc081230..b39487e58 100644 --- a/Modules/Platform/Darwin-GNU-CXX.cmake +++ b/Modules/Platform/Darwin-GNU-CXX.cmake @@ -1,3 +1,4 @@ include(Platform/Darwin-GNU) __darwin_compiler_gnu(CXX) cmake_gnu_has_isysroot(CXX) +cmake_gnu_set_osx_deployment_target_flag(CXX) diff --git a/Modules/Platform/Darwin-GNU.cmake b/Modules/Platform/Darwin-GNU.cmake index b528c88c7..4c2194a4d 100644 --- a/Modules/Platform/Darwin-GNU.cmake +++ b/Modules/Platform/Darwin-GNU.cmake @@ -42,3 +42,23 @@ macro(cmake_gnu_has_isysroot lang) endif() endif() endmacro() + +macro(cmake_gnu_set_osx_deployment_target_flag lang) + if(NOT DEFINED CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG) + set(_doc "${lang} compiler supports OSX deployment target flag") + message(STATUS "Checking whether ${_doc}") + execute_process( + COMMAND ${CMAKE_${lang}_COMPILER} "-v" "--help" + OUTPUT_VARIABLE _gcc_help + ERROR_VARIABLE _gcc_help + ) + if("${_gcc_help}" MATCHES "macosx-version-min") + message(STATUS "Checking whether ${_doc} - yes") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "-mmacosx-version-min=") + else() + message(STATUS "Checking whether ${_doc} - no") + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG "") + endif() + set(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG_CODE "SET(CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG \"${CMAKE_${lang}_OSX_DEPLOYMENT_TARGET_FLAG}\")") + endif() +endmacro() diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index 1d88bf1d5..c8bcad1d0 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -1,10 +1,11 @@ SET(APPLE 1) # Darwin versions: -# 6.x == Mac OSX 10.2 -# 7.x == Mac OSX 10.3 -# 8.x == Mac OSX 10.4 -# 9.x == Mac OSX 10.5 +# 6.x == Mac OSX 10.2 (Jaguar) +# 7.x == Mac OSX 10.3 (Panther) +# 8.x == Mac OSX 10.4 (Tiger) +# 9.x == Mac OSX 10.5 (Leopard) +# 10.x == Mac OSX 10.6 (Snow Leopard) STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_SYSTEM_VERSION}") STRING(REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\2" DARWIN_MINOR_VERSION "${CMAKE_SYSTEM_VERSION}") @@ -72,68 +73,73 @@ IF(NOT _CMAKE_OSX_SDKS) ENDIF(CMAKE_XCODE_SELECT) ENDIF(NOT _CMAKE_OSX_SDKS) -# Set CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT to the current version of OS X -EXECUTE_PROCESS(COMMAND sw_vers -productVersion OUTPUT_VARIABLE CURRENT_OSX_VERSION) -STRING(REGEX REPLACE "^.*(10)\\.([0-9]+)\\.*([0-9]+)*.*$" "\\1.\\2" - CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT ${CURRENT_OSX_VERSION}) +EXECUTE_PROCESS(COMMAND sw_vers -productVersion + OUTPUT_VARIABLE CURRENT_OSX_VERSION + OUTPUT_STRIP_TRAILING_WHITESPACE) -# Set CMAKE_OSX_SYSROOT_DEFAULT based on CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT. -# This next block assumes that Apple will start being consistent with -# its SDK names from here on out... -IF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT GREATER "10.4") - SET(CMAKE_OSX_SYSROOT_DEFAULT - "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX${CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT}.sdk") -ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT GREATER "10.4") +#---------------------------------------------------------------------------- +# _CURRENT_OSX_VERSION - as a two-component string: 10.5, 10.6, ... +# +STRING(REGEX REPLACE "^([0-9]+\\.[0-9]+).*$" "\\1" + _CURRENT_OSX_VERSION "${CURRENT_OSX_VERSION}") -IF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT EQUAL "10.4") - SET(CMAKE_OSX_SYSROOT_DEFAULT - "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.4u.sdk") -ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT EQUAL "10.4") +#---------------------------------------------------------------------------- +# CMAKE_OSX_DEPLOYMENT_TARGET -IF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT EQUAL "10.3") - SET(CMAKE_OSX_SYSROOT_DEFAULT - "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.3.9.sdk") -ENDIF(CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT EQUAL "10.3") +# Set cache variable - end user may change this during ccmake or cmake-gui configure. +IF(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) + SET(CMAKE_OSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}" CACHE STRING + "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.") +ENDIF(_CURRENT_OSX_VERSION VERSION_GREATER 10.3) -# Allow environment variables set by the user to override our defaults. -# Use the same environment variables that Xcode uses. -SET(ENV_MACOSX_DEPLOYMENT_TARGET "$ENV{MACOSX_DEPLOYMENT_TARGET}") +#---------------------------------------------------------------------------- +# CMAKE_OSX_SYSROOT + +# Environment variable set by the user overrides our default. +# Use the same environment variable that Xcode uses. SET(ENV_SDKROOT "$ENV{SDKROOT}") -# See if we need to override the default SDK or Deployment target with the -# environment variables -IF(NOT ENV_MACOSX_DEPLOYMENT_TARGET STREQUAL "") - SET(CMAKE_OSX_DEPLOYMENT_TARGET_VALUE ${ENV_MACOSX_DEPLOYMENT_TARGET}) -ELSE(NOT ENV_MACOSX_DEPLOYMENT_TARGET STREQUAL "") - SET(CMAKE_OSX_DEPLOYMENT_TARGET_VALUE ${CMAKE_OSX_DEPLOYMENT_TARGET_DEFAULT}) -ENDIF(NOT ENV_MACOSX_DEPLOYMENT_TARGET STREQUAL "") +# Set CMAKE_OSX_SYSROOT_DEFAULT based on _CURRENT_OSX_VERSION, +# accounting for the known specially named SDKs. +SET(CMAKE_OSX_SYSROOT_DEFAULT + "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX${_CURRENT_OSX_VERSION}.sdk") +IF(_CURRENT_OSX_VERSION STREQUAL "10.4") + SET(CMAKE_OSX_SYSROOT_DEFAULT + "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.4u.sdk") +ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.4") + +IF(_CURRENT_OSX_VERSION STREQUAL "10.3") + SET(CMAKE_OSX_SYSROOT_DEFAULT + "${OSX_DEVELOPER_ROOT}/SDKs/MacOSX10.3.9.sdk") +ENDIF(_CURRENT_OSX_VERSION STREQUAL "10.3") + +# Use environment or default as initial cache value: IF(NOT ENV_SDKROOT STREQUAL "") SET(CMAKE_OSX_SYSROOT_VALUE ${ENV_SDKROOT}) ELSE(NOT ENV_SDKROOT STREQUAL "") SET(CMAKE_OSX_SYSROOT_VALUE ${CMAKE_OSX_SYSROOT_DEFAULT}) ENDIF(NOT ENV_SDKROOT STREQUAL "") -# Set cache variables - end user may change these during ccmake or cmake-gui configure. -IF(CURRENT_OSX_VERSION GREATER 10.3) - SET(CMAKE_OSX_DEPLOYMENT_TARGET ${CMAKE_OSX_DEPLOYMENT_TARGET_VALUE} CACHE STRING - "Minimum OS X version to target for deployment (at runtime); newer APIs weak linked. Set to empty string for default value.") -ENDIF(CURRENT_OSX_VERSION GREATER 10.3) - +# Set cache variable - end user may change this during ccmake or cmake-gui configure. SET(CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT_VALUE} CACHE PATH "The product will be built against the headers and libraries located inside the indicated SDK.") #---------------------------------------------------------------------------- function(SanityCheckSDKAndDeployTarget _sdk_path _deploy) - if (_deploy STREQUAL "") + if(_deploy STREQUAL "") return() endif() - string (REGEX REPLACE "(.*MacOSX*)(....)(.*\\.sdk)" "\\2" SDK ${_sdk_path}) - if (_deploy GREATER SDK) - message (FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET (${_deploy}) is greater than CMAKE_OSX_SYSROOT SDK (${_sdk_path}). Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${SDK}") - endif (_deploy GREATER SDK) -endfunction(SanityCheckSDKAndDeployTarget _sdk_path _deploy) + if(_sdk_path STREQUAL "") + message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET='${_deploy}' but CMAKE_OSX_SYSROOT is empty... - either set CMAKE_OSX_SYSROOT to a valid SDK or set CMAKE_OSX_DEPLOYMENT_TARGET to empty") + endif() + + string(REGEX REPLACE "(.*MacOSX*)(....)(.*\\.sdk)" "\\2" SDK "${_sdk_path}") + if(_deploy GREATER "${SDK}") + message(FATAL_ERROR "CMAKE_OSX_DEPLOYMENT_TARGET (${_deploy}) is greater than CMAKE_OSX_SYSROOT SDK (${_sdk_path}). Please set CMAKE_OSX_DEPLOYMENT_TARGET to ${SDK} or lower") + endif() +endfunction(SanityCheckSDKAndDeployTarget) #---------------------------------------------------------------------------- # Make sure the combination of SDK and Deployment Target are allowed diff --git a/Source/CTest/cmCTestBZR.cxx b/Source/CTest/cmCTestBZR.cxx index d8ec9cdd5..55b8d5b75 100644 --- a/Source/CTest/cmCTestBZR.cxx +++ b/Source/CTest/cmCTestBZR.cxx @@ -276,12 +276,14 @@ private: && !this->CData.empty()) { this->CurChange.Path.assign(&this->CData[0], this->CData.size()); + cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } else if(strcmp(name, "symlink") == 0 && !this->CData.empty()) { // symlinks have an arobase at the end in the log this->CurChange.Path.assign(&this->CData[0], this->CData.size()-1); + cmSystemTools::ConvertToUnixSlashes(this->CurChange.Path); this->Changes.push_back(this->CurChange); } else if(strcmp(name, "committer") == 0 && !this->CData.empty()) @@ -377,9 +379,10 @@ private: return true; } - void DoPath(char c0, char c1, char c2, std::string const& path) + void DoPath(char c0, char c1, char c2, std::string path) { if(path.empty()) return; + cmSystemTools::ConvertToUnixSlashes(path); const std::string dir = cmSystemTools::GetFilenamePath(path); const std::string name = cmSystemTools::GetFilenameName(path); @@ -488,9 +491,10 @@ private: return true; } - void DoPath(char c0, char c1, char c2, std::string const& path) + void DoPath(char c0, char c1, char c2, std::string path) { if(path.empty()) return; + cmSystemTools::ConvertToUnixSlashes(path); if ( c0=='C' ) { diff --git a/Source/CTest/cmCTestConfigureCommand.cxx b/Source/CTest/cmCTestConfigureCommand.cxx index 147173f39..9a668bce1 100644 --- a/Source/CTest/cmCTestConfigureCommand.cxx +++ b/Source/CTest/cmCTestConfigureCommand.cxx @@ -132,7 +132,8 @@ cmCTestGenericHandler* cmCTestConfigureCommand::InitializeHandler() } } - if (!multiConfig && !cmakeBuildTypeInOptions) + if (!multiConfig && !cmakeBuildTypeInOptions && + !this->CTest->GetConfigType().empty()) { cmakeConfigureCommand += " \"-DCMAKE_BUILD_TYPE:STRING="; cmakeConfigureCommand += this->CTest->GetConfigType(); diff --git a/Source/CTest/cmCTestGIT.cxx b/Source/CTest/cmCTestGIT.cxx index 8108b19c8..6d5bf659c 100644 --- a/Source/CTest/cmCTestGIT.cxx +++ b/Source/CTest/cmCTestGIT.cxx @@ -409,10 +409,16 @@ void cmCTestGIT::LoadRevisions() //---------------------------------------------------------------------------- void cmCTestGIT::LoadModifications() { - // Use 'git diff-index' to get modified files. const char* git = this->CommandLineTool.c_str(); - const char* git_diff_index[] = {git, "diff-index", "-z", "HEAD", 0}; + // Use 'git update-index' to refresh the index w.r.t. the work tree. + const char* git_update_index[] = {git, "update-index", "--refresh", 0}; + OutputLogger ui_out(this->Log, "ui-out> "); + OutputLogger ui_err(this->Log, "ui-err> "); + this->RunChild(git_update_index, &ui_out, &ui_err); + + // Use 'git diff-index' to get modified files. + const char* git_diff_index[] = {git, "diff-index", "-z", "HEAD", 0}; DiffParser out(this, "di-out> "); OutputLogger err(this->Log, "di-err> "); this->RunChild(git_diff_index, &out, &err); diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index a79f131a7..b6226a3b7 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -325,7 +325,7 @@ void cmCTestMultiProcessHandler::WriteCostData(int index, float cost) std::string fname = this->CTest->GetBinaryDir() + "/Testing/Temporary/CTestCostData.txt"; std::fstream fout; - fout.open(fname.c_str(), std::ios::app); + fout.open(fname.c_str(), std::ios::out | std::ios::app); fout << index << " " << cost << "\n"; fout.close(); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 1b578a904..7b25f8e12 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -398,7 +398,7 @@ std::string cmCTest::GetCDashVersion() std::string url = "http://"; url += this->GetCTestConfiguration("DropSite") + "/CDash/api/getversion.php"; - int res = cmCTest::HTTPRequest(url, cmCTest::HTTP_GET, response); + int res = cmCTest::HTTPRequest(url, cmCTest::HTTP_GET, response, "", "", 3); return res ? this->GetCTestConfiguration("CDashVersion") : response; #else @@ -471,6 +471,10 @@ int cmCTest::Initialize(const char* binary_dir, cmCTestStartCommand* command) return 0; } + // call this so that the information is cached up front + // and not the first time EndTest is called. + this->ShouldCompressTestOutput(); + if ( this->ProduceXML ) { // Verify "Testing" directory exists: diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 3339ee4ce..851e34f57 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -1784,6 +1784,10 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, this->Makefile->GetDefinition("CMAKE_OSX_DEPLOYMENT_TARGET"); std::string isysrootVar = std::string("CMAKE_") + lang + "_HAS_ISYSROOT"; bool hasIsysroot = this->Makefile->IsOn(isysrootVar.c_str()); + std::string deploymentTargetFlagVar = + std::string("CMAKE_") + lang + "_OSX_DEPLOYMENT_TARGET_FLAG"; + const char* deploymentTargetFlag = + this->Makefile->GetDefinition(deploymentTargetFlagVar.c_str()); bool flagsUsed = false; if(!archs.empty() && sysroot && lang && (lang[0] =='C' || lang[0] == 'F')) { @@ -1815,10 +1819,11 @@ void cmLocalGenerator::AddArchitectureFlags(std::string& flags, flags += sysroot; } - if (deploymentTarget && *deploymentTarget && - lang && (lang[0] =='C' || lang[0] == 'F')) + if (deploymentTargetFlag && *deploymentTargetFlag && + deploymentTarget && *deploymentTarget) { - flags += " -mmacosx-version-min="; + flags += " "; + flags += deploymentTargetFlag; flags += deploymentTarget; } } diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 7defb285f..8a83d726a 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1285,6 +1285,17 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=CVS -P ${CMake_SOURCE_DIR}/Utilities/Rel --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) + CONFIGURE_FILE( + "${CMake_SOURCE_DIR}/Tests/CTestTestScheduler/test.cmake.in" + "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/test.cmake" + @ONLY ESCAPE_QUOTES) + ADD_TEST(CTestTestScheduler ${CMAKE_CTEST_COMMAND} + -S "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/test.cmake" -V + --output-log "${CMake_BINARY_DIR}/Tests/CTestTestScheduler/testOutput.log" + ) + SET_TESTS_PROPERTIES(CTestTestScheduler PROPERTIES + PASS_REGULAR_EXPRESSION "Start 1.*Start 2.*Start 3.*Start 4.*Start 5.*Start 5.*Start 4.*Start 3.*Start 2.*Start 1") + CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Tests/CTestTestSubdir/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestSubdir/test.cmake" diff --git a/Tests/CMakeTests/CMakeLists.txt b/Tests/CMakeTests/CMakeLists.txt index 161ca4499..7a176e9c6 100644 --- a/Tests/CMakeTests/CMakeLists.txt +++ b/Tests/CMakeTests/CMakeLists.txt @@ -26,6 +26,7 @@ AddCMakeTest(If "") AddCMakeTest(String "") AddCMakeTest(Math "") AddCMakeTest(CMakeMinimumRequired "") +AddCMakeTest(CompilerIdVendor "") if(HAVE_ELF_H) AddCMakeTest(ELF "") @@ -46,11 +47,12 @@ AddCMakeTest(GetPrerequisites "${GetPrerequisites_PreArgs}") # by any previous configure, build or test steps. # if(do_cvs_tests) + string(REPLACE "\\" "/" ENV_HOME "$ENV{HOME}") set(CheckSourceTree_PreArgs "-DCMake_BINARY_DIR:PATH=${CMake_BINARY_DIR}" "-DCMake_SOURCE_DIR:PATH=${CMake_SOURCE_DIR}" "-DCVS_EXECUTABLE:STRING=${CVS_EXECUTABLE}" - "-DHOME:STRING=$ENV{HOME}" + "-DHOME:STRING=${ENV_HOME}" ) AddCMakeTest(CheckSourceTree "${CheckSourceTree_PreArgs}") endif(do_cvs_tests) diff --git a/Tests/CMakeTests/CompilerIdVendorTest.cmake.in b/Tests/CMakeTests/CompilerIdVendorTest.cmake.in new file mode 100644 index 000000000..68f646212 --- /dev/null +++ b/Tests/CMakeTests/CompilerIdVendorTest.cmake.in @@ -0,0 +1,31 @@ +# This is not supposed to be included by user code, but we need to +# test it. +include(${CMAKE_ROOT}/Modules/CMakeDetermineCompilerId.cmake) + +set(MY_BINARY_DIR "@CMAKE_CURRENT_BINARY_DIR@/CompilerIdVendor") +file(REMOVE_RECURSE ${MY_BINARY_DIR}) +file(MAKE_DIRECTORY ${MY_BINARY_DIR}) + +set(CMAKE_MyLang_COMPILER ${CMAKE_COMMAND}) +set(CMAKE_MyLang_COMPILER_ID_ARG1) +set(CMAKE_MyLang_COMPILER_ID_FLAGS_LIST) +set(CMAKE_MyLang_COMPILER_ID_DIR ${MY_BINARY_DIR}) + +file(WRITE "${MY_BINARY_DIR}/BogusVendor.cmake" "message(\"This is a BogusVendor compiler\")") +list(APPEND CMAKE_MyLang_COMPILER_ID_VENDORS BogusVendor) +set(CMAKE_MyLang_COMPILER_ID_VENDOR_FLAGS_BogusVendor -P BogusVendor.cmake) +set(CMAKE_MyLang_COMPILER_ID_VENDOR_REGEX_BogusVendor ThisDoesNotMatch_BogusVendor) + +file(WRITE "${MY_BINARY_DIR}/MyVendor.cmake" "message(\"This is a MyVendor compiler\")") +list(APPEND CMAKE_MyLang_COMPILER_ID_VENDORS MyVendor) +set(CMAKE_MyLang_COMPILER_ID_VENDOR_FLAGS_MyVendor -P MyVendor.cmake) +set(CMAKE_MyLang_COMPILER_ID_VENDOR_REGEX_MyVendor MyVendor) + +set(CMAKE_BINARY_DIR ${MY_BINARY_DIR}) +cmake_determine_compiler_id_vendor(MyLang) + +if("${CMAKE_MyLang_COMPILER_ID}" STREQUAL "MyVendor") + message(STATUS "Found MyVendor compiler id!") +else() + message(FATAL_ERROR "Did not find MyVendor compiler id: [${CMAKE_MyLang_COMPILER_ID}]") +endif() diff --git a/Tests/CTestTestScheduler/CMakeLists.txt b/Tests/CTestTestScheduler/CMakeLists.txt new file mode 100644 index 000000000..8e7678dd0 --- /dev/null +++ b/Tests/CTestTestScheduler/CMakeLists.txt @@ -0,0 +1,9 @@ +CMAKE_MINIMUM_REQUIRED (VERSION 2.6) +PROJECT (CTestTestScheduler) +INCLUDE (CTest) + +ADD_EXECUTABLE (Sleep sleep.c) + +FOREACH (time RANGE 1 5) + ADD_TEST (TestSleep${time} Sleep ${time}) +ENDFOREACH (time RANGE 1 5) diff --git a/Tests/CTestTestScheduler/CTestConfig.cmake b/Tests/CTestTestScheduler/CTestConfig.cmake new file mode 100644 index 000000000..7da8f6f53 --- /dev/null +++ b/Tests/CTestTestScheduler/CTestConfig.cmake @@ -0,0 +1,7 @@ +set(CTEST_PROJECT_NAME "CTestTestScheduler") +set(CTEST_NIGHTLY_START_TIME "21:00:00 EDT") +set(CTEST_DART_SERVER_VERSION "2") +set(CTEST_DROP_METHOD "http") +set(CTEST_DROP_SITE "www.cdash.org") +set(CTEST_DROP_LOCATION "/CDash/submit.php?project=PublicDashboard") +set(CTEST_DROP_SITE_CDASH TRUE) diff --git a/Tests/CTestTestScheduler/sleep.c b/Tests/CTestTestScheduler/sleep.c new file mode 100644 index 000000000..b06776c2b --- /dev/null +++ b/Tests/CTestTestScheduler/sleep.c @@ -0,0 +1,21 @@ +#if defined(_WIN32) +# include +#else +# include +#endif + +/* sleeps for 2n seconds, where n is the argument to the program */ +int main(int argc, char** argv) +{ + int time; + if(argc > 1) + { + time = 3 * atoi(argv[1]); + } +#if defined(_WIN32) + Sleep(time * 1000); +#else + sleep(time); +#endif + return 0; +} diff --git a/Tests/CTestTestScheduler/test.cmake.in b/Tests/CTestTestScheduler/test.cmake.in new file mode 100644 index 000000000..2a91829f4 --- /dev/null +++ b/Tests/CTestTestScheduler/test.cmake.in @@ -0,0 +1,31 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.1) + +# Settings: +SET(CTEST_DASHBOARD_ROOT "@CMake_BINARY_DIR@/Tests/CTestTest") +SET(CTEST_SITE "@SITE@") +SET(CTEST_BUILD_NAME "CTestTest-@BUILDNAME@-Scheduler") + +SET(CTEST_SOURCE_DIRECTORY "@CMake_SOURCE_DIR@/Tests/CTestTestScheduler") +SET(CTEST_BINARY_DIRECTORY "@CMake_BINARY_DIR@/Tests/CTestTestScheduler") +SET(CTEST_CVS_COMMAND "@CVSCOMMAND@") +SET(CTEST_CMAKE_GENERATOR "@CMAKE_TEST_GENERATOR@") +SET(CTEST_BUILD_CONFIGURATION "$ENV{CMAKE_CONFIG_TYPE}") +SET(CTEST_MEMORYCHECK_COMMAND "@MEMORYCHECK_COMMAND@") +SET(CTEST_MEMORYCHECK_SUPPRESSIONS_FILE "@MEMORYCHECK_SUPPRESSIONS_FILE@") +SET(CTEST_MEMORYCHECK_COMMAND_OPTIONS "@MEMORYCHECK_COMMAND_OPTIONS@") +SET(CTEST_COVERAGE_COMMAND "@COVERAGE_COMMAND@") +SET(CTEST_NOTES_FILES "${CTEST_SCRIPT_DIRECTORY}/${CTEST_SCRIPT_NAME}") + +#CTEST_EMPTY_BINARY_DIRECTORY(${CTEST_BINARY_DIRECTORY}) + +# Remove old cost data file if it exists +IF(EXISTS "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") + FILE(REMOVE "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") +ENDIF(EXISTS "${CTEST_BINARY_DIRECTORY}/Testing/Temporary/CTestCostData.txt") + +CTEST_START(Experimental) +CTEST_CONFIGURE(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_BUILD(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res PARALLEL_LEVEL 5) +# Run test set a second time to make sure they run in reverse order +CTEST_TEST(BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res PARALLEL_LEVEL 5) diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index 1509adfa5..6f31a2cf9 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -6,6 +6,7 @@ get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH) set(TOP "${TOP}/@CTestUpdateCVS_DIR@") set(UPDATE_NOT_GLOBAL 1) +set(UPDATE_MAYBE Updated{CTestConfig.cmake}) # Include code common to all update tests. include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake") diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 1f5941d5b..94c37fe75 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.cmake @@ -30,20 +30,20 @@ function(check_updates build) message(" found ${UPDATE_XML_FILE}") # Read entries from the Update.xml file + set(types "Updated|Modified|Conflicting") file(STRINGS ${TOP}/${UPDATE_XML_FILE} UPDATE_XML_ENTRIES - REGEX "FullName" + REGEX "<(${types}|FullName)>" LIMIT_INPUT 4096 ) + string(REGEX REPLACE + "[ \t]*<(${types})>[ \t]*;[ \t]*([^<]*)" + "\\1{\\2}" UPDATE_XML_ENTRIES "${UPDATE_XML_ENTRIES}") - # Verify that expected entries exist - set(MISSING) - foreach(f ${ARGN}) - string(REPLACE "/" "[/\\\\]" regex "${f}") - string(REPLACE "." "\\." regex "${regex}") - if(NOT "${UPDATE_XML_ENTRIES}" MATCHES "${regex}") - list(APPEND MISSING ${f}) - endif() - endforeach(f) + # Compare expected and actual entries + set(EXTRA "${UPDATE_XML_ENTRIES}") + list(REMOVE_ITEM EXTRA ${ARGN} ${UPDATE_MAYBE}) + set(MISSING "${ARGN}") + list(REMOVE_ITEM MISSING ${UPDATE_XML_ENTRIES}) if(NOT UPDATE_NOT_GLOBAL) set(rev_elements Revision PriorRevision ${UPDATE_GLOBAL_ELEMENTS}) @@ -65,13 +65,31 @@ function(check_updates build) endif() # Report the result + set(MSG "") if(MISSING) # List the missing entries - set(MSG "Update.xml is missing an entry for:\n") + set(MSG "${MSG}Update.xml is missing expected entries:\n") foreach(f ${MISSING}) set(MSG "${MSG} ${f}\n") endforeach(f) + else(MISSING) + # Success + message(" no entries missing from Update.xml") + endif(MISSING) + # Report the result + if(EXTRA) + # List the extra entries + set(MSG "${MSG}Update.xml has extra unexpected entries:\n") + foreach(f ${EXTRA}) + set(MSG "${MSG} ${f}\n") + endforeach(f) + else(EXTRA) + # Success + message(" no extra entries in Update.xml") + endif(EXTRA) + + if(MSG) # Provide the log file file(GLOB UPDATE_LOG_FILE ${TOP}/${build}/Testing/Temporary/LastUpdate*.log) @@ -85,10 +103,7 @@ function(check_updates build) # Display the error message message(FATAL_ERROR "${MSG}") - else(MISSING) - # Success - message(" no entries missing from Update.xml") - endif(MISSING) + endif(MSG) endfunction(check_updates) #----------------------------------------------------------------------------- @@ -175,8 +190,15 @@ function(run_dashboard_command_line bin_dir) ) # Verify the updates reported by CTest. - check_updates(${bin_dir} foo.txt bar.txt zot.txt CTestConfig.cmake - subdir/foo.txt subdir/bar.txt) + list(APPEND UPDATE_MAYBE Updated{subdir}) + check_updates(${bin_dir} + Updated{foo.txt} + Updated{bar.txt} + Updated{zot.txt} + Updated{subdir/foo.txt} + Updated{subdir/bar.txt} + Modified{CTestConfig.cmake} + ) endfunction(run_dashboard_command_line) #----------------------------------------------------------------------------- @@ -188,8 +210,14 @@ function(run_dashboard_script name) ) # Verify the updates reported by CTest. - check_updates(dash-binary foo.txt bar.txt zot.txt - subdir/foo.txt subdir/bar.txt) + list(APPEND UPDATE_MAYBE Updated{subdir}) + check_updates(dash-binary + Updated{foo.txt} + Updated{bar.txt} + Updated{zot.txt} + Updated{subdir/foo.txt} + Updated{subdir/bar.txt} + ) endfunction(run_dashboard_script) #----------------------------------------------------------------------------- diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 8b1060002..c721bb4e6 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -25,6 +25,12 @@ set(AUTHOR_CONFIG "[user] message("Creating test directory...") init_testing() +if(UNIX) + set(src "@CMAKE_CURRENT_SOURCE_DIR@") + configure_file(${src}/CTestUpdateGIT.sh.in ${TOP}/git.sh @ONLY) + set(GIT ${TOP}/git.sh) +endif() + #----------------------------------------------------------------------------- # Create the repository. message("Creating repository...") diff --git a/Tests/CTestUpdateGIT.sh.in b/Tests/CTestUpdateGIT.sh.in new file mode 100755 index 000000000..4761d3293 --- /dev/null +++ b/Tests/CTestUpdateGIT.sh.in @@ -0,0 +1,6 @@ +#!/bin/sh +if test "x$1" = "xpull"; then + "@GIT@" "$@" && sleep 1 && touch foo.txt +else + exec "@GIT@" "$@" +fi