diff options
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 13 | ||||
-rw-r--r-- | Modules/CMakeFindEclipseCDT4.cmake | 19 | ||||
-rw-r--r-- | Modules/CMakeParseArguments.cmake | 138 | ||||
-rw-r--r-- | Modules/CMakeVS6FindMake.cmake | 1 | ||||
-rw-r--r-- | Modules/CMakeVS71FindMake.cmake | 1 | ||||
-rw-r--r-- | Modules/CMakeVS7FindMake.cmake | 1 | ||||
-rw-r--r-- | Modules/FindPackageHandleStandardArgs.cmake | 100 | ||||
-rw-r--r-- | Modules/FortranCInterface.cmake | 6 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.cxx | 68 | ||||
-rw-r--r-- | Source/CTest/cmCTestMemCheckHandler.h | 3 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.cxx | 16 | ||||
-rw-r--r-- | Source/CTest/cmCTestRunTest.h | 1 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 10 | ||||
-rw-r--r-- | Source/cmLocalGenerator.cxx | 24 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 43 | ||||
-rw-r--r-- | Source/cmSystemTools.h | 6 | ||||
-rw-r--r-- | Source/kwsys/kwsysDateStamp.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeTests/ModuleNoticesTest.cmake.in | 2 |
18 files changed, 266 insertions, 188 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 5fc2238..bf78a5b 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -283,6 +283,7 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} OUTPUT_VARIABLE output ERROR_VARIABLE output RESULT_VARIABLE result + TIMEOUT 10 ) IF("${output}" MATCHES "${regex}") FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log @@ -291,9 +292,15 @@ FUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) 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}") + IF("${result}" MATCHES "timeout") + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "Checking whether the ${lang} compiler is ${vendor} using \"${flags}\" " + "terminated after 10 s due to timeout.") + 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() ENDIF() ENDFOREACH() ENDFUNCTION(CMAKE_DETERMINE_COMPILER_ID_VENDOR) diff --git a/Modules/CMakeFindEclipseCDT4.cmake b/Modules/CMakeFindEclipseCDT4.cmake index 9cb7bed..836e4c9 100644 --- a/Modules/CMakeFindEclipseCDT4.cmake +++ b/Modules/CMakeFindEclipseCDT4.cmake @@ -47,16 +47,21 @@ MACRO(_DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _resultIncludeDirs _resultDefines # now find the builtin macros: STRING(REGEX MATCHALL "#define[^\n]+\n" _defineLines "${_gccStdout}") +# A few example lines which the regexp below has to match properly: +# #define MAX(a,b) ((a) > (b) ? (a) : (b)) +# #define __fastcall __attribute__((__fastcall__)) +# #define FOO (23) +# #define __UINTMAX_TYPE__ long long unsigned int +# #define __UINTMAX_TYPE__ long long unsigned int +# #define __i386__ 1 FOREACH(nextLine ${_defineLines}) - STRING(REGEX REPLACE "#define " "" _defineRemoved "${nextLine}") -# not sure why this longer regexp was in the patch, the shorter one in the line below seems to work just fine: -# STRING(REGEX MATCH "[A-Za-z_][A-Za-z0-9_]*|[A-Za-z_][A-Za-z0-9_]*\\([A-Za-z0-9_, ]*\\)" _name "${_defineRemoved}") - STRING(REGEX MATCH "[A-Za-z_][A-Za-z0-9_]*" _name "${_defineRemoved}") - LIST(APPEND ${_resultDefines} "${_name}") + STRING(REGEX MATCH "^#define +([A-Za-z_][A-Za-z0-9_]*)(\\([^\\)]+\\))? +(.+) *$" _dummy "${nextLine}") + SET(_name "${CMAKE_MATCH_1}${CMAKE_MATCH_2}") + STRING(STRIP "${CMAKE_MATCH_3}" _value) + #MESSAGE(STATUS "m1: -${CMAKE_MATCH_1}- m2: -${CMAKE_MATCH_2}- m3: -${CMAKE_MATCH_3}-") - STRING(REPLACE ${_name} "" _nameRemoved "${_defineRemoved}") - STRING(STRIP "${_nameRemoved}" _value) + LIST(APPEND ${_resultDefines} "${_name}") IF(_value) LIST(APPEND ${_resultDefines} "${_value}") ELSE() diff --git a/Modules/CMakeParseArguments.cmake b/Modules/CMakeParseArguments.cmake new file mode 100644 index 0000000..7ce4c49 --- /dev/null +++ b/Modules/CMakeParseArguments.cmake @@ -0,0 +1,138 @@ +# CMAKE_PARSE_ARGUMENTS(<prefix> <options> <one_value_keywords> <multi_value_keywords> args...) +# +# CMAKE_PARSE_ARGUMENTS() is intended to be used in macros or functions for +# parsing the arguments given to that macro or function. +# It processes the arguments and defines a set of variables which hold the +# values of the respective options. +# +# The <options> argument contains all options for the respective macro, +# i.e. keywords which can be used when calling the macro without any value +# following, like e.g. the OPTIONAL keyword of the install() command. +# +# The <one_value_keywords> argument contains all keywords for this macro +# which are followed by one value, like e.g. DESTINATION keyword of the +# install() command. +# +# The <multi_value_keywords> argument contains all keywords for this macro +# which can be followed by more than one value, like e.g. the TARGETS or +# FILES keywords of the install() command. +# +# When done, CMAKE_PARSE_ARGUMENTS() will have defined for each of the +# keywords listed in <options>, <one_value_keywords> and +# <multi_value_keywords> a variable composed of the given <prefix> +# followed by "_" and the name of the respective keyword. +# These variables will then hold the respective value from the argument list. +# For the <options> keywords this will be TRUE or FALSE. +# +# All remaining arguments are collected in a variable +# <prefix>_UNPARSED_ARGUMENTS, this can be checked afterwards to see whether +# your macro was called with unrecognized parameters. +# +# As an example here a my_install() macro, which takes similar arguments as the +# real install() command: +# +# function(MY_INSTALL) +# set(options OPTIONAL FAST) +# set(oneValueArgs DESTINATION RENAME) +# set(multiValueArgs TARGETS CONFIGURATIONS) +# cmake_parse_arguments(MY_INSTALL "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) +# ... +# +# Assume my_install() has been called like this: +# my_install(TARGETS foo bar DESTINATION bin OPTIONAL blub) +# +# After the cmake_parse_arguments() call the macro will have set the following +# variables: +# MY_INSTALL_OPTIONAL = TRUE +# MY_INSTALL_FAST = FALSE (this option was not used when calling my_install() +# MY_INSTALL_DESTINATION = "bin" +# MY_INSTALL_RENAME = "" (was not used) +# MY_INSTALL_TARGETS = "foo;bar" +# MY_INSTALL_CONFIGURATIONS = "" (was not used) +# MY_INSTALL_UNPARSED_ARGUMENTS = "blub" (no value expected after "OPTIONAL" +# +# You can the continue and process these variables. +# +# Keywords terminate lists of values, e.g. if directly after a one_value_keyword +# another recognized keyword follows, this is interpreted as the beginning of +# the new option. +# E.g. my_install(TARGETS foo DESTINATION OPTIONAL) would result in +# MY_INSTALL_DESTINATION set to "OPTIONAL", but MY_INSTALL_DESTINATION would +# be empty and MY_INSTALL_OPTIONAL would be set to TRUE therefor. + +#============================================================================= +# Copyright 2010 Alexander Neundorf <neundorf@kde.org> +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + + +if(__CMAKE_PARSE_ARGUMENTS_INCLUDED) + return() +endif() +set(__CMAKE_PARSE_ARGUMENTS_INCLUDED TRUE) + + +function(CMAKE_PARSE_ARGUMENTS prefix _optionNames _singleArgNames _multiArgNames) + # first set all result variables to empty/FALSE + foreach(arg_name ${_singleArgNames} ${_multiArgNames}) + set(${prefix}_${arg_name}) + endforeach(arg_name) + + foreach(option ${_optionNames}) + set(${prefix}_${option} FALSE) + endforeach(option) + + set(${prefix}_UNPARSED_ARGUMENTS) + + set(insideValues FALSE) + set(currentArgName) + + # now iterate over all arguments and fill the result variables + foreach(currentArg ${ARGN}) + list(FIND _optionNames "${currentArg}" optionIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _singleArgNames "${currentArg}" singleArgIndex) # ... then this marks the end of the arguments belonging to this keyword + list(FIND _multiArgNames "${currentArg}" multiArgIndex) # ... then this marks the end of the arguments belonging to this keyword + + if(${optionIndex} EQUAL -1 AND ${singleArgIndex} EQUAL -1 AND ${multiArgIndex} EQUAL -1) + if(insideValues) + if("${insideValues}" STREQUAL "SINGLE") + set(${prefix}_${currentArgName} ${currentArg}) + set(insideValues FALSE) + elseif("${insideValues}" STREQUAL "MULTI") + list(APPEND ${prefix}_${currentArgName} ${currentArg}) + endif() + else(insideValues) + list(APPEND ${prefix}_UNPARSED_ARGUMENTS ${currentArg}) + endif(insideValues) + else() + if(NOT ${optionIndex} EQUAL -1) + set(${prefix}_${currentArg} TRUE) + set(insideValues FALSE) + elseif(NOT ${singleArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "SINGLE") + elseif(NOT ${multiArgIndex} EQUAL -1) + set(currentArgName ${currentArg}) + set(${prefix}_${currentArgName}) + set(insideValues "MULTI") + endif() + endif() + + endforeach(currentArg) + + # propagate the result variables to the caller: + foreach(arg_name ${_singleArgNames} ${_multiArgNames} ${_optionNames}) + set(${prefix}_${arg_name} ${${prefix}_${arg_name}} PARENT_SCOPE) + endforeach(arg_name) + set(${prefix}_UNPARSED_ARGUMENTS ${${prefix}_UNPARSED_ARGUMENTS} PARENT_SCOPE) + +endfunction(CMAKE_PARSE_ARGUMENTS _options _singleArgs _multiArgs) diff --git a/Modules/CMakeVS6FindMake.cmake b/Modules/CMakeVS6FindMake.cmake index 6a73905..dccf8c4 100644 --- a/Modules/CMakeVS6FindMake.cmake +++ b/Modules/CMakeVS6FindMake.cmake @@ -22,3 +22,4 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC60 1) +SET(MSVC_VERSION 1200) diff --git a/Modules/CMakeVS71FindMake.cmake b/Modules/CMakeVS71FindMake.cmake index bb03e7a..2381adb 100644 --- a/Modules/CMakeVS71FindMake.cmake +++ b/Modules/CMakeVS71FindMake.cmake @@ -23,3 +23,4 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC71 1) +SET(MSVC_VERSION 1310) diff --git a/Modules/CMakeVS7FindMake.cmake b/Modules/CMakeVS7FindMake.cmake index 99c953e..665158c 100644 --- a/Modules/CMakeVS7FindMake.cmake +++ b/Modules/CMakeVS7FindMake.cmake @@ -22,3 +22,4 @@ FIND_PROGRAM(CMAKE_MAKE_PROGRAM ) MARK_AS_ADVANCED(CMAKE_MAKE_PROGRAM) SET(MSVC70 1) +SET(MSVC_VERSION 1300) diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index 37a55b3..c698480 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -68,89 +68,47 @@ # License text for the above reference.) INCLUDE(FindPackageMessage) - -# Checks a list of strings (typically function/macro parameters) whether it contains a keyword -# (_keyword) and return the value(s) following this keyword in _outputVar. -# If _multipleValues is true, this can be more than one value. -# Then end of the values for a keyword is then determined by checking whether the -# next argument is contained in _allKeywordsList. -FUNCTION(FPHSA_GET_OPTION_VALUE _keyword _outputVar _allArgsList _allKeywordsList _multipleValues) - UNSET(${_outputVar}) - UNSET(_removeIndices) - - SET(_insideValues FALSE) - SET(_counter 0) - FOREACH(_currentArg ${${_allArgsList}}) - IF(NOT _insideValues) # first check that we find the keyword we are currently interested in... - IF("${_currentArg}" STREQUAL "${_keyword}") - SET(_insideValues TRUE) - LIST(APPEND _removeIndices ${_counter}) - ENDIF("${_currentArg}" STREQUAL "${_keyword}") - ELSE(NOT _insideValues) - - LIST(FIND ${_allKeywordsList} "${_currentArg}" _index) # ... then this marks the end of the arguments belonging to this keyword - IF(${_index} EQUAL -1) - LIST(APPEND _result ${_currentArg}) - LIST(APPEND _removeIndices ${_counter}) # collect the indices of the strings we found to remove them from the list afterwards - IF(NOT _multipleValues) - BREAK() - ENDIF(NOT _multipleValues) - ELSE(${_index} EQUAL -1) - SET(_insideValues FALSE) - BREAK() - ENDIF(${_index} EQUAL -1) - ENDIF(NOT _insideValues) - - MATH(EXPR _counter "${_counter} + 1") - - ENDFOREACH(_currentArg ${${_allArgsList}}) - - IF(DEFINED _removeIndices) - LIST(REMOVE_AT ${_allArgsList} ${_removeIndices}) - ENDIF(DEFINED _removeIndices) - - SET(${_outputVar} ${_result} PARENT_SCOPE) - SET(${_allArgsList} ${${_allArgsList}} PARENT_SCOPE) - -ENDFUNCTION(FPHSA_GET_OPTION_VALUE _keyword _outputVar _allArgsList _allKeywordsList _multipleValues) +INCLUDE(CMakeParseArguments) FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) - SET(_KEYWORDS_FOR_EXTENDED_MODE FAIL_MESSAGE REQUIRED_VARS VERSION_VAR ) +# set up the arguments for CMAKE_PARSE_ARGUMENTS and check whether we are in +# new extended or in the "old" mode: + SET(options) # none + SET(oneValueArgs FAIL_MESSAGE VERSION_VAR) + SET(multiValueArgs REQUIRED_VARS) + SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) LIST(FIND _KEYWORDS_FOR_EXTENDED_MODE "${_FIRST_ARG}" INDEX) IF(${INDEX} EQUAL -1) - SET(_FAIL_MESSAGE ${_FIRST_ARG}) - SET(_REQUIRED_VARS ${_VAR1} ${ARGN}) - SET(_VERSION_VAR) + SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) + SET(FPHSA_REQUIRED_VARS ${_VAR1} ${ARGN}) + SET(FPHSA_VERSION_VAR) ELSE(${INDEX} EQUAL -1) - SET(ALL_ARGS ${_FIRST_ARG} ${_VAR1} ${ARGN}) - FPHSA_GET_OPTION_VALUE("FAIL_MESSAGE" _FAIL_MESSAGE ALL_ARGS _KEYWORDS_FOR_EXTENDED_MODE FALSE) - FPHSA_GET_OPTION_VALUE("REQUIRED_VARS" _REQUIRED_VARS ALL_ARGS _KEYWORDS_FOR_EXTENDED_MODE TRUE) - FPHSA_GET_OPTION_VALUE("VERSION_VAR" _VERSION_VAR ALL_ARGS _KEYWORDS_FOR_EXTENDED_MODE FALSE) + CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${_VAR1} ${ARGN}) - IF(ALL_ARGS) - MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${ALL_ARGS}\"") - ENDIF(ALL_ARGS) + IF(FPHSA_UNPARSED_ARGUMENTS) + MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") + ENDIF(FPHSA_UNPARSED_ARGUMENTS) - IF(NOT _FAIL_MESSAGE) - SET(_FAIL_MESSAGE "DEFAULT_MSG") - ENDIF(NOT _FAIL_MESSAGE) + IF(NOT FPHSA_FAIL_MESSAGE) + SET(FPHSA_FAIL_MESSAGE "DEFAULT_MSG") + ENDIF(NOT FPHSA_FAIL_MESSAGE) ENDIF(${INDEX} EQUAL -1) # now that we collected all arguments, process them - IF("${_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") - SET(_FAIL_MESSAGE "Could NOT find ${_NAME}") - ENDIF("${_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + IF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") + ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") - IF(NOT _REQUIRED_VARS) + IF(NOT FPHSA_REQUIRED_VARS) MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") - ENDIF(NOT _REQUIRED_VARS) + ENDIF(NOT FPHSA_REQUIRED_VARS) - LIST(GET _REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) + LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) STRING(TOUPPER ${_NAME} _NAME_UPPER) @@ -160,7 +118,7 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) SET(DETAILS "") SET(${_NAME_UPPER}_FOUND TRUE) # check if all passed variables are valid - FOREACH(_CURRENT_VAR ${_REQUIRED_VARS}) + FOREACH(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) IF(NOT ${_CURRENT_VAR}) SET(${_NAME_UPPER}_FOUND FALSE) SET(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") @@ -177,7 +135,7 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) # if the package was found, check for the version using <NAME>_FIND_VERSION IF (${_NAME_UPPER}_FOUND) - SET(VERSION ${${_VERSION_VAR}} ) + SET(VERSION ${${FPHSA_VERSION_VAR}} ) IF(VERSION) @@ -227,20 +185,20 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) IF(NOT VERSION_OK) IF (${_NAME}_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + MESSAGE(FATAL_ERROR "${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") ELSE (${_NAME}_FIND_REQUIRED) IF (NOT ${_NAME}_FIND_QUIETLY) - MESSAGE(STATUS "${_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + MESSAGE(STATUS "${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") ENDIF (NOT ${_NAME}_FIND_QUIETLY) ENDIF (${_NAME}_FIND_REQUIRED) ELSE(NOT VERSION_OK) IF (${_NAME}_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + MESSAGE(FATAL_ERROR "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") ELSE (${_NAME}_FIND_REQUIRED) IF (NOT ${_NAME}_FIND_QUIETLY) - MESSAGE(STATUS "${_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + MESSAGE(STATUS "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") ENDIF (NOT ${_NAME}_FIND_QUIETLY) ENDIF (${_NAME}_FIND_REQUIRED) ENDIF(NOT VERSION_OK) diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index cc0d5fb..90ef59b 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -47,9 +47,9 @@ # MACRO_NAMESPACE "FC_" # SYMBOL_NAMESPACE "FC_" # SYMBOLS mysub mymod:my_sub) -# This creates a "FC.h" header that defines the same FC_*() mangling -# macros as the previous example plus preprocessor symbols FC_mysub -# and FC_mymod_my_sub. +# This creates a "FCMangle.h" header that defines the same FC_*() +# mangling macros as the previous example plus preprocessor symbols +# FC_mysub and FC_mymod_my_sub. # # Another function is provided to verify that the Fortran and C/C++ # compilers work together: diff --git a/Source/CTest/cmCTestMemCheckHandler.cxx b/Source/CTest/cmCTestMemCheckHandler.cxx index 0d15ddc..13a25cb 100644 --- a/Source/CTest/cmCTestMemCheckHandler.cxx +++ b/Source/CTest/cmCTestMemCheckHandler.cxx @@ -201,8 +201,7 @@ void cmCTestMemCheckHandler::Initialize() this->CustomMaximumPassedTestOutputSize = 0; this->CustomMaximumFailedTestOutputSize = 0; this->MemoryTester = ""; - this->MemoryTesterOptionsParsed.clear(); - this->MemoryTesterOptions = ""; + this->MemoryTesterOptions.clear(); this->MemoryTesterStyle = UNKNOWN; this->MemoryTesterOutputFile = ""; int cc; @@ -249,12 +248,12 @@ void cmCTestMemCheckHandler::GenerateTestCommand( std::vector<cmStdString>::size_type pp; std::string memcheckcommand = ""; memcheckcommand = this->MemoryTester; - for ( pp = 0; pp < this->MemoryTesterOptionsParsed.size(); pp ++ ) + for ( pp = 0; pp < this->MemoryTesterOptions.size(); pp ++ ) { - args.push_back(this->MemoryTesterOptionsParsed[pp]); - memcheckcommand += " "; - memcheckcommand += cmSystemTools::EscapeSpaces( - this->MemoryTesterOptionsParsed[pp].c_str()); + args.push_back(this->MemoryTesterOptions[pp]); + memcheckcommand += " \""; + memcheckcommand += this->MemoryTesterOptions[pp]; + memcheckcommand += "\""; } cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Memory check command: " << memcheckcommand << std::endl); @@ -440,18 +439,21 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() } // Setup the options + std::string memoryTesterOptions; if ( this->CTest->GetCTestConfiguration( "MemoryCheckCommandOptions").size() ) { - this->MemoryTesterOptions = this->CTest->GetCTestConfiguration( + memoryTesterOptions = this->CTest->GetCTestConfiguration( "MemoryCheckCommandOptions"); } else if ( this->CTest->GetCTestConfiguration( "ValgrindCommandOptions").size() ) { - this->MemoryTesterOptions = this->CTest->GetCTestConfiguration( + memoryTesterOptions = this->CTest->GetCTestConfiguration( "ValgrindCommandOptions"); } + this->MemoryTesterOptions + = cmSystemTools::ParseArguments(memoryTesterOptions.c_str()); this->MemoryTesterOutputFile = this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.log"; @@ -459,10 +461,14 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() if ( this->MemoryTester.find("valgrind") != std::string::npos ) { this->MemoryTesterStyle = cmCTestMemCheckHandler::VALGRIND; - if ( !this->MemoryTesterOptions.size() ) + if ( this->MemoryTesterOptions.empty() ) { - this->MemoryTesterOptions = "-q --tool=memcheck --leak-check=yes " - "--show-reachable=yes --workaround-gcc296-bugs=yes --num-callers=50"; + this->MemoryTesterOptions.push_back("-q"); + this->MemoryTesterOptions.push_back("--tool=memcheck"); + this->MemoryTesterOptions.push_back("--leak-check=yes"); + this->MemoryTesterOptions.push_back("--show-reachable=yes"); + this->MemoryTesterOptions.push_back("--workaround-gcc296-bugs=yes"); + this->MemoryTesterOptions.push_back("--num-callers=50"); } if ( this->CTest->GetCTestConfiguration( "MemoryCheckSuppressionFile").size() ) @@ -476,17 +482,15 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() "MemoryCheckSuppressionFile").c_str() << std::endl); return false; } - this->MemoryTesterOptions += " --suppressions=" + - cmSystemTools::EscapeSpaces(this->CTest->GetCTestConfiguration( - "MemoryCheckSuppressionFile").c_str()) + ""; + std::string suppressions = "--suppressions=" + + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile"); + this->MemoryTesterOptions.push_back(suppressions); } } else if ( this->MemoryTester.find("purify") != std::string::npos ) { this->MemoryTesterStyle = cmCTestMemCheckHandler::PURIFY; - std::string outputFile = - cmSystemTools::EscapeSpaces(this->MemoryTesterOutputFile.c_str()); - + std::string outputFile; #ifdef _WIN32 if( this->CTest->GetCTestConfiguration( "MemoryCheckSuppressionFile").size() ) @@ -500,31 +504,29 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() "MemoryCheckSuppressionFile").c_str() << std::endl); return false; } - this->MemoryTesterOptions += " /FilterFiles=" + - cmSystemTools::EscapeSpaces(this->CTest->GetCTestConfiguration( - "MemoryCheckSuppressionFile").c_str()); + std::string filterFiles = "/FilterFiles=" + + this->CTest->GetCTestConfiguration("MemoryCheckSuppressionFile"); + this->MemoryTesterOptions.push_back(filterFiles); } - this->MemoryTesterOptions += " /SAVETEXTDATA=" + outputFile; + outputFile = "/SAVETEXTDATA="; #else - this->MemoryTesterOptions += " -log-file=" + outputFile; + outputFile = "-log-file="; #endif + outputFile += this->MemoryTesterOutputFile; + this->MemoryTesterOptions.push_back(outputFile); } else if ( this->MemoryTester.find("BC") != std::string::npos ) { this->BoundsCheckerXMLFile = this->MemoryTesterOutputFile; - std::string outputFile = - cmSystemTools::EscapeSpaces(this->MemoryTesterOutputFile.c_str()); std::string dpbdFile = this->CTest->GetBinaryDir() + "/Testing/Temporary/MemoryChecker.DPbd"; - std::string errorFile = this->CTest->GetBinaryDir() - + "/Testing/Temporary/MemoryChecker.error"; - errorFile = cmSystemTools::EscapeSpaces(errorFile.c_str()); this->BoundsCheckerDPBDFile = dpbdFile; - dpbdFile = cmSystemTools::EscapeSpaces(dpbdFile.c_str()); this->MemoryTesterStyle = cmCTestMemCheckHandler::BOUNDS_CHECKER; - this->MemoryTesterOptions += " /B " + dpbdFile; - this->MemoryTesterOptions += " /X " + outputFile; - this->MemoryTesterOptions += " /M "; + this->MemoryTesterOptions.push_back("/B"); + this->MemoryTesterOptions.push_back(dpbdFile); + this->MemoryTesterOptions.push_back("/X"); + this->MemoryTesterOptions.push_back(this->MemoryTesterOutputFile); + this->MemoryTesterOptions.push_back("/M"); } else { @@ -534,8 +536,6 @@ bool cmCTestMemCheckHandler::InitializeMemoryChecking() return false; } - this->MemoryTesterOptionsParsed - = cmSystemTools::ParseArguments(this->MemoryTesterOptions.c_str()); std::vector<cmStdString>::size_type cc; for ( cc = 0; cmCTestMemCheckResultStrings[cc]; cc ++ ) { diff --git a/Source/CTest/cmCTestMemCheckHandler.h b/Source/CTest/cmCTestMemCheckHandler.h index db426f0..427d471 100644 --- a/Source/CTest/cmCTestMemCheckHandler.h +++ b/Source/CTest/cmCTestMemCheckHandler.h @@ -89,8 +89,7 @@ private: std::string BoundsCheckerDPBDFile; std::string BoundsCheckerXMLFile; std::string MemoryTester; - std::vector<cmStdString> MemoryTesterOptionsParsed; - std::string MemoryTesterOptions; + std::vector<cmStdString> MemoryTesterOptions; int MemoryTesterStyle; std::string MemoryTesterOutputFile; int MemoryTesterGlobalResults[NO_MEMORY_FAULT]; diff --git a/Source/CTest/cmCTestRunTest.cxx b/Source/CTest/cmCTestRunTest.cxx index ce44097..6570d0e 100644 --- a/Source/CTest/cmCTestRunTest.cxx +++ b/Source/CTest/cmCTestRunTest.cxx @@ -471,7 +471,7 @@ void cmCTestRunTest::ComputeArguments() this->TestProperties->Args[1].c_str()); ++j; //skip the executable (it will be actualCommand) } - this->TestCommand + std::string testCommand = cmSystemTools::ConvertToOutputPath(this->ActualCommand.c_str()); //Prepends memcheck args to our command string @@ -479,22 +479,24 @@ void cmCTestRunTest::ComputeArguments() for(std::vector<std::string>::iterator i = this->Arguments.begin(); i != this->Arguments.end(); ++i) { - this->TestCommand += " "; - this->TestCommand += cmSystemTools::EscapeSpaces(i->c_str()); + testCommand += " \""; + testCommand += *i; + testCommand += "\""; } for(;j != this->TestProperties->Args.end(); ++j) { - this->TestCommand += " "; - this->TestCommand += cmSystemTools::EscapeSpaces(j->c_str()); + testCommand += " \""; + testCommand += *j; + testCommand += "\""; this->Arguments.push_back(*j); } - this->TestResult.FullCommandLine = this->TestCommand; + this->TestResult.FullCommandLine = testCommand; cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl << this->Index << ": " << (this->TestHandler->MemCheck?"MemCheck":"Test") - << " command: " << this->TestCommand + << " command: " << testCommand << std::endl); } diff --git a/Source/CTest/cmCTestRunTest.h b/Source/CTest/cmCTestRunTest.h index e0cb888..66e6b7b 100644 --- a/Source/CTest/cmCTestRunTest.h +++ b/Source/CTest/cmCTestRunTest.h @@ -89,7 +89,6 @@ private: cmCTestTestHandler::cmCTestTestResult TestResult; int Index; std::string StartTime; - std::string TestCommand; std::string ActualCommand; std::vector<std::string> Arguments; bool StopTimePassed; diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index 3a777d5..d12fde0 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -410,10 +410,14 @@ std::string cmCTest::GetCDashVersion() //First query the server. If that fails, fall back to the local setting std::string response; std::string url = "http://"; - url += this->GetCTestConfiguration("DropSite") + "/CDash/api/getversion.php"; - + url += this->GetCTestConfiguration("DropSite"); + + std::string cdashUri = this->GetCTestConfiguration("DropLocation"); + cdashUri = cdashUri.substr(0, cdashUri.find("/submit.php")); + + url += cdashUri + "/api/getversion.php"; int res = cmCTest::HTTPRequest(url, cmCTest::HTTP_GET, response, "", "", 3); - + return res ? this->GetCTestConfiguration("CDashVersion") : response; #else return this->GetCTestConfiguration("CDashVersion"); diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 07c92e5..bac0223 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2810,17 +2810,29 @@ cmLocalGenerator std::string cmLocalGenerator::EscapeForShellOldStyle(const char* str) { std::string result; - bool forceOn = cmSystemTools::GetForceUnixPaths(); - if(forceOn && this->WindowsShell) +#if defined(_WIN32) && !defined(__CYGWIN__) + // if there are spaces + std::string temp = str; + if (temp.find(" ") != std::string::npos && + temp.find("\"")==std::string::npos) { - cmSystemTools::SetForceUnixPaths(false); + result = "\""; + result += str; + result += "\""; + return result; } - result = cmSystemTools::EscapeSpaces(str); - if(forceOn && this->WindowsShell) + return str; +#else + for(const char* ch = str; *ch != '\0'; ++ch) { - cmSystemTools::SetForceUnixPaths(true); + if(*ch == ' ') + { + result += '\\'; + } + result += *ch; } return result; +#endif } //---------------------------------------------------------------------------- diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 0e0a770..271a662 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -191,49 +191,6 @@ std::string cmSystemTools::EscapeQuotes(const char* str) return result; } -std::string cmSystemTools::EscapeSpaces(const char* str) -{ -#if defined(_WIN32) && !defined(__CYGWIN__) - bool useDoubleQ = true; -#else - bool useDoubleQ = false; -#endif - if(cmSystemTools::s_ForceUnixPaths) - { - useDoubleQ = false; - } - - if(useDoubleQ) - { - std::string result; - - // if there are spaces - std::string temp = str; - if (temp.find(" ") != std::string::npos && - temp.find("\"")==std::string::npos) - { - result = "\""; - result += str; - result += "\""; - return result; - } - return str; - } - else - { - std::string result = ""; - for(const char* ch = str; *ch != '\0'; ++ch) - { - if(*ch == ' ') - { - result += '\\'; - } - result += *ch; - } - return result; - } -} - void cmSystemTools::Error(const char* m1, const char* m2, const char* m3, const char* m4) { diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index da5da31..6a9d849 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -46,12 +46,6 @@ public: static void ExpandRegistryValues(std::string& source, KeyWOW64 view = KeyWOW64_Default); - /** - * Platform independent escape spaces, unix uses backslash, - * windows double quotes the string. - */ - static std::string EscapeSpaces(const char* str); - ///! Escape quotes in a string. static std::string EscapeQuotes(const char* str); diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index bd1c4db..6acbd29 100644 --- a/Source/kwsys/kwsysDateStamp.cmake +++ b/Source/kwsys/kwsysDateStamp.cmake @@ -18,4 +18,4 @@ SET(KWSYS_DATE_STAMP_YEAR 2010) SET(KWSYS_DATE_STAMP_MONTH 08) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 19) +SET(KWSYS_DATE_STAMP_DAY 24) diff --git a/Tests/CMakeTests/ModuleNoticesTest.cmake.in b/Tests/CMakeTests/ModuleNoticesTest.cmake.in index 9ad6cfb..8ecebd3 100644 --- a/Tests/CMakeTests/ModuleNoticesTest.cmake.in +++ b/Tests/CMakeTests/ModuleNoticesTest.cmake.in @@ -3,7 +3,7 @@ # match any additional copyright holder notices. set(notice_regex " #============================================================================= -# Copyright (20[0-9][0-9]-)?20[0-9][0-9] Kitware[^\n]+( +# Copyright (20[0-9][0-9]-)?20[0-9][0-9] [^\n]+( # Copyright (20[0-9][0-9]-)?20[0-9][0-9] [^\n]+)* # # Distributed under the OSI-approved BSD License \\(the \"License\"\\); |