diff options
-rw-r--r-- | Modules/FindPackageHandleStandardArgs.cmake | 172 | ||||
-rw-r--r-- | Modules/Platform/Darwin.cmake | 5 | ||||
-rw-r--r-- | Modules/Platform/UnixPaths.cmake | 4 | ||||
-rw-r--r-- | Source/CPack/cmCPackGenerator.cxx | 44 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.cxx | 42 | ||||
-rw-r--r-- | Source/CTest/cmCTestMultiProcessHandler.h | 1 | ||||
-rw-r--r-- | Source/CTest/cmCTestTestHandler.cxx | 9 | ||||
-rw-r--r-- | Source/cmCTest.cxx | 6 | ||||
-rw-r--r-- | Source/cmCTest.h | 3 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.cxx | 143 | ||||
-rw-r--r-- | Source/cmFindPackageCommand.h | 6 | ||||
-rw-r--r-- | Source/ctest.cxx | 5 | ||||
-rw-r--r-- | Source/kwsys/kwsysDateStamp.cmake | 2 | ||||
-rw-r--r-- | Tests/CMakeLists.txt | 5 |
14 files changed, 343 insertions, 104 deletions
diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index c698480..cd33aa3 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -20,18 +20,24 @@ # The second mode is more powerful and also supports version checking: # FIND_PACKAGE_HANDLE_STANDARD_ARGS(NAME [REQUIRED_VARS <var1>...<varN>] # [VERSION_VAR <versionvar> +# [CONFIG_MODE] # [FAIL_MESSAGE "Custom failure message"] ) # # As above, if <var1> through <varN> are all valid, <UPPERCASED_NAME>_FOUND # will be set to TRUE. -# Via FAIL_MESSAGE a custom failure message can be specified, if this is not -# used, the default message will be displayed. +# After REQUIRED_VARS the variables which are required for this package are listed. # Following VERSION_VAR the name of the variable can be specified which holds # the version of the package which has been found. If this is done, this version # will be checked against the (potentially) specified required version used # in the find_package() call. The EXACT keyword is also handled. The default # messages include information about the required version and the version # which has been actually found, both if the version is ok or not. +# Use the option CONFIG_MODE if your FindXXX.cmake module is a wrapper for +# a find_package(... NO_MODULE) call, in this case all the information +# provided by the config-mode of find_package() will be evaluated +# automatically. +# Via FAIL_MESSAGE a custom failure message can be specified, if this is not +# used, the default message will be displayed. # # Example for mode 1: # @@ -53,6 +59,15 @@ # Also the version of BISON will be checked by using the version contained # in BISON_VERSION. # Since no FAIL_MESSAGE is given, the default messages will be printed. +# +# Another example for mode 2: +# +# FIND_PACKAGE(Automoc4 QUIET NO_MODULE HINTS /opt/automoc4) +# FIND_PACKAGE_HANDLE_STANDARD_ARGS(Automoc4 CONFIG_MODE) +# In this case, FindAutmoc4.cmake wraps a call to FIND_PACKAGE(Automoc4 NO_MODULE) +# and adds an additional search directory for automoc4. +# The following FIND_PACKAGE_HANDLE_STANDARD_ARGS() call produces a proper +# success/error message. #============================================================================= # Copyright 2007-2009 Kitware, Inc. @@ -70,12 +85,50 @@ INCLUDE(FindPackageMessage) INCLUDE(CMakeParseArguments) - -FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) +# internal helper macro +MACRO(_FPHSA_FAILURE_MESSAGE _msg) + IF (${_NAME}_FIND_REQUIRED) + MESSAGE(FATAL_ERROR "${_msg}") + ELSE (${_NAME}_FIND_REQUIRED) + IF (NOT ${_NAME}_FIND_QUIETLY) + MESSAGE(STATUS "${_msg}") + ENDIF (NOT ${_NAME}_FIND_QUIETLY) + ENDIF (${_NAME}_FIND_REQUIRED) +ENDMACRO(_FPHSA_FAILURE_MESSAGE _msg) + + +# internal helper macro to generate the failure message when used in CONFIG_MODE: +MACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + # <name>_CONFIG is set, but FOUND is false, this means that some other of the REQUIRED_VARS was not found: + IF(${_NAME}_CONFIG) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: missing: ${MISSING_VARS} (found ${${_NAME}_CONFIG} ${VERSION_MSG})") + ELSE(${_NAME}_CONFIG) + # If _CONSIDERED_CONFIGS is set, the config-file has been found, but no suitable version. + # List them all in the error message: + IF(${_NAME}_CONSIDERED_CONFIGS) + SET(configsText "") + LIST(LENGTH ${_NAME}_CONSIDERED_CONFIGS configsCount) + MATH(EXPR configsCount "${configsCount} - 1") + FOREACH(currentConfigIndex RANGE ${configsCount}) + LIST(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) + LIST(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) + SET(configsText "${configsText} ${filename} (version ${version})\n") + ENDFOREACH(currentConfigIndex) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") + + ELSE(${_NAME}_CONSIDERED_CONFIGS) + # Simple case: No Config-file was found at all: + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: found neither ${_NAME}Config.cmake nor ${_NAME_LOWER}-config.cmake ${VERSION_MSG}") + ENDIF(${_NAME}_CONSIDERED_CONFIGS) + ENDIF(${_NAME}_CONFIG) +ENDMACRO(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) + + +FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) # 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(options CONFIG_MODE) SET(oneValueArgs FAIL_MESSAGE VERSION_VAR) SET(multiValueArgs REQUIRED_VARS) SET(_KEYWORDS_FOR_EXTENDED_MODE ${options} ${oneValueArgs} ${multiValueArgs} ) @@ -83,11 +136,11 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) IF(${INDEX} EQUAL -1) SET(FPHSA_FAIL_MESSAGE ${_FIRST_ARG}) - SET(FPHSA_REQUIRED_VARS ${_VAR1} ${ARGN}) + SET(FPHSA_REQUIRED_VARS ${ARGN}) SET(FPHSA_VERSION_VAR) ELSE(${INDEX} EQUAL -1) - CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${_VAR1} ${ARGN}) + CMAKE_PARSE_ARGUMENTS(FPHSA "${options}" "${oneValueArgs}" "${multiValueArgs}" ${_FIRST_ARG} ${ARGN}) IF(FPHSA_UNPARSED_ARGUMENTS) MESSAGE(FATAL_ERROR "Unknown keywords given to FIND_PACKAGE_HANDLE_STANDARD_ARGS(): \"${FPHSA_UNPARSED_ARGUMENTS}\"") @@ -104,6 +157,14 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) SET(FPHSA_FAIL_MESSAGE "Could NOT find ${_NAME}") ENDIF("${FPHSA_FAIL_MESSAGE}" STREQUAL "DEFAULT_MSG") + # In config-mode, we rely on the variable <package>_CONFIG, which is set by find_package() + # when it successfully found the config-file, including version checking: + IF(FPHSA_CONFIG_MODE) + LIST(INSERT FPHSA_REQUIRED_VARS 0 ${_NAME}_CONFIG) + LIST(REMOVE_DUPLICATES FPHSA_REQUIRED_VARS) + SET(FPHSA_VERSION_VAR ${_NAME}_VERSION) + ENDIF(FPHSA_CONFIG_MODE) + IF(NOT FPHSA_REQUIRED_VARS) MESSAGE(FATAL_ERROR "No REQUIRED_VARS specified for FIND_PACKAGE_HANDLE_STANDARD_ARGS()") ENDIF(NOT FPHSA_REQUIRED_VARS) @@ -111,8 +172,9 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) LIST(GET FPHSA_REQUIRED_VARS 0 _FIRST_REQUIRED_VAR) STRING(TOUPPER ${_NAME} _NAME_UPPER) + STRING(TOLOWER ${_NAME} _NAME_LOWER) - # collect all variables which were not found, so they can be printed, so the + # collect all variables which were not found, so they can be printed, so the # user knows better what went wrong (#6375) SET(MISSING_VARS "") SET(DETAILS "") @@ -131,44 +193,42 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) # version handling: SET(VERSION_MSG "") SET(VERSION_OK TRUE) + SET(VERSION ${${FPHSA_VERSION_VAR}} ) IF (${_NAME}_FIND_VERSION) - # if the package was found, check for the version using <NAME>_FIND_VERSION - IF (${_NAME_UPPER}_FOUND) - SET(VERSION ${${FPHSA_VERSION_VAR}} ) - - IF(VERSION) - - IF(${_NAME}_FIND_VERSION_EXACT) # exact version required - IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - SET(VERSION_MSG " Found version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") - SET(VERSION_OK FALSE) - ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - SET(VERSION_MSG " (found exact version \"${VERSION}\")") - ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") - - ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified: - IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") - SET(VERSION_MSG " Found version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") - SET(VERSION_OK FALSE) - ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") - SET(VERSION_MSG " (found version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")") - ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") - ENDIF(${_NAME}_FIND_VERSION_EXACT) - -# Uncomment the following two lines to see to which Find-modules the VERSION_VAR keywords still need to be added: -# ELSE(VERSION) -# SET(VERSION_MSG " (WARNING: Required version is \"${${_NAME}_FIND_VERSION}\", but version of ${_NAME} is unknown)") - ENDIF(VERSION) - - # if the package was not found, but a version was given, add that to the output: - ELSE (${_NAME_UPPER}_FOUND) + IF(VERSION) + + IF(${_NAME}_FIND_VERSION_EXACT) # exact version required + IF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is exact version \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + SET(VERSION_MSG "(found suitable exact version \"${VERSION}\")") + ENDIF (NOT "${${_NAME}_FIND_VERSION}" VERSION_EQUAL "${VERSION}") + + ELSE(${_NAME}_FIND_VERSION_EXACT) # minimum version specified: + IF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG "Found unsuitable version \"${VERSION}\", but required is at least \"${${_NAME}_FIND_VERSION}\"") + SET(VERSION_OK FALSE) + ELSE ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + SET(VERSION_MSG "(found suitable version \"${VERSION}\", required is \"${${_NAME}_FIND_VERSION}\")") + ENDIF ("${${_NAME}_FIND_VERSION}" VERSION_GREATER "${VERSION}") + ENDIF(${_NAME}_FIND_VERSION_EXACT) + + ELSE(VERSION) + + # if the package was not found, but a version was given, add that to the output: IF(${_NAME}_FIND_VERSION_EXACT) - SET(VERSION_MSG " (Required is exact version \"${${_NAME}_FIND_VERSION}\")") + SET(VERSION_MSG "(Required is exact version \"${${_NAME}_FIND_VERSION}\")") ELSE(${_NAME}_FIND_VERSION_EXACT) - SET(VERSION_MSG " (Required is at least version \"${${_NAME}_FIND_VERSION}\")") + SET(VERSION_MSG "(Required is at least version \"${${_NAME}_FIND_VERSION}\")") ENDIF(${_NAME}_FIND_VERSION_EXACT) - ENDIF (${_NAME_UPPER}_FOUND) + + ENDIF(VERSION) + ELSE (${_NAME}_FIND_VERSION) + IF(VERSION) + SET(VERSION_MSG "(found version \"${VERSION}\")") + ENDIF(VERSION) ENDIF (${_NAME}_FIND_VERSION) IF(VERSION_OK) @@ -182,26 +242,16 @@ FUNCTION(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG _VAR1) IF (${_NAME_UPPER}_FOUND) FIND_PACKAGE_MESSAGE(${_NAME} "Found ${_NAME}: ${${_FIRST_REQUIRED_VAR}} ${VERSION_MSG}" "${DETAILS}") ELSE (${_NAME_UPPER}_FOUND) - IF(NOT VERSION_OK) - - IF (${_NAME}_FIND_REQUIRED) - MESSAGE(FATAL_ERROR "${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") - ELSE (${_NAME}_FIND_REQUIRED) - IF (NOT ${_NAME}_FIND_QUIETLY) - 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 "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") - ELSE (${_NAME}_FIND_REQUIRED) - IF (NOT ${_NAME}_FIND_QUIETLY) - MESSAGE(STATUS "${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") - ENDIF (NOT ${_NAME}_FIND_QUIETLY) - ENDIF (${_NAME}_FIND_REQUIRED) - ENDIF(NOT VERSION_OK) + + IF(FPHSA_CONFIG_MODE) + _FPHSA_HANDLE_FAILURE_CONFIG_MODE() + ELSE(FPHSA_CONFIG_MODE) + IF(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE}: ${VERSION_MSG} (found ${${_FIRST_REQUIRED_VAR}})") + ELSE(NOT VERSION_OK) + _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} (missing: ${MISSING_VARS}) ${VERSION_MSG}") + ENDIF(NOT VERSION_OK) + ENDIF(FPHSA_CONFIG_MODE) ENDIF (${_NAME_UPPER}_FOUND) diff --git a/Modules/Platform/Darwin.cmake b/Modules/Platform/Darwin.cmake index c8bcad1..db0642e 100644 --- a/Modules/Platform/Darwin.cmake +++ b/Modules/Platform/Darwin.cmake @@ -235,4 +235,7 @@ SET(CMAKE_SYSTEM_APPBUNDLE_PATH /Developer/Applications) INCLUDE(Platform/UnixPaths) -LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH /sw) +LIST(APPEND CMAKE_SYSTEM_PREFIX_PATH + /sw # Fink + /opt/local # MacPorts + ) diff --git a/Modules/Platform/UnixPaths.cmake b/Modules/Platform/UnixPaths.cmake index ae3c187..5ee7ddb 100644 --- a/Modules/Platform/UnixPaths.cmake +++ b/Modules/Platform/UnixPaths.cmake @@ -51,7 +51,7 @@ LIST(APPEND CMAKE_SYSTEM_INCLUDE_PATH /usr/X11R6/include /usr/include/X11 # Other - /opt/local/include /usr/pkg/include + /usr/pkg/include /opt/csw/include /opt/include /usr/openwin/include ) @@ -64,7 +64,7 @@ LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/X11R6/lib /usr/lib/X11 # Other - /opt/local/lib /usr/pkg/lib + /usr/pkg/lib /opt/csw/lib /opt/lib /usr/openwin/lib ) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 0abb0ff..7c3ff1d 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -330,6 +330,7 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( it != installDirectoriesVector.end(); ++it ) { + std::list<std::pair<std::string,std::string> > symlinkedFiles; cmCPackLogger(cmCPackLog::LOG_DEBUG, "Find files" << std::endl); cmsys::Glob gl; std::string top = it->c_str(); @@ -373,7 +374,18 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( + cmSystemTools::RelativePath(top.c_str(), gfit->c_str()); cmCPackLogger(cmCPackLog::LOG_DEBUG, "Copy file: " << inFile.c_str() << " -> " << filePath.c_str() << std::endl); - if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(), + /* If the file is a symlink we will have to re-create it */ + if ( cmSystemTools::FileIsSymlink(inFile.c_str())) + { + std::string targetFile; + std::string inFileRelative = + cmSystemTools::RelativePath(top.c_str(),inFile.c_str()); + cmSystemTools::ReadSymlink(inFile.c_str(),targetFile); + symlinkedFiles.push_back(std::pair<std::string, + std::string>(targetFile,inFileRelative)); + } + /* If it is not a symlink then do a plain copy */ + else if ( !cmSystemTools::CopyFileIfDifferent(inFile.c_str(), filePath.c_str()) ) { cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem copying file: " @@ -381,6 +393,36 @@ int cmCPackGenerator::InstallProjectViaInstalledDirectories( return 0; } } + /* rebuild symlinks in the installed tree */ + if (symlinkedFiles.size()>0) + { + std::list< std::pair<std::string,std::string> >::iterator symlinkedIt; + std::string curDir = cmSystemTools::GetCurrentWorkingDirectory(); + std::string goToDir = tempDir; + goToDir += "/"+subdir; + cmCPackLogger(cmCPackLog::LOG_DEBUG, + "Change dir to: " << goToDir <<std::endl); + cmSystemTools::ChangeDirectory(goToDir.c_str()); + for (symlinkedIt=symlinkedFiles.begin(); + symlinkedIt != symlinkedFiles.end(); + ++symlinkedIt) + { + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Will create a symlink: " + << symlinkedIt->second << "--> " + << symlinkedIt->first << std::endl); + if (!cmSystemTools::CreateSymlink((symlinkedIt->first).c_str(), + (symlinkedIt->second).c_str())) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Cannot create symlink: " + << symlinkedIt->second << "--> " + << symlinkedIt->first << std::endl); + return 0; + } + } + cmCPackLogger(cmCPackLog::LOG_DEBUG, "Going back to: " + << curDir <<std::endl); + cmSystemTools::ChangeDirectory(curDir.c_str()); + } } } return 1; diff --git a/Source/CTest/cmCTestMultiProcessHandler.cxx b/Source/CTest/cmCTestMultiProcessHandler.cxx index d50eaaa..0d14c2d 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.cxx +++ b/Source/CTest/cmCTestMultiProcessHandler.cxx @@ -516,11 +516,13 @@ void cmCTestMultiProcessHandler::PrintTestList() { this->TestHandler->SetMaxIndex(this->FindMaxIndex()); int count = 0; + for (PropertiesMap::iterator it = this->Properties.begin(); it != this->Properties.end(); ++it) { count++; cmCTestTestHandler::cmCTestTestProperties& p = *it->second; + //push working dir std::string current_dir = cmSystemTools::GetCurrentWorkingDirectory(); cmSystemTools::ChangeDirectory(p.Directory.c_str()); @@ -530,6 +532,20 @@ void cmCTestMultiProcessHandler::PrintTestList() testRun.SetTestProperties(&p); testRun.ComputeArguments(); //logs the command in verbose mode + if(p.Labels.size()) //print the labels + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, "Labels:"); + } + for(std::vector<std::string>::iterator label = p.Labels.begin(); + label != p.Labels.end(); ++label) + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, " " << *label); + } + if(p.Labels.size()) //print the labels + { + cmCTestLog(this->CTest, HANDLER_VERBOSE_OUTPUT, std::endl); + } + if (this->TestHandler->MemCheck) { cmCTestLog(this->CTest, HANDLER_OUTPUT, " Memory Check"); @@ -548,10 +564,36 @@ void cmCTestMultiProcessHandler::PrintTestList() //pop working dir cmSystemTools::ChangeDirectory(current_dir.c_str()); } + cmCTestLog(this->CTest, HANDLER_OUTPUT, std::endl << "Total Tests: " << this->Total << std::endl); } +void cmCTestMultiProcessHandler::PrintLabels() +{ + std::set<std::string> allLabels; + for (PropertiesMap::iterator it = this->Properties.begin(); + it != this->Properties.end(); ++it) + { + cmCTestTestHandler::cmCTestTestProperties& p = *it->second; + allLabels.insert(p.Labels.begin(), p.Labels.end()); + } + + if(allLabels.size()) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, "All Labels:" << std::endl); + } + else + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, "No Labels Exist" << std::endl); + } + for(std::set<std::string>::iterator label = allLabels.begin(); + label != allLabels.end(); ++label) + { + cmCTestLog(this->CTest, HANDLER_OUTPUT, " " << *label << std::endl); + } +} + //--------------------------------------------------------- void cmCTestMultiProcessHandler::CheckResume() { diff --git a/Source/CTest/cmCTestMultiProcessHandler.h b/Source/CTest/cmCTestMultiProcessHandler.h index cc330f7..1483440 100644 --- a/Source/CTest/cmCTestMultiProcessHandler.h +++ b/Source/CTest/cmCTestMultiProcessHandler.h @@ -39,6 +39,7 @@ public: void SetParallelLevel(size_t); virtual void RunTests(); void PrintTestList(); + void PrintLabels(); void SetPassFailVectors(std::vector<cmStdString>* passed, std::vector<cmStdString>* failed) diff --git a/Source/CTest/cmCTestTestHandler.cxx b/Source/CTest/cmCTestTestHandler.cxx index a4a4863..6dd348d 100644 --- a/Source/CTest/cmCTestTestHandler.cxx +++ b/Source/CTest/cmCTestTestHandler.cxx @@ -567,7 +567,7 @@ int cmCTestTestHandler::ProcessHandler() if (total == 0) { - if ( !this->CTest->GetShowOnly() ) + if ( !this->CTest->GetShowOnly() && !this->CTest->ShouldPrintLabels() ) { cmCTestLog(this->CTest, ERROR_MESSAGE, "No tests were found!!!" << std::endl); @@ -1079,7 +1079,12 @@ void cmCTestTestHandler::ProcessDirectory(std::vector<cmStdString> &passed, parallel->SetPassFailVectors(&passed, &failed); this->TestResults.clear(); parallel->SetTestResults(&this->TestResults); - if(this->CTest->GetShowOnly()) + + if(this->CTest->ShouldPrintLabels()) + { + parallel->PrintLabels(); + } + else if(this->CTest->GetShowOnly()) { parallel->PrintTestList(); } diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index d12fde0..dcdc8e1 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -304,6 +304,7 @@ cmCTest::cmCTest() this->ShowOnly = false; this->RunConfigurationScript = false; this->UseHTTP10 = false; + this->PrintLabels = false; this->CompressTestOutput = true; this->ComputedCompressOutput = false; this->TestModel = cmCTest::EXPERIMENTAL; @@ -1877,6 +1878,11 @@ void cmCTest::HandleCommandLineArguments(size_t &i, this->CompressTestOutput = false; } + if(this->CheckArgument(arg, "--print-labels")) + { + this->PrintLabels = true; + } + if(this->CheckArgument(arg, "--http1.0")) { this->UseHTTP10 = true; diff --git a/Source/cmCTest.h b/Source/cmCTest.h index 3d7d117..e54a205 100644 --- a/Source/cmCTest.h +++ b/Source/cmCTest.h @@ -210,6 +210,8 @@ public: bool ShouldUseHTTP10() { return this->UseHTTP10; } + bool ShouldPrintLabels() { return this->PrintLabels; } + bool ShouldCompressTestOutput(); std::string GetCDashVersion(); @@ -413,6 +415,7 @@ private: bool ProduceXML; bool LabelSummary; bool UseHTTP10; + bool PrintLabels; bool Failover; bool BatchJobs; diff --git a/Source/cmFindPackageCommand.cxx b/Source/cmFindPackageCommand.cxx index 5c05ecb..ef0197a 100644 --- a/Source/cmFindPackageCommand.cxx +++ b/Source/cmFindPackageCommand.cxx @@ -156,6 +156,11 @@ cmFindPackageCommand::cmFindPackageCommand() "The full path to the configuration file is stored in the cmake " "variable <package>_CONFIG." "\n" + "All configuration files which have been considered by CMake while " + "searching for an installation of the package with an appropriate " + "version are stored in the cmake variable <package>_CONSIDERED_CONFIGS, " + "the associated versions in <package>_CONSIDERED_VERSIONS. " + "\n" "If the package configuration file cannot be found CMake " "will generate an error describing the problem unless the QUIET " "argument is specified. If REQUIRED is specified and the package " @@ -618,7 +623,7 @@ void cmFindPackageCommand::SetModuleVariables(const std::string& components) // Store the list of components. std::string components_var = this->Name + "_FIND_COMPONENTS"; this->AddFindDefinition(components_var.c_str(), components.c_str()); - + if(this->Quiet) { // Tell the module that is about to be read that it should find @@ -721,6 +726,8 @@ bool cmFindPackageCommand::FindModule(bool& found) //---------------------------------------------------------------------------- bool cmFindPackageCommand::HandlePackageMode() { + this->ConsideredConfigs.clear(); + // Support old capitalization behavior. std::string upperDir = cmSystemTools::UpperCase(this->Name); std::string upperFound = cmSystemTools::UpperCase(this->Name); @@ -809,36 +816,58 @@ bool cmFindPackageCommand::HandlePackageMode() { // The variable is not set. cmOStringStream e; - e << "Could not find "; - if(!this->NoModule) - { - e << "module Find" << this->Name << ".cmake or "; - } - e << "a configuration file for package " << this->Name << ".\n"; - if(!this->NoModule) - { - e << "Adjust CMAKE_MODULE_PATH to find Find" - << this->Name << ".cmake or set "; - } - else - { - e << "Set "; - } - e << this->Variable << " to the directory containing a CMake " - << "configuration file for " << this->Name << ". "; - if(this->Configs.size() == 1) - { - e << "The file will be called " << this->Configs[0]; + // If there are files in ConsideredConfigs, it means that FooConfig.cmake + // have been found, but they didn't have appropriate versions. + if (this->ConsideredConfigs.size() > 0) + { + e << "Could not find a configuration file for package \"" + << this->Name << "\" that " + << (this->VersionExact? "exactly matches" : "is compatible with") + << " requested version \"" << this->Version << "\".\n" + << "The following configuration files were considered but not " + "accepted:\n"; + for(std::vector<ConfigFileInfo>::size_type i=0; + i<this->ConsideredConfigs.size(); i++) + { + e << " " << this->ConsideredConfigs[i].filename + << ", version: " << this->ConsideredConfigs[i].version << "\n"; + } } else { - e << "The file will have one of the following names:\n"; - for(std::vector<std::string>::const_iterator ci = this->Configs.begin(); - ci != this->Configs.end(); ++ci) + e << "Could not find "; + if(!this->NoModule) + { + e << "module Find" << this->Name << ".cmake or "; + } + e << "a configuration file for package " << this->Name << ".\n"; + if(!this->NoModule) + { + e << "Adjust CMAKE_MODULE_PATH to find Find" + << this->Name << ".cmake or set "; + } + else + { + e << "Set "; + } + e << this->Variable << " to the directory containing a CMake " + << "configuration file for " << this->Name << ". "; + if(this->Configs.size() == 1) + { + e << "The file will be called " << this->Configs[0]; + } + else { - e << " " << *ci << "\n"; + e << "The file will have one of the following names:\n"; + for(std::vector<std::string>::const_iterator ci=this->Configs.begin(); + ci != this->Configs.end(); ++ci) + { + e << " " << *ci << "\n"; + } } } + + this->Makefile->IssueMessage( this->Required? cmake::FATAL_ERROR : cmake::WARNING, e.str()); } @@ -897,6 +926,31 @@ bool cmFindPackageCommand::HandlePackageMode() } #endif + std::string consideredConfigsVar = this->Name; + consideredConfigsVar += "_CONSIDERED_CONFIGS"; + std::string consideredVersionsVar = this->Name; + consideredVersionsVar += "_CONSIDERED_VERSIONS"; + + std::string consideredConfigFiles; + std::string consideredVersions; + + const char* sep = ""; + for(std::vector<ConfigFileInfo>::size_type i=0; + i<this->ConsideredConfigs.size(); i++) + { + consideredConfigFiles += sep; + consideredVersions += sep; + consideredConfigFiles += this->ConsideredConfigs[i].filename; + consideredVersions += this->ConsideredConfigs[i].version; + sep = ";"; + } + + this->Makefile->AddDefinition(consideredConfigsVar.c_str(), + consideredConfigFiles.c_str()); + + this->Makefile->AddDefinition(consideredVersionsVar.c_str(), + consideredVersions.c_str()); + return result; } @@ -1481,6 +1535,10 @@ bool cmFindPackageCommand::FindConfigFile(std::string const& dir, //---------------------------------------------------------------------------- bool cmFindPackageCommand::CheckVersion(std::string const& config_file) { + bool result = false; // by default, assume the version is not ok. + bool haveResult = false; + std::string version = "unknown"; + // Get the filename without the .cmake extension. std::string::size_type pos = config_file.rfind('.'); std::string version_file_base = config_file.substr(0, pos); @@ -1488,31 +1546,42 @@ bool cmFindPackageCommand::CheckVersion(std::string const& config_file) // Look for foo-config-version.cmake std::string version_file = version_file_base; version_file += "-version.cmake"; - if(cmSystemTools::FileExists(version_file.c_str(), true)) + if ((haveResult == false) + && (cmSystemTools::FileExists(version_file.c_str(), true))) { - return this->CheckVersionFile(version_file); + result = this->CheckVersionFile(version_file, version); + haveResult = true; } // Look for fooConfigVersion.cmake version_file = version_file_base; version_file += "Version.cmake"; - if(cmSystemTools::FileExists(version_file.c_str(), true)) + if ((haveResult == false) + && (cmSystemTools::FileExists(version_file.c_str(), true))) { - return this->CheckVersionFile(version_file); + result = this->CheckVersionFile(version_file, version); + haveResult = true; } + // If no version was requested a versionless package is acceptable. - if(this->Version.empty()) + if ((haveResult == false) && (this->Version.empty())) { - return true; + result = true; + haveResult = true; } - // No version file found. Assume the version is incompatible. - return false; + ConfigFileInfo configFileInfo; + configFileInfo.filename = config_file; + configFileInfo.version = version; + this->ConsideredConfigs.push_back(configFileInfo); + + return result; } //---------------------------------------------------------------------------- -bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file) +bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file, + std::string& result_version) { // The version file will be loaded in an isolated scope. cmMakefile::ScopePushPop varScope(this->Makefile); @@ -1585,6 +1654,12 @@ bool cmFindPackageCommand::CheckVersionFile(std::string const& version_file) } } + result_version = this->Makefile->GetSafeDefinition("PACKAGE_VERSION"); + if (result_version.empty()) + { + result_version = "unknown"; + } + // Succeed if the version is suitable. return suitable; } diff --git a/Source/cmFindPackageCommand.h b/Source/cmFindPackageCommand.h index 53ea4fc..57aeab9 100644 --- a/Source/cmFindPackageCommand.h +++ b/Source/cmFindPackageCommand.h @@ -98,7 +98,8 @@ private: bool CheckDirectory(std::string const& dir); bool FindConfigFile(std::string const& dir, std::string& file); bool CheckVersion(std::string const& config_file); - bool CheckVersionFile(std::string const& version_file); + bool CheckVersionFile(std::string const& version_file, + std::string& result_version); bool SearchPrefix(std::string const& prefix); bool SearchFrameworkPrefix(std::string const& prefix_in); bool SearchAppBundlePrefix(std::string const& prefix_in); @@ -137,6 +138,9 @@ private: std::vector<std::string> Names; std::vector<std::string> Configs; std::set<std::string> IgnoredPaths; + + struct ConfigFileInfo { std::string filename; std::string version; }; + std::vector<ConfigFileInfo> ConsideredConfigs; }; #endif diff --git a/Source/ctest.cxx b/Source/ctest.cxx index 24921c4..3937d8d 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -152,7 +152,7 @@ static const char * cmDocumentationOptions[][3] = "popups and interactive " "debugging."}, {"--no-label-summary", "Disable timing summary information for labels.", - "This option tells ctest to not print summary information for each label " + "This option tells ctest not to print summary information for each label " "associated with the tests run. If there are no labels on the " "tests, nothing extra is printed."}, {"--build-and-test", "Configure, build and run a test.", @@ -229,6 +229,9 @@ static const char * cmDocumentationOptions[][3] = "This flag will turn off automatic compression of test output. Use this " "to maintain compatibility with an older version of CDash which doesn't " "support compressed test output."}, + {"--print-labels", "Print all available test labels.", + "This option will not run any tests, it will simply print the list of " + "all labels associated with the test set."}, {"--help-command <cmd> [<file>]", "Show help for a single command and exit.", "Prints the help for the command to stdout or to the specified file." }, {"--help-command-list [<file>]", "List available commands and exit.", diff --git a/Source/kwsys/kwsysDateStamp.cmake b/Source/kwsys/kwsysDateStamp.cmake index df9690a..5816ea8 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 09) # KWSys version date day component. Format is DD. -SET(KWSYS_DATE_STAMP_DAY 02) +SET(KWSYS_DATE_STAMP_DAY 08) diff --git a/Tests/CMakeLists.txt b/Tests/CMakeLists.txt index 5383bda..8e8d0ca 100644 --- a/Tests/CMakeLists.txt +++ b/Tests/CMakeLists.txt @@ -1315,6 +1315,11 @@ ${CMake_BINARY_DIR}/bin/cmake -DVERSION=master -P ${CMake_SOURCE_DIR}/Utilities/ --output-log "${CMake_BINARY_DIR}/Tests/CTestTestParallel/testOutput.log" ) + ADD_TEST(CTestTestPrintLabels ${CMAKE_CTEST_COMMAND} --print-labels) + SET_TESTS_PROPERTIES(CTestTestPrintLabels PROPERTIES LABELS "Label1;Label2") + SET_TESTS_PROPERTIES(CTestTestPrintLabels PROPERTIES PASS_REGULAR_EXPRESSION + "All Labels:.* Label1.* Label2") + CONFIGURE_FILE( "${CMake_SOURCE_DIR}/Tests/CTestTestResourceLock/test.cmake.in" "${CMake_BINARY_DIR}/Tests/CTestTestResourceLock/test.cmake" |