diff options
51 files changed, 415 insertions, 107 deletions
diff --git a/Help/command/ctest_test.rst b/Help/command/ctest_test.rst index 162db69..412e323 100644 --- a/Help/command/ctest_test.rst +++ b/Help/command/ctest_test.rst @@ -85,3 +85,6 @@ The options are: been printed to the console. Output from the underlying test command is not affected. Summary info detailing the percentage of passing tests is also unaffected by the ``QUIET`` option. + +See also the :variable:`CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE` +and :variable:`CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE` variables. diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index e0dbdeb..660d544 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -374,6 +374,8 @@ Variables for CTest /variable/CTEST_COVERAGE_COMMAND /variable/CTEST_COVERAGE_EXTRA_FLAGS /variable/CTEST_CURL_OPTIONS + /variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE + /variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE /variable/CTEST_CVS_CHECKOUT /variable/CTEST_CVS_COMMAND /variable/CTEST_CVS_UPDATE_OPTIONS diff --git a/Help/manual/ctest.1.rst b/Help/manual/ctest.1.rst index 50c856a..2fdf7f3 100644 --- a/Help/manual/ctest.1.rst +++ b/Help/manual/ctest.1.rst @@ -302,6 +302,12 @@ Options ``--test-command`` The test to run with the --build-and-test option. +``--test-output-size-passed <size>`` + Limit the output for passed tests to <size> bytes. + +``--test-output-size-failed <size>`` + Limit the output for failed tests to <size> bytes. + ``--test-timeout`` The time limit in seconds, internal use only. diff --git a/Help/release/dev/CPack-updates.rst b/Help/release/dev/CPack-updates.rst index 7ac1ed7..ea0780f 100644 --- a/Help/release/dev/CPack-updates.rst +++ b/Help/release/dev/CPack-updates.rst @@ -4,3 +4,8 @@ CPack-updates * The :module:`CPack` module no longer mangles settings with CMake-special characters when they're used as defaults for other settings. The macro ``cpack_set_if_not_set``, which was responsible for this, is now deprecated. + +* The :module:`CPack` module gained a new setting, ``CPACK_VERBATIM_VARIABLES``, + which can be used to ensure the cpack program receives the settings' values + exactly as they were set, even if they contain CMake-special characters. + For compatibility, it's off by default. diff --git a/Help/release/dev/cpack-deb-checksum-on-symlinks.rts b/Help/release/dev/cpack-deb-checksum-on-symlinks.rts new file mode 100644 index 0000000..9bfeded --- /dev/null +++ b/Help/release/dev/cpack-deb-checksum-on-symlinks.rts @@ -0,0 +1,4 @@ +cpack-deb-checksum-on-symlinks +------------------------------ + +* The :module:`CPackDeb` module now correctly excludes symlinks during package checksum calculation. diff --git a/Help/release/dev/ctest-custom-output-size.rst b/Help/release/dev/ctest-custom-output-size.rst new file mode 100644 index 0000000..8098b93 --- /dev/null +++ b/Help/release/dev/ctest-custom-output-size.rst @@ -0,0 +1,7 @@ +ctest-custom-output-size +------------------------ + +* :manual:`ctest(1)` learned options + ``--test-output-size-passed`` and ``--test-output-size-failed`` + to customize the limit on test output size submitted when + running as a :ref:`Dashboard Client`. diff --git a/Help/release/dev/pkg-config-variable-function.rst b/Help/release/dev/pkg-config-variable-function.rst new file mode 100644 index 0000000..e181d13 --- /dev/null +++ b/Help/release/dev/pkg-config-variable-function.rst @@ -0,0 +1,6 @@ +pkg-config-variable-function +---------------------------- + +* The :module:`FindPkgConfig` learned a new :command:`pkg_get_variable` + command which may be used to query for arbitrary variables from a package + (such as for related tools or data and plugin install paths). diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst new file mode 100644 index 0000000..1b4bb01 --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE.rst @@ -0,0 +1,6 @@ +CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE +-------------------------------------------- + +Specify the maximum amount of output from a failed test that will +be collected by the :command:`ctest_test` command. If not set, +the default is 300 KiB. diff --git a/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst new file mode 100644 index 0000000..168e84e --- /dev/null +++ b/Help/variable/CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE.rst @@ -0,0 +1,6 @@ +CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE +-------------------------------------------- + +Specify the maximum amount of output from a passed test that will +be collected by the :command:`ctest_test` command. If not set, +the default is 1 KiB. diff --git a/Modules/CMakeCCompiler.cmake.in b/Modules/CMakeCCompiler.cmake.in index 2ad2f34..c72e338 100644 --- a/Modules/CMakeCCompiler.cmake.in +++ b/Modules/CMakeCCompiler.cmake.in @@ -53,12 +53,14 @@ if(CMAKE_C_LIBRARY_ARCHITECTURE) set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_C_LIBRARY_ARCHITECTURE@") endif() +set(CMAKE_C_CL_SHOWINCLUDES_PREFIX "@CMAKE_C_CL_SHOWINCLUDES_PREFIX@") +if(CMAKE_C_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_C_CL_SHOWINCLUDES_PREFIX}") +endif() + @CMAKE_C_SYSROOT_FLAG_CODE@ @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@") set(CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_C_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") - -@SET_CMAKE_CMCLDEPS_EXECUTABLE@ -@SET_CMAKE_CL_SHOWINCLUDES_PREFIX@ diff --git a/Modules/CMakeCXXCompiler.cmake.in b/Modules/CMakeCXXCompiler.cmake.in index c6582a7..52e44f6 100644 --- a/Modules/CMakeCXXCompiler.cmake.in +++ b/Modules/CMakeCXXCompiler.cmake.in @@ -54,12 +54,14 @@ if(CMAKE_CXX_LIBRARY_ARCHITECTURE) set(CMAKE_LIBRARY_ARCHITECTURE "@CMAKE_CXX_LIBRARY_ARCHITECTURE@") endif() +set(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX "@CMAKE_CXX_CL_SHOWINCLUDES_PREFIX@") +if(CMAKE_CXX_CL_SHOWINCLUDES_PREFIX) + set(CMAKE_CL_SHOWINCLUDES_PREFIX "${CMAKE_CXX_CL_SHOWINCLUDES_PREFIX}") +endif() + @CMAKE_CXX_SYSROOT_FLAG_CODE@ @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@") set(CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES "@CMAKE_CXX_IMPLICIT_LINK_FRAMEWORK_DIRECTORIES@") - -@SET_CMAKE_CMCLDEPS_EXECUTABLE@ -@SET_CMAKE_CL_SHOWINCLUDES_PREFIX@ diff --git a/Modules/CMakeClDeps.cmake b/Modules/CMakeClDeps.cmake deleted file mode 100644 index b46e7c2..0000000 --- a/Modules/CMakeClDeps.cmake +++ /dev/null @@ -1,34 +0,0 @@ - -#============================================================================= -# Copyright 2012 Kitware, Inc. -# -# Distributed under the OSI-approved BSD License (the "License"); -# see accompanying file Copyright.txt for details. -# -# This software is distributed WITHOUT ANY WARRANTY; without even the -# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. -# See the License for more information. -#============================================================================= -# (To distribute this file outside of CMake, substitute the full -# License text for the above reference.) - -# -# When using Ninja cl.exe is wrapped by cmcldeps to extract the included -# headers for dependency tracking. -# -# cmcldeps path is set, and cmcldeps needs to know the localized string -# in front of each include path, so it can remove it. -# - -if(CMAKE_GENERATOR MATCHES "Ninja" AND CMAKE_C_COMPILER AND CMAKE_COMMAND) - string(REPLACE "cmake.exe" "cmcldeps.exe" CMAKE_CMCLDEPS_EXECUTABLE ${CMAKE_COMMAND}) - set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes) - file(WRITE ${showdir}/foo.h "\n") - file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n") - execute_process(COMMAND ${CMAKE_C_COMPILER} /nologo /showIncludes ${showdir}/main.c - WORKING_DIRECTORY ${showdir} OUTPUT_VARIABLE outLine) - string(REGEX MATCH "\n([^:]*:[^:]*:[ \t]*)" tmp "${outLine}") - set(localizedPrefix "${CMAKE_MATCH_1}") - set(SET_CMAKE_CMCLDEPS_EXECUTABLE "set(CMAKE_CMCLDEPS_EXECUTABLE \"${CMAKE_CMCLDEPS_EXECUTABLE}\")") - set(SET_CMAKE_CL_SHOWINCLUDES_PREFIX "set(CMAKE_CL_SHOWINCLUDES_PREFIX \"${localizedPrefix}\")") -endif() diff --git a/Modules/CMakeDetermineCCompiler.cmake b/Modules/CMakeDetermineCCompiler.cmake index 9bd1d67..4b0d278 100644 --- a/Modules/CMakeDetermineCCompiler.cmake +++ b/Modules/CMakeDetermineCCompiler.cmake @@ -173,7 +173,6 @@ endif () include(CMakeFindBinUtils) if(MSVC_C_ARCHITECTURE_ID) - include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) set(SET_MSVC_C_ARCHITECTURE_ID "set(MSVC_C_ARCHITECTURE_ID ${MSVC_C_ARCHITECTURE_ID})") endif() diff --git a/Modules/CMakeDetermineCXXCompiler.cmake b/Modules/CMakeDetermineCXXCompiler.cmake index f25a2db..680356d 100644 --- a/Modules/CMakeDetermineCXXCompiler.cmake +++ b/Modules/CMakeDetermineCXXCompiler.cmake @@ -171,7 +171,6 @@ endif () include(CMakeFindBinUtils) if(MSVC_CXX_ARCHITECTURE_ID) - include(${CMAKE_ROOT}/Modules/CMakeClDeps.cmake) set(SET_MSVC_CXX_ARCHITECTURE_ID "set(MSVC_CXX_ARCHITECTURE_ID ${MSVC_CXX_ARCHITECTURE_ID})") endif() diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 81f4ae6..df6daf3 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -75,6 +75,12 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) set(CMAKE_EXECUTABLE_FORMAT "Unknown" CACHE INTERNAL "Executable file format") endif() + if(CMAKE_GENERATOR STREQUAL "Ninja" AND MSVC_${lang}_ARCHITECTURE_ID) + CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX(${lang}) + else() + set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "") + endif() + # Display the final identification result. if(CMAKE_${lang}_COMPILER_ID) if(CMAKE_${lang}_COMPILER_VERSION) @@ -99,6 +105,7 @@ function(CMAKE_DETERMINE_COMPILER_ID lang flagvar src) set(CMAKE_${lang}_PLATFORM_ID "${CMAKE_${lang}_PLATFORM_ID}" PARENT_SCOPE) set(MSVC_${lang}_ARCHITECTURE_ID "${MSVC_${lang}_ARCHITECTURE_ID}" PARENT_SCOPE) + set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX}" PARENT_SCOPE) set(CMAKE_${lang}_COMPILER_VERSION "${CMAKE_${lang}_COMPILER_VERSION}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_ID "${CMAKE_${lang}_SIMULATE_ID}" PARENT_SCOPE) set(CMAKE_${lang}_SIMULATE_VERSION "${CMAKE_${lang}_SIMULATE_VERSION}" PARENT_SCOPE) @@ -314,29 +321,17 @@ Id flags: ${testflags} endif() endif() else() - if(COMMAND EXECUTE_PROCESS) - execute_process( - COMMAND "${CMAKE_${lang}_COMPILER}" - ${CMAKE_${lang}_COMPILER_ID_ARG1} - ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} - ${testflags} - "${src}" - WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} - OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT - ) - else() - exec_program( - "${CMAKE_${lang}_COMPILER}" ${CMAKE_${lang}_COMPILER_ID_DIR} - ARGS ${CMAKE_${lang}_COMPILER_ID_ARG1} - ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} - ${testflags} - \"${src}\" - OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT - RETURN_VALUE CMAKE_${lang}_COMPILER_ID_RESULT - ) - endif() + execute_process( + COMMAND "${CMAKE_${lang}_COMPILER}" + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + ${testflags} + "${src}" + WORKING_DIRECTORY ${CMAKE_${lang}_COMPILER_ID_DIR} + OUTPUT_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + ERROR_VARIABLE CMAKE_${lang}_COMPILER_ID_OUTPUT + RESULT_VARIABLE CMAKE_${lang}_COMPILER_ID_RESULT + ) endif() # Check the result of compilation. @@ -650,3 +645,27 @@ function(CMAKE_DETERMINE_COMPILER_ID_VENDOR lang) endif() endforeach() endfunction() + +function(CMAKE_DETERMINE_MSVC_SHOWINCLUDES_PREFIX lang) + # Run this MSVC-compatible compiler to detect what the /showIncludes + # option displays. We can use a C source even with the C++ compiler + # because MSVC-compatible compilers handle both and show the same output. + set(showdir ${CMAKE_BINARY_DIR}/CMakeFiles/ShowIncludes) + file(WRITE ${showdir}/foo.h "\n") + file(WRITE ${showdir}/main.c "#include \"foo.h\" \nint main(){}\n") + execute_process( + COMMAND "${CMAKE_${lang}_COMPILER}" + ${CMAKE_${lang}_COMPILER_ID_ARG1} + ${CMAKE_${lang}_COMPILER_ID_FLAGS_LIST} + /nologo /showIncludes /c main.c + WORKING_DIRECTORY ${showdir} + OUTPUT_VARIABLE out + ERROR_VARIABLE err + RESULT_VARIABLE res + ) + if(res EQUAL 0 AND "${out}" MATCHES "\n([^:]*:[^:]*:[ \t]*)") + set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "${CMAKE_MATCH_1}" PARENT_SCOPE) + else() + set(CMAKE_${lang}_CL_SHOWINCLUDES_PREFIX "" PARENT_SCOPE) + endif() +endfunction() diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 7d6d54c..5756001 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -182,6 +182,17 @@ # will be a boolean variable which enables stripping of all files (a list # of files evaluates to TRUE in CMake, so this change is compatible). # +# .. variable:: CPACK_VERBATIM_VARIABLES +# +# If set to TRUE, values of variables prefixed with CPACK_ will be escaped +# before being written to the configuration files, so that the cpack program +# receives them exactly as they were specified. If not, characters like quotes +# and backslashes can cause parsing errors or alter the value received by the +# cpack program. Defaults to FALSE for backwards compatibility. +# +# * Mandatory : NO +# * Default : FALSE +# # The following CPack variables are specific to source packages, and # will not affect binary packages: # @@ -305,21 +316,28 @@ macro(cpack_set_if_not_set name value) _cpack_set_default("${name}" "${value}") endmacro() -# cpack_encode_variables - Macro to encode variables for the configuration file +# cpack_encode_variables - Function to encode variables for the configuration file # find any variable that starts with CPACK and create a variable # _CPACK_OTHER_VARIABLES_ that contains SET commands for # each cpack variable. _CPACK_OTHER_VARIABLES_ is then # used as an @ replacment in configure_file for the CPackConfig. -macro(cpack_encode_variables) - set(_CPACK_OTHER_VARIABLES_) +function(cpack_encode_variables) + set(commands "") get_cmake_property(res VARIABLES) foreach(var ${res}) if(var MATCHES "^CPACK") - set(_CPACK_OTHER_VARIABLES_ - "${_CPACK_OTHER_VARIABLES_}\nSET(${var} \"${${var}}\")") + if(CPACK_VERBATIM_VARIABLES) + _cpack_escape_for_cmake(value "${${var}}") + else() + set(value "${${var}}") endif() + + set(commands "${commands}\nSET(${var} \"${value}\")") + endif() endforeach() -endmacro() + + set(_CPACK_OTHER_VARIABLES_ "${commands}" PARENT_SCOPE) +endfunction() # Internal use functions function(_cpack_set_default name value) @@ -328,6 +346,11 @@ function(_cpack_set_default name value) endif() endfunction() +function(_cpack_escape_for_cmake var value) + string(REGEX REPLACE "([\\\$\"])" "\\\\\\1" escaped "${value}") + set("${var}" "${escaped}" PARENT_SCOPE) +endfunction() + # Set the package name _cpack_set_default(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}") _cpack_set_default(CPACK_PACKAGE_VERSION_MAJOR "0") @@ -608,8 +631,15 @@ _cpack_set_default(CPACK_SOURCE_INSTALLED_DIRECTORIES _cpack_set_default(CPACK_SOURCE_TOPLEVEL_TAG "${CPACK_SYSTEM_NAME}-Source") _cpack_set_default(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}-Source") -_cpack_set_default(CPACK_SOURCE_IGNORE_FILES - "/CVS/;/\\\\.svn/;/\\\\.bzr/;/\\\\.hg/;/\\\\.git/;\\\\.swp$;\\\\.#;/#") + +set(__cpack_source_ignore_files_default + "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#") +if(NOT CPACK_VERBATIM_VARIABLES) + _cpack_escape_for_cmake(__cpack_source_ignore_files_default + "${__cpack_source_ignore_files_default}") +endif() +_cpack_set_default(CPACK_SOURCE_IGNORE_FILES "${__cpack_source_ignore_files_default}") + set(CPACK_INSTALL_CMAKE_PROJECTS "${CPACK_SOURCE_INSTALL_CMAKE_PROJECTS}") set(CPACK_INSTALLED_DIRECTORIES "${CPACK_SOURCE_INSTALLED_DIRECTORIES}") set(CPACK_GENERATOR "${CPACK_SOURCE_GENERATOR}") diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index ae6903e..e822b9c 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -70,14 +70,14 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) execute_process( COMMAND ${PKG_CONFIG_EXECUTABLE} ${ARGN} ${_pkglist} OUTPUT_VARIABLE _pkgconfig_invoke_result - RESULT_VARIABLE _pkgconfig_failed) + RESULT_VARIABLE _pkgconfig_failed + OUTPUT_STRIP_TRAILING_WHITESPACE) if (_pkgconfig_failed) set(_pkgconfig_${_varname} "") _pkgconfig_unset(${_prefix}_${_varname}) else() string(REGEX REPLACE "[\r\n]" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") - string(REGEX REPLACE " +$" "" _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") if (NOT ${_regexp} STREQUAL "") string(REGEX REPLACE "${_regexp}" " " _pkgconfig_invoke_result "${_pkgconfig_invoke_result}") @@ -91,6 +91,26 @@ macro(_pkgconfig_invoke _pkglist _prefix _varname _regexp) endif() endmacro() +#[========================================[.rst: +.. command:: pkg_get_variable + + Retrieves the value of a variable from a package:: + + pkg_get_variable(<RESULT> <MODULE> <VARIABLE>) + + For example: + + .. code-block:: cmake + + pkg_get_variable(GI_GIRDIR gobject-introspection-1.0 girdir) +#]========================================] +function (pkg_get_variable result pkg variable) + _pkgconfig_invoke("${pkg}" "prefix" "result" "" "--variable=${variable}") + set("${result}" + "${prefix_result}" + PARENT_SCOPE) +endfunction () + # Invokes pkgconfig two times; once without '--static' and once with # '--static' macro(_pkgconfig_invoke_dyn _pkglist _prefix _varname cleanup_regexp) @@ -356,9 +376,9 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma endif() _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" VERSION "" --modversion ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" PREFIX "" --variable=prefix ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" INCLUDEDIR "" --variable=includedir ) - _pkgconfig_invoke(${_pkg_check_modules_pkg} "${_pkg_check_prefix}" LIBDIR "" --variable=libdir ) + pkg_get_variable("${_pkg_check_prefix}_PREFIX" ${_pkg_check_modules_pkg} "prefix") + pkg_get_variable("${_pkg_check_prefix}_INCLUDEDIR" ${_pkg_check_modules_pkg} "includedir") + pkg_get_variable("${_pkg_check_prefix}_LIBDIR" ${_pkg_check_modules_pkg} "libdir") if (NOT ${_is_silent}) message(STATUS " Found ${_pkg_check_modules_pkg}, version ${_pkgconfig_VERSION}") diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e6f60f1..e43b424 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,5 +1,5 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 3) -set(CMake_VERSION_PATCH 20150918) +set(CMake_VERSION_PATCH 20150922) #set(CMake_VERSION_RC 1) diff --git a/Source/CPack/cmCPackDebGenerator.cxx b/Source/CPack/cmCPackDebGenerator.cxx index 9402689..5cdab52 100644 --- a/Source/CPack/cmCPackDebGenerator.cxx +++ b/Source/CPack/cmCPackDebGenerator.cxx @@ -524,21 +524,24 @@ int cmCPackDebGenerator::createDeb() packageFiles.begin(); fileIt != packageFiles.end(); ++ fileIt ) { - std::string cmd = "\""; - cmd += cmSystemTools::GetCMakeCommand(); - cmd += "\" -E md5sum \""; - cmd += *fileIt; - cmd += "\""; - - std::string output; - int retval = -1; - int res = cmSystemTools::RunSingleCommand(cmd.c_str(), &output, &output, - &retval, toplevel.c_str(), this->GeneratorVerbose, 0); - if ( !res || retval ) + // hash only regular files + if( cmSystemTools::FileIsDirectory(*fileIt) + || cmSystemTools::FileIsSymlink(*fileIt)) { - cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem running cmake -E md5sum " - << cmd << std::endl); + continue; } + + char md5sum[33]; + if(!cmSystemTools::ComputeFileMD5(*fileIt, md5sum)) + { + cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem computing the md5 of " + << *fileIt << std::endl); + } + + md5sum[32] = 0; + + std::string output(md5sum); + output += " " + *fileIt + "\n"; // debian md5sums entries are like this: // 014f3604694729f3bf19263bac599765 usr/bin/ccmake // thus strip the full path (with the trailing slash) diff --git a/Source/CTest/cmCTestTestHandler.h b/Source/CTest/cmCTestTestHandler.h index 14067d5..c635430 100644 --- a/Source/CTest/cmCTestTestHandler.h +++ b/Source/CTest/cmCTestTestHandler.h @@ -65,6 +65,11 @@ public: void SetMaxIndex(int n) {this->MaxIndex = n;} int GetMaxIndex() {return this->MaxIndex;} + void SetTestOutputSizePassed(int n) + { this->CustomMaximumPassedTestOutputSize = n; } + void SetTestOutputSizeFailed(int n) + { this->CustomMaximumFailedTestOutputSize = n; } + ///! pass the -I argument down void SetTestsToRunInformation(const char*); diff --git a/Source/cmCTest.cxx b/Source/cmCTest.cxx index b2ad4a8..6e55d89 100644 --- a/Source/cmCTest.cxx +++ b/Source/cmCTest.cxx @@ -2165,7 +2165,46 @@ bool cmCTest::HandleCommandLineArguments(size_t &i, { this->OutputTestOutputOnTestFailure = true; } - + if (this->CheckArgument(arg, "--test-output-size-passed") && + i < args.size() - 1) + { + i++; + long outputSize; + if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) + { + if (cmCTestTestHandler *pCTestTestHandler = + static_cast<cmCTestTestHandler*>(this->TestingHandlers["test"])) + { + pCTestTestHandler->SetTestOutputSizePassed(int(outputSize)); + } + } + else + { + cmCTestLog(this, WARNING, + "Invalid value for '--test-output-size-passed': " << + args[i] << "\n"); + } + } + if (this->CheckArgument(arg, "--test-output-size-failed") && + i < args.size() - 1) + { + i++; + long outputSize; + if (cmSystemTools::StringToLong(args[i].c_str(), &outputSize)) + { + if (cmCTestTestHandler *pCTestTestHandler = + static_cast<cmCTestTestHandler*>(this->TestingHandlers["test"])) + { + pCTestTestHandler->SetTestOutputSizeFailed(int(outputSize)); + } + } + else + { + cmCTestLog(this, WARNING, + "Invalid value for '--test-output-size-failed': " << + args[i] << "\n"); + } + } if(this->CheckArgument(arg, "-N", "--show-only")) { this->ShowOnly = true; diff --git a/Source/cmGeneratorTarget.cxx b/Source/cmGeneratorTarget.cxx index fb5805b..555c437 100644 --- a/Source/cmGeneratorTarget.cxx +++ b/Source/cmGeneratorTarget.cxx @@ -2218,7 +2218,7 @@ cmGeneratorTarget::GetIncludeDirectories(const std::string& config, "INCLUDE_DIRECTORIES") != debugProperties.end(); - if (this->Makefile->IsConfigured()) + if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugIncludesDone = true; } @@ -2365,7 +2365,7 @@ void cmGeneratorTarget::GetCompileOptions(std::vector<std::string> &result, "COMPILE_OPTIONS") != debugProperties.end(); - if (this->Makefile->IsConfigured()) + if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompileOptionsDone = true; } @@ -2435,7 +2435,7 @@ void cmGeneratorTarget::GetCompileFeatures(std::vector<std::string> &result, "COMPILE_FEATURES") != debugProperties.end(); - if (this->Makefile->IsConfigured()) + if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompileFeaturesDone = true; } @@ -2503,7 +2503,7 @@ void cmGeneratorTarget::GetCompileDefinitions(std::vector<std::string> &list, "COMPILE_DEFINITIONS") != debugProperties.end(); - if (this->Makefile->IsConfigured()) + if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompileDefinitionsDone = true; } @@ -3937,7 +3937,7 @@ cmGeneratorTarget::ReportPropertyOrigin(const std::string &p, p) != debugProperties.end(); - if (this->Target->GetMakefile()->IsConfigured()) + if (this->GlobalGenerator->GetConfigureDoneCMP0026()) { this->DebugCompatiblePropertiesDone[p] = true; } @@ -4504,7 +4504,7 @@ void cmGeneratorTarget::GetLanguages(std::set<std::string>& languages, std::vector<cmGeneratorTarget*> objectLibraries; std::vector<cmSourceFile const*> externalObjects; - if (!this->Makefile->IsConfigured()) + if (!this->GlobalGenerator->GetConfigureDoneCMP0026()) { std::vector<cmTarget*> objectTargets; this->Target->GetObjectLibrariesCMP0026(objectTargets); diff --git a/Source/cmGlobalGenerator.cxx b/Source/cmGlobalGenerator.cxx index 33b04ac..7aa8bb6 100644 --- a/Source/cmGlobalGenerator.cxx +++ b/Source/cmGlobalGenerator.cxx @@ -72,6 +72,8 @@ cmGlobalGenerator::cmGlobalGenerator(cmake* cm) this->ExtraGenerator = 0; this->CurrentMakefile = 0; this->TryCompileOuterMakefile = 0; + + this->ConfigureDoneCMP0026 = false; } cmGlobalGenerator::~cmGlobalGenerator() @@ -1110,9 +1112,12 @@ void cmGlobalGenerator::Configure() this->CMakeInstance->GetHomeOutputDirectory()); // now do it + this->ConfigureDoneCMP0026 = false; dirMf->Configure(); dirMf->EnforceDirectoryLevelRules(); + this->ConfigureDoneCMP0026 = true; + // Put a copy of each global target in every directory. cmTargets globalTargets; this->CreateDefaultGlobalTargets(&globalTargets); diff --git a/Source/cmGlobalGenerator.h b/Source/cmGlobalGenerator.h index 9fc2d45..40f98dc 100644 --- a/Source/cmGlobalGenerator.h +++ b/Source/cmGlobalGenerator.h @@ -363,6 +363,8 @@ public: cmFileLockPool& GetFileLockPool() { return FileLockPool; } #endif + bool GetConfigureDoneCMP0026() const { return this->ConfigureDoneCMP0026; } + std::string MakeSilentFlag; protected: typedef std::vector<cmLocalGenerator*> GeneratorVector; @@ -520,6 +522,7 @@ protected: bool ForceUnixPaths; bool ToolSupportsColor; bool InstallTargetEnabled; + bool ConfigureDoneCMP0026; }; #endif diff --git a/Source/cmLocalGenerator.cxx b/Source/cmLocalGenerator.cxx index 97a9f1e..4418ead 100644 --- a/Source/cmLocalGenerator.cxx +++ b/Source/cmLocalGenerator.cxx @@ -2850,7 +2850,7 @@ cmIML_INT_uint64_t cmLocalGenerator::GetBackwardsCompatibility() } } this->BackwardsCompatibility = CMake_VERSION_ENCODE(major, minor, patch); - this->BackwardsCompatibilityFinal = this->Makefile->IsConfigured(); + this->BackwardsCompatibilityFinal = true; } return this->BackwardsCompatibility; diff --git a/Source/cmNinjaTargetGenerator.cxx b/Source/cmNinjaTargetGenerator.cxx index 752c8a7..f46c5b9 100644 --- a/Source/cmNinjaTargetGenerator.cxx +++ b/Source/cmNinjaTargetGenerator.cxx @@ -371,7 +371,7 @@ cmNinjaTargetGenerator mf->GetSafeDefinition("CMAKE_C_COMPILER") : mf->GetSafeDefinition("CMAKE_CXX_COMPILER"); cldeps = "\""; - cldeps += mf->GetSafeDefinition("CMAKE_CMCLDEPS_EXECUTABLE"); + cldeps += cmSystemTools::GetCMClDepsCommand(); cldeps += "\" " + lang + " $in \"$DEP_FILE\" $out \""; cldeps += mf->GetSafeDefinition("CMAKE_CL_SHOWINCLUDES_PREFIX"); cldeps += "\" \"" + cl + "\" "; diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 005a803..2675066 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -2216,6 +2216,7 @@ static std::string cmSystemToolsCTestCommand; static std::string cmSystemToolsCPackCommand; static std::string cmSystemToolsCMakeCursesCommand; static std::string cmSystemToolsCMakeGUICommand; +static std::string cmSystemToolsCMClDepsCommand; static std::string cmSystemToolsCMakeRoot; void cmSystemTools::FindCMakeResources(const char* argv0) { @@ -2308,6 +2309,13 @@ void cmSystemTools::FindCMakeResources(const char* argv0) { cmSystemToolsCMakeCursesCommand = ""; } + cmSystemToolsCMClDepsCommand = exe_dir; + cmSystemToolsCMClDepsCommand += "/cmcldeps"; + cmSystemToolsCMClDepsCommand += cmSystemTools::GetExecutableExtension(); + if(!cmSystemTools::FileExists(cmSystemToolsCMClDepsCommand.c_str())) + { + cmSystemToolsCMClDepsCommand = ""; + } #ifdef CMAKE_BUILD_WITH_CMAKE // Install tree has "<prefix>/bin/cmake" and "<prefix><CMAKE_DATA_DIR>". @@ -2375,6 +2383,12 @@ std::string const& cmSystemTools::GetCMakeGUICommand() } //---------------------------------------------------------------------------- +std::string const& cmSystemTools::GetCMClDepsCommand() +{ + return cmSystemToolsCMClDepsCommand; +} + +//---------------------------------------------------------------------------- std::string const& cmSystemTools::GetCMakeRoot() { return cmSystemToolsCMakeRoot; diff --git a/Source/cmSystemTools.h b/Source/cmSystemTools.h index d14897f..e88170a 100644 --- a/Source/cmSystemTools.h +++ b/Source/cmSystemTools.h @@ -426,6 +426,7 @@ public: static std::string const& GetCMakeCommand(); static std::string const& GetCMakeGUICommand(); static std::string const& GetCMakeCursesCommand(); + static std::string const& GetCMClDepsCommand(); static std::string const& GetCMakeRoot(); /** Echo a message in color using KWSys's Terminal cprintf. */ diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index 2dfa19c..13e0d7e 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -636,7 +636,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, { assert(this->GetType() != INTERFACE_LIBRARY); - if (!this->Makefile->IsConfigured()) + if (!this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026()) { // At configure-time, this method can be called as part of getting the // LOCATION property or to export() a file to be include()d. However @@ -682,7 +682,7 @@ void cmTarget::GetSourceFiles(std::vector<std::string> &files, "SOURCES") != debugProperties.end(); - if (this->Makefile->IsConfigured()) + if (this->GetMakefile()->GetGlobalGenerator()->GetConfigureDoneCMP0026()) { this->DebugSourcesDone = true; } diff --git a/Source/ctest.cxx b/Source/ctest.cxx index afcbd61..7fa6aed 100644 --- a/Source/ctest.cxx +++ b/Source/ctest.cxx @@ -46,6 +46,10 @@ static const char * cmDocumentationOptions[][2] = {"--debug", "Displaying more verbose internals of CTest."}, {"--output-on-failure", "Output anything outputted by the test program " "if the test should fail."}, + {"--test-output-size-passed <size>", "Limit the output for passed tests " + "to <size> bytes"}, + {"--test-output-size-failed <size>", "Limit the output for failed tests " + "to <size> bytes"}, {"-F", "Enable failover."}, {"-j <jobs>, --parallel <jobs>", "Run the tests in parallel using the " "given number of jobs."}, diff --git a/Tests/CPackComponentsDEB/CMakeLists.txt b/Tests/CPackComponentsDEB/CMakeLists.txt index 5a5d626..98ed911 100644 --- a/Tests/CPackComponentsDEB/CMakeLists.txt +++ b/Tests/CPackComponentsDEB/CMakeLists.txt @@ -99,6 +99,25 @@ if(CHMOD_PROG) set(CPACK_DEBIAN_APPLICATIONS_PACKAGE_CONTROL_STRICT_PERMISSION TRUE) endif() +# creates a symbolic link and a directory. Those should not be hashed. +# warning: relocation of the symlink is not supported (symlinks with relative +# paths) +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink mylibapp symtest) +install(FILES ${CPackComponentsDEB_BINARY_DIR}/symtest + DESTINATION bin + COMPONENT applications) + +if(EXISTS "./dirtest") + execute_process(COMMAND ${CMAKE_COMMAND} -E remove_directory ./dirtest) +endif() +execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ./dirtest) +# BUG: apparently cannot add an empty directory +execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../mylibapp ./dirtest/symtest) +# NOTE: we should not add the trailing "/" to dirtest +install(DIRECTORY ${CPackComponentsDEB_BINARY_DIR}/dirtest + DESTINATION bin/ + COMPONENT applications) + # We may use the CPack specific config file in order # to tailor CPack behavior on a CPack generator specific way # (Behavior would be different for RPM or TGZ or DEB ...) diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake index 5460b1a..ff22f8f 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake @@ -36,7 +36,7 @@ find_program(LINTIAN_EXECUTABLE lintian) if(LINTIAN_EXECUTABLE) set(lintian_output_errors_all "") foreach(_f IN LISTS actual_output) - set(STRINGS_TO_AVOID "E:([^\r\n]*)control-file-has-bad-permissions") + set(STRINGS_TO_AVOID "E:([^\r\n]*)control-file-has-bad-permissions" "E:([^\r\n]*)md5sums-lists-nonexistent-file") lintian_check_specific_errors(lintian_output_errors FILENAME "${_f}" ERROR_REGEX_STRINGS "${STRINGS_TO_AVOID}") diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake index b96669e..bf9f81d 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake @@ -137,6 +137,8 @@ endfunction() # This function runs dpkg-deb on a .deb and returns its output +# the default behaviour it to run "--info" on the specified Debian package +# ACTION is one of the option accepted by dpkg-deb function(run_dpkgdeb dpkg_deb_output) set(${dpkg_deb_output} "" PARENT_SCOPE) @@ -144,7 +146,7 @@ function(run_dpkgdeb dpkg_deb_output) if(DPKGDEB_EXECUTABLE) set(options "") - set(oneValueArgs "FILENAME") + set(oneValueArgs "FILENAME" "ACTION") set(multiValueArgs "") cmake_parse_arguments(run_dpkgdeb_deb "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN} ) @@ -153,8 +155,12 @@ function(run_dpkgdeb dpkg_deb_output) message(FATAL_ERROR "error: run_dpkgdeb needs FILENAME to be set") endif() - # run lintian - execute_process(COMMAND ${DPKGDEB_EXECUTABLE} -I ${run_dpkgdeb_deb_FILENAME} + if(NOT run_dpkgdeb_deb_ACTION) + set(run_dpkgdeb_deb_ACTION "--info") + endif() + + # run dpkg-deb + execute_process(COMMAND ${DPKGDEB_EXECUTABLE} ${run_dpkgdeb_deb_ACTION} ${run_dpkgdeb_deb_FILENAME} WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE DPKGDEB_OUTPUT RESULT_VARIABLE DPKGDEB_RESULT diff --git a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake index fc58ea5..6331717 100644 --- a/Tests/RunCMake/CMP0026/RunCMakeTest.cmake +++ b/Tests/RunCMake/CMP0026/RunCMakeTest.cmake @@ -11,3 +11,4 @@ run_cmake(CMP0026-LOCATION-CONFIG-OLD) run_cmake(CMP0026-LOCATION-CONFIG-WARN) run_cmake(ObjlibNotDefined) run_cmake(LOCATION-and-TARGET_OBJECTS) +run_cmake(clear-cached-information) diff --git a/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt b/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt new file mode 100644 index 0000000..c51e883 --- /dev/null +++ b/Tests/RunCMake/CMP0026/clear-cached-information-dir/CMakeLists.txt @@ -0,0 +1,2 @@ + +add_executable(Hello ${CMAKE_CURRENT_BINARY_DIR}/main.c) diff --git a/Tests/RunCMake/CMP0026/clear-cached-information.cmake b/Tests/RunCMake/CMP0026/clear-cached-information.cmake new file mode 100644 index 0000000..dd2dd72 --- /dev/null +++ b/Tests/RunCMake/CMP0026/clear-cached-information.cmake @@ -0,0 +1,14 @@ + +enable_language(C) + +cmake_policy(SET CMP0026 OLD) + +add_subdirectory(clear-cached-information-dir) + +# Critical: this needs to happen in root CMakeLists.txt and not inside +# the subdir. +get_target_property(mypath Hello LOCATION) +# Now we create the file later, so you can see, ultimately no error should +# happen e.g. during generate phase: +file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c) +set_source_files_properties(${CMAKE_CURRENT_BINARY_DIR}/clear-cached-information-dir/main.c PROPERTIES GENERATED TRUE) diff --git a/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake index ef018b5..16d2cf3 100644 --- a/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/CPackConfig/RunCMakeTest.cmake @@ -2,3 +2,5 @@ include(RunCMake) run_cmake(Simple) run_cmake(Default) +run_cmake(Special) +run_cmake(Verbatim) diff --git a/Tests/RunCMake/CPackConfig/Special-check.cmake b/Tests/RunCMake/CPackConfig/Special-check.cmake new file mode 100644 index 0000000..0624b79 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Special-check.cmake @@ -0,0 +1,5 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_BACKSLASH "\\") +test_variable(CPACK_QUOTE "a;b;c") +test_variable(CPACK_DOLLAR "ab") diff --git a/Tests/RunCMake/CPackConfig/Special.cmake b/Tests/RunCMake/CPackConfig/Special.cmake new file mode 100644 index 0000000..9442c93 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Special.cmake @@ -0,0 +1,3 @@ +set(CPACK_BACKSLASH "\\\\") +set(CPACK_QUOTE "a\" b \"c") +set(CPACK_DOLLAR "a\${NOTHING}b") diff --git a/Tests/RunCMake/CPackConfig/Verbatim-check.cmake b/Tests/RunCMake/CPackConfig/Verbatim-check.cmake new file mode 100644 index 0000000..958547d --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Verbatim-check.cmake @@ -0,0 +1,10 @@ +include(${RunCMake_SOURCE_DIR}/check.cmake) + +test_variable(CPACK_BACKSLASH "\\\\") +test_variable(CPACK_QUOTE "a\" b \"c") +test_variable(CPACK_DOLLAR "a\${NOTHING}b") + +# make sure the default for this is still set correctly with +# CPACK_VERBATIM_VARIABLES on +test_variable(CPACK_SOURCE_IGNORE_FILES + "/CVS/;/\\.svn/;/\\.bzr/;/\\.hg/;/\\.git/;\\.swp$;\\.#;/#") diff --git a/Tests/RunCMake/CPackConfig/Verbatim.cmake b/Tests/RunCMake/CPackConfig/Verbatim.cmake new file mode 100644 index 0000000..4d271c3 --- /dev/null +++ b/Tests/RunCMake/CPackConfig/Verbatim.cmake @@ -0,0 +1,5 @@ +set(CPACK_VERBATIM_VARIABLES YES) + +set(CPACK_BACKSLASH "\\\\") +set(CPACK_QUOTE "a\" b \"c") +set(CPACK_DOLLAR "a\${NOTHING}b") diff --git a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake index dfc1e33..00895cc 100644 --- a/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CTestCommandLine/RunCMakeTest.cmake @@ -108,3 +108,20 @@ run_TestLoad(test-load-invalid 'two') run_TestLoad(test-load-pass 10) unset(ENV{__CTEST_FAKE_LOAD_AVERAGE_FOR_TESTING}) + +function(run_TestOutputSize) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/TestOutputSize) + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CTestTestfile.cmake" " + add_test(PassingTest \"${CMAKE_COMMAND}\" -E echo PassingTestOutput) + add_test(FailingTest \"${CMAKE_COMMAND}\" -E no_such_command) +") + run_cmake_command(TestOutputSize + ${CMAKE_CTEST_COMMAND} -M Experimental -T Test + --test-output-size-passed 10 + --test-output-size-failed 12 + ) +endfunction() +run_TestOutputSize() diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake new file mode 100644 index 0000000..918d242 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-check.cmake @@ -0,0 +1,17 @@ +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + file(READ "${test_xml_file}" test_xml LIMIT 4096) + if("${test_xml}" MATCHES [[(<Test Status="passed">.*</Test>).*(<Test Status="failed">.*</Test>)]]) + set(test_passed "${CMAKE_MATCH_1}") + set(test_failed "${CMAKE_MATCH_2}") + else() + set(RunCMake_TEST_FAILED "Test.xml does not contain a passed then failed test:\n ${test_xml}") + endif() + if(NOT "${test_passed}" MATCHES [[<Value>PassingTes\.\.\..*10 bytes]]) + set(RunCMake_TEST_FAILED "Test.xml passed test output not truncated at 10 bytes:\n ${test_passed}") + elseif(NOT "${test_failed}" MATCHES [[<Value>CMake Error:\.\.\..*12 bytes]]) + set(RunCMake_TEST_FAILED "Test.xml failed test output not truncated at 12 bytes:\n ${test_failed}") + endif() +else() + set(RunCMake_TEST_FAILED "Test.xml not found") +endif() diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt new file mode 100644 index 0000000..9c558e3 --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-result.txt @@ -0,0 +1 @@ +. diff --git a/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt new file mode 100644 index 0000000..ba4235d --- /dev/null +++ b/Tests/RunCMake/CTestCommandLine/TestOutputSize-stderr.txt @@ -0,0 +1 @@ +Errors while running CTest diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt new file mode 100644 index 0000000..5f211eb --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE-stdout.txt @@ -0,0 +1 @@ +-- g_ir_scanner: .*/g-ir-scanner diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake new file mode 100644 index 0000000..c85efaa --- /dev/null +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_GET_VARIABLE.cmake @@ -0,0 +1,9 @@ +find_package(PkgConfig REQUIRED) +pkg_check_modules(GOBJECT_INTROSPECTION QUIET gobject-introspection-1.0) + +if (GOBJECT_INTROSPECTION_FOUND) + pkg_get_variable(g_ir_scanner gobject-introspection-1.0 g_ir_scanner) + message(STATUS "g_ir_scanner: ${g_ir_scanner}") +else () + message(STATUS "g_ir_scanner: skipping test; gobject-introspection-1.0 not found /g-ir-scanner") +endif () diff --git a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake index 29301d7..bb04aa2 100644 --- a/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake +++ b/Tests/RunCMake/FindPkgConfig/RunCMakeTest.cmake @@ -9,3 +9,9 @@ if(APPLE) run_cmake(FindPkgConfig_CMAKE_FRAMEWORK_PATH) run_cmake(FindPkgConfig_CMAKE_APPBUNDLE_PATH) endif() + +# We need a real pkg-config to run the test for get_variable. +find_package(PkgConfig) +if (PKG_CONFIG_FOUND) + run_cmake(FindPkgConfig_GET_VARIABLE) +endif () diff --git a/Tests/RunCMake/ctest_test/CMakeLists.txt.in b/Tests/RunCMake/ctest_test/CMakeLists.txt.in index cedf379..e61b556 100644 --- a/Tests/RunCMake/ctest_test/CMakeLists.txt.in +++ b/Tests/RunCMake/ctest_test/CMakeLists.txt.in @@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.1) project(CTestTest@CASE_NAME@ NONE) include(CTest) add_test(NAME RunCMakeVersion COMMAND "${CMAKE_COMMAND}" --version) +@CASE_CMAKELISTS_SUFFIX_CODE@ diff --git a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake index 76dc143..e2f380c 100644 --- a/Tests/RunCMake/ctest_test/RunCMakeTest.cmake +++ b/Tests/RunCMake/ctest_test/RunCMakeTest.cmake @@ -59,3 +59,18 @@ function(run_TestChangeId) run_ctest(TestChangeId) endfunction() run_TestChangeId() + +function(run_TestOutputSize) + set(CASE_CTEST_TEST_ARGS EXCLUDE RunCMakeVersion) + set(CASE_TEST_PREFIX_CODE [[ +set(CTEST_CUSTOM_MAXIMUM_PASSED_TEST_OUTPUT_SIZE 10) +set(CTEST_CUSTOM_MAXIMUM_FAILED_TEST_OUTPUT_SIZE 12) + ]]) + set(CASE_CMAKELISTS_SUFFIX_CODE [[ +add_test(NAME PassingTest COMMAND ${CMAKE_COMMAND} -E echo PassingTestOutput) +add_test(NAME FailingTest COMMAND ${CMAKE_COMMAND} -E no_such_command) + ]]) + + run_ctest(TestOutputSize) +endfunction() +run_TestOutputSize() diff --git a/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake new file mode 100644 index 0000000..918d242 --- /dev/null +++ b/Tests/RunCMake/ctest_test/TestOutputSize-check.cmake @@ -0,0 +1,17 @@ +file(GLOB test_xml_file "${RunCMake_TEST_BINARY_DIR}/Testing/*/Test.xml") +if(test_xml_file) + file(READ "${test_xml_file}" test_xml LIMIT 4096) + if("${test_xml}" MATCHES [[(<Test Status="passed">.*</Test>).*(<Test Status="failed">.*</Test>)]]) + set(test_passed "${CMAKE_MATCH_1}") + set(test_failed "${CMAKE_MATCH_2}") + else() + set(RunCMake_TEST_FAILED "Test.xml does not contain a passed then failed test:\n ${test_xml}") + endif() + if(NOT "${test_passed}" MATCHES [[<Value>PassingTes\.\.\..*10 bytes]]) + set(RunCMake_TEST_FAILED "Test.xml passed test output not truncated at 10 bytes:\n ${test_passed}") + elseif(NOT "${test_failed}" MATCHES [[<Value>CMake Error:\.\.\..*12 bytes]]) + set(RunCMake_TEST_FAILED "Test.xml failed test output not truncated at 12 bytes:\n ${test_failed}") + endif() +else() + set(RunCMake_TEST_FAILED "Test.xml not found") +endif() |