diff options
-rw-r--r-- | Help/manual/cmake.1.rst | 6 | ||||
-rw-r--r-- | Help/release/3.17.rst | 9 | ||||
-rw-r--r-- | Modules/CheckLanguage.cmake | 2 | ||||
-rw-r--r-- | Modules/FindPkgConfig.cmake | 48 | ||||
-rw-r--r-- | Modules/GoogleTestAddTests.cmake | 20 | ||||
-rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
-rw-r--r-- | Source/cmake.cxx | 8 | ||||
-rw-r--r-- | Tests/CMakeOnly/CheckLanguage/CMakeLists.txt | 18 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/P_arbitrary_args.cmake | 3 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 1 | ||||
-rw-r--r-- | Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake | 22 | ||||
-rw-r--r-- | Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt | 40 | ||||
-rw-r--r-- | Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt | 44 | ||||
-rw-r--r-- | Tests/RunCMake/GoogleTest/fake_gtest.cpp | 4 | ||||
-rwxr-xr-x | bootstrap | 126 |
15 files changed, 229 insertions, 124 deletions
diff --git a/Help/manual/cmake.1.rst b/Help/manual/cmake.1.rst index e3e965c..9becfc6 100644 --- a/Help/manual/cmake.1.rst +++ b/Help/manual/cmake.1.rst @@ -481,13 +481,17 @@ Run a Script .. code-block:: shell - cmake [{-D <var>=<value>}...] -P <cmake-script-file> + cmake [{-D <var>=<value>}...] -P <cmake-script-file> [-- <unparsed-options>...] Process the given cmake file as a script written in the CMake language. No configure or generate step is performed and the cache is not modified. If variables are defined using ``-D``, this must be done before the ``-P`` argument. +Any options after ``--`` are not parsed by CMake, but they are still included +in the set of :variable:`CMAKE_ARGV<n> <CMAKE_ARGV0>` variables passed to the +script (including the ``--`` itself). + Run a Command-Line Tool ======================= diff --git a/Help/release/3.17.rst b/Help/release/3.17.rst index 7c5b44d..91e2463 100644 --- a/Help/release/3.17.rst +++ b/Help/release/3.17.rst @@ -333,3 +333,12 @@ Changes made since CMake 3.17.0 include the following. * CMake 3.17.0 updated the :cpack_gen:`CPack NSIS Generator` with changes that require NSIS 3.0 or later. CMake 3.17.1 now enforces the use of a sufficiently new version. + +3.17.3 +------ + +* The :module:`FindPkgConfig` module now extracts include directories + prefixed with ``-isystem`` into the ``*_INCLUDE_DIRS`` variables and + :prop_tgt:`INTERFACE_INCLUDE_DIRECTORIES` target properties. + Previously they would be places in ``*_CFLAGS_OTHER`` variables and + :prop_tgt:`INTERFACE_COMPILE_OPTIONS` target properties. diff --git a/Modules/CheckLanguage.cmake b/Modules/CheckLanguage.cmake index f48107a..d67d8d3 100644 --- a/Modules/CheckLanguage.cmake +++ b/Modules/CheckLanguage.cmake @@ -43,7 +43,7 @@ macro(check_language lang) file(REMOVE_RECURSE ${CMAKE_CURRENT_BINARY_DIR}/CMakeFiles/Check${lang}) set(extra_compiler_variables) - if(lang STREQUAL CUDA) + if(${lang} STREQUAL CUDA) set(extra_compiler_variables "set(CMAKE_CUDA_HOST_COMPILER \\\"\${CMAKE_CUDA_HOST_COMPILER}\\\")") endif() diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index 835811c..93827d8 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -412,6 +412,36 @@ function(_pkgconfig_extract_frameworks _prefix) set(${_prefix}_LDFLAGS_OTHER "${ldflags}" PARENT_SCOPE) endfunction() +# pkg-config returns -isystem include directories in --cflags-only-other, +# depending on the version and if there is a space between -isystem and +# the actual path +function(_pkgconfig_extract_isystem _prefix) + set(cflags "${${_prefix}_CFLAGS_OTHER}") + set(outflags "") + set(incdirs "${${_prefix}_INCLUDE_DIRS}") + + set(next_is_isystem FALSE) + foreach (THING IN LISTS cflags) + # This may filter "-isystem -isystem". That would not work anyway, + # so let it happen. + if (THING STREQUAL "-isystem") + set(next_is_isystem TRUE) + continue() + endif () + if (next_is_isystem) + set(next_is_isystem FALSE) + list(APPEND incdirs "${THING}") + elseif (THING MATCHES "^-isystem") + string(SUBSTRING "${THING}" 8 -1 THING) + list(APPEND incdirs "${THING}") + else () + list(APPEND outflags "${THING}") + endif () + endforeach () + set(${_prefix}_CFLAGS_OTHER "${outflags}" PARENT_SCOPE) + set(${_prefix}_INCLUDE_DIRS "${incdirs}" PARENT_SCOPE) +endfunction() + ### macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cmake_environment_path _imp_target _imp_target_global _prefix) _pkgconfig_unset(${_prefix}_FOUND) @@ -545,18 +575,22 @@ macro(_pkg_check_modules_internal _is_required _is_silent _no_cmake_path _no_cma endforeach() # set variables which are combined for multiple modules - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARIES "(^| )-l" --libs-only-l ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LIBRARY_DIRS "(^| )-L" --libs-only-L ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS "" --libs ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" LDFLAGS_OTHER "" --libs-only-other ) if (APPLE AND "-framework" IN_LIST ${_prefix}_LDFLAGS_OTHER) _pkgconfig_extract_frameworks("${_prefix}") endif() - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )-I" --cflags-only-I ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) - _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" INCLUDE_DIRS "(^| )(-I|-isystem ?)" --cflags-only-I ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS "" --cflags ) + _pkgconfig_invoke_dyn("${_pkg_check_modules_packages}" "${_prefix}" CFLAGS_OTHER "" --cflags-only-other ) + + if (${_prefix}_CFLAGS_OTHER MATCHES "-isystem") + _pkgconfig_extract_isystem("${_prefix}") + endif () _pkg_recalculate("${_prefix}" ${_no_cmake_path} ${_no_cmake_environment_path} ${_imp_target} ${_imp_target_global}) endif() diff --git a/Modules/GoogleTestAddTests.cmake b/Modules/GoogleTestAddTests.cmake index 499332f..4af62ed 100644 --- a/Modules/GoogleTestAddTests.cmake +++ b/Modules/GoogleTestAddTests.cmake @@ -83,6 +83,8 @@ function(gtest_discover_tests_impl) ) endif() + # Preserve semicolon in test-parameters + string(REPLACE [[;]] [[\;]] output "${output}") string(REPLACE "\n" ";" output "${output}") # Parse output @@ -114,9 +116,19 @@ function(gtest_discover_tests_impl) else() unset(TEST_XML_OUTPUT_PARAM) endif() + + # sanitize test name for further processing downstream + set(testname "${prefix}${pretty_suite}.${pretty_test}${suffix}") + # escape \ + string(REPLACE [[\]] [[\\]] testname "${testname}") + # escape ; + string(REPLACE [[;]] [[\;]] testname "${testname}") + # escape $ + string(REPLACE [[$]] [[\$]] testname "${testname}") + # ...and add to script add_command(add_test - "${prefix}${pretty_suite}.${pretty_test}${suffix}" + "${testname}" ${_TEST_EXECUTOR} "${_TEST_EXECUTABLE}" "--gtest_filter=${suite}.${test}" @@ -126,18 +138,18 @@ function(gtest_discover_tests_impl) ) if(suite MATCHES "^DISABLED" OR test MATCHES "^DISABLED") add_command(set_tests_properties - "${prefix}${pretty_suite}.${pretty_test}${suffix}" + "${testname}" PROPERTIES DISABLED TRUE ) endif() add_command(set_tests_properties - "${prefix}${pretty_suite}.${pretty_test}${suffix}" + "${testname}" PROPERTIES WORKING_DIRECTORY "${_TEST_WORKING_DIR}" SKIP_REGULAR_EXPRESSION "\\\\[ SKIPPED \\\\]" ${properties} ) - list(APPEND tests_buffer "${prefix}${pretty_suite}.${pretty_test}${suffix}") + list(APPEND tests_buffer "${testname}") list(LENGTH tests_buffer tests_buffer_length) if(${tests_buffer_length} GREATER "250") flush_tests_buffer() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index e780dd2..e980fc7 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 17) -set(CMake_VERSION_PATCH 20200506) +set(CMake_VERSION_PATCH 20200507) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmake.cxx b/Source/cmake.cxx index 057d54d..b451d27 100644 --- a/Source/cmake.cxx +++ b/Source/cmake.cxx @@ -291,7 +291,8 @@ void cmake::CleanupCommandsAndMacros() // Parse the args bool cmake::SetCacheArgs(const std::vector<std::string>& args) { - bool findPackageMode = false; + auto findPackageMode = false; + auto seenScriptOption = false; for (unsigned int i = 1; i < args.size(); ++i) { std::string const& arg = args[i]; if (cmHasLiteralPrefix(arg, "-D")) { @@ -446,6 +447,11 @@ bool cmake::SetCacheArgs(const std::vector<std::string>& args) this->SetHomeOutputDirectory( cmSystemTools::GetCurrentWorkingDirectory()); this->ReadListFile(args, path); + seenScriptOption = true; + } else if (arg == "--" && seenScriptOption) { + // Stop processing CMake args and avoid possible errors + // when arbitrary args are given to CMake script. + break; } else if (cmHasLiteralPrefix(arg, "--find-package")) { findPackageMode = true; } diff --git a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt index 90aa921..1570c37 100644 --- a/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckLanguage/CMakeLists.txt @@ -18,16 +18,16 @@ if(APPLE) list(APPEND LANGUAGES OBJC OBJCXX) endif() -foreach(lang ${LANGUAGES}) - check_language(${lang}) - if(NOT DEFINED CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) did not set result") +foreach(test_lang ${LANGUAGES}) + check_language(${test_lang}) + if(NOT DEFINED CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) did not set result") endif() - if(DEFINED expect_${lang}) - if(expect_${lang} AND NOT CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) should not fail!") - elseif(NOT expect_${lang} AND CMAKE_${lang}_COMPILER) - message(FATAL_ERROR "check_language(${lang}) should not succeed!") + if(DEFINED expect_${test_lang}) + if(expect_${test_lang} AND NOT CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) should not fail!") + elseif(NOT expect_${test_lang} AND CMAKE_${test_lang}_COMPILER) + message(FATAL_ERROR "check_language(${test_lang}) should not succeed!") endif() endif() endforeach() diff --git a/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake new file mode 100644 index 0000000..29faae3 --- /dev/null +++ b/Tests/RunCMake/CommandLine/P_arbitrary_args.cmake @@ -0,0 +1,3 @@ +if(NOT ("${CMAKE_ARGV3}" STREQUAL "--" AND "${CMAKE_ARGV4}" STREQUAL "-DFOO")) + message(FATAL_ERROR "`-DFOO` shouldn't trigger an error after `--`") +endif() diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 0f806bc..973391d 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -46,6 +46,7 @@ run_cmake_command(G_no-arg ${CMAKE_COMMAND} -B DummyBuildDir -G) run_cmake_command(G_bad-arg ${CMAKE_COMMAND} -B DummyBuildDir -G NoSuchGenerator) run_cmake_command(P_no-arg ${CMAKE_COMMAND} -P) run_cmake_command(P_no-file ${CMAKE_COMMAND} -P nosuchscriptfile.cmake) +run_cmake_command(P_arbitrary_args ${CMAKE_COMMAND} -P "${RunCMake_SOURCE_DIR}/P_arbitrary_args.cmake" -- -DFOO) run_cmake_command(build-no-dir ${CMAKE_COMMAND} --build) diff --git a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake index 62bb5de..d697fc6 100644 --- a/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake +++ b/Tests/RunCMake/FindPkgConfig/FindPkgConfig_IMPORTED_TARGET.cmake @@ -99,6 +99,7 @@ file(WRITE ${fakePkgDir}/lib/pkgconfig/${pname}.pc Description: Dummy package for FindPkgConfig IMPORTED_TARGET INTERFACE_LINK_OPTIONS test Version: 1.2.3 Libs: -e dummy_main +Cflags: -I/special -isystem /other -isystem/more -DA-isystem/foo ") set(expected_link_options -e dummy_main) @@ -109,7 +110,26 @@ endif() get_target_property(link_options PkgConfig::FakeLinkOptionsPackage INTERFACE_LINK_OPTIONS) if (NOT link_options STREQUAL expected_link_options) message(FATAL_ERROR - "Additional link options not present in INTERFACE_LINK_OPTIONS property" + "Additional link options not present in INTERFACE_LINK_OPTIONS property\n" "expected: \"${expected_link_options}\", but got \"${link_options}\"" ) endif() + +get_target_property(inc_dirs PkgConfig::FakeLinkOptionsPackage INTERFACE_INCLUDE_DIRECTORIES) +set(expected_inc_dirs "/special" "/other" "/more") + +if (NOT inc_dirs STREQUAL expected_inc_dirs) + message(FATAL_ERROR + "Additional include directories not correctly present in INTERFACE_INCLUDE_DIRECTORIES property\n" + "expected: \"${expected_inc_dirs}\", got \"${inc_dirs}\"" + ) +endif () + +get_target_property(c_opts PkgConfig::FakeLinkOptionsPackage INTERFACE_COMPILE_OPTIONS) +set(expected_c_opts "-DA-isystem/foo") # this is an invalid option, but a good testcase +if (NOT c_opts STREQUAL expected_c_opts) + message(FATAL_ERROR + "Additional compile options not present in INTERFACE_COMPILE_OPTIONS property\n" + "expected: \"${expected_c_opts}\", got \"${c_opts}\"" + ) +endif () diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt index 5f7753d..7fb3919 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test1-stdout.txt @@ -1,22 +1,28 @@ Test project .* - Start 1: TEST:basic\.case_foo!1 -1/8 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec - Start 2: TEST:basic\.case_bar!1 -2/8 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec - Start 3: TEST:basic\.disabled_case!1 -3/8 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 4: TEST:disabled\.case!1 -4/8 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 5: TEST:typed/short\.case!1 -5/8 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec - Start 6: TEST:typed/float\.case!1 -6/8 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec - Start 7: TEST:value/test\.case/1!1 -7/8 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec - Start 8: TEST:value/test\.case/"foo"!1 -8/8 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + Start 1: TEST:basic\.case_foo!1 + 1/11 Test #1: TEST:basic\.case_foo!1 \.+ +Passed +[0-9.]+ sec + Start 2: TEST:basic\.case_bar!1 + 2/11 Test #2: TEST:basic\.case_bar!1 \.+ +Passed +[0-9.]+ sec + Start 3: TEST:basic\.disabled_case!1 + 3/11 Test #3: TEST:basic\.disabled_case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 4: TEST:disabled\.case!1 + 4/11 Test #4: TEST:disabled\.case!1 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 5: TEST:typed/short\.case!1 + 5/11 Test #5: TEST:typed/short\.case!1 \.+ +Passed +[0-9.]+ sec + Start 6: TEST:typed/float\.case!1 + 6/11 Test #6: TEST:typed/float\.case!1 \.+ +Passed +[0-9.]+ sec + Start 7: TEST:value/test\.case/1!1 + 7/11 Test #7: TEST:value/test\.case/1!1 \.+ +Passed +[0-9.]+ sec + Start 8: TEST:value/test\.case/"foo"!1 + 8/11 Test #8: TEST:value/test\.case/"foo"!1 \.+ +Passed +[0-9.]+ sec + Start 9: TEST:param/special\.case/"semicolon;"!1 + 9/11 Test #9: TEST:param/special\.case/"semicolon;"!1 \.+ +Passed +[0-9.]+ sec + Start 10: TEST:param/special\.case/"backslash\\"!1 +10/11 Test #10: TEST:param/special\.case/"backslash\\"!1 \.+ +Passed +[0-9.]+ sec + Start 11: TEST:param/special\.case/"\$\{var\}"!1 +11/11 Test #11: TEST:param/special\.case/"\$\{var\}"!1 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 6 +100% tests passed, 0 tests failed out of 9 Total Test time \(real\) = +[0-9.]+ sec diff --git a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt index 960c0b9..58c4d10 100644 --- a/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt +++ b/Tests/RunCMake/GoogleTest/GoogleTest-test2-stdout.txt @@ -1,25 +1,31 @@ Test project .* - Start 9: TEST:basic\.case_foo!2 -1/8 Test #9: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec - Start 10: TEST:basic\.case_bar!2 -2/8 Test #10: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec - Start 11: TEST:basic\.disabled_case!2 -3/8 Test #11: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 12: TEST:disabled\.case!2 -4/8 Test #12: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec - Start 13: TEST:typed/short\.case!2 -5/8 Test #13: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec - Start 14: TEST:typed/float\.case!2 -6/8 Test #14: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec - Start 15: TEST:value/test\.case/1!2 -7/8 Test #15: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec - Start 16: TEST:value/test\.case/"foo"!2 -8/8 Test #16: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + Start 12: TEST:basic\.case_foo!2 + 1/11 Test #12: TEST:basic\.case_foo!2 \.+ +Passed +[0-9.]+ sec + Start 13: TEST:basic\.case_bar!2 + 2/11 Test #13: TEST:basic\.case_bar!2 \.+ +Passed +[0-9.]+ sec + Start 14: TEST:basic\.disabled_case!2 + 3/11 Test #14: TEST:basic\.disabled_case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 15: TEST:disabled\.case!2 + 4/11 Test #15: TEST:disabled\.case!2 \.+\*+Not Run \(Disabled\) +[0-9.]+ sec + Start 16: TEST:typed/short\.case!2 + 5/11 Test #16: TEST:typed/short\.case!2 \.+ +Passed +[0-9.]+ sec + Start 17: TEST:typed/float\.case!2 + 6/11 Test #17: TEST:typed/float\.case!2 \.+ +Passed +[0-9.]+ sec + Start 18: TEST:value/test\.case/1!2 + 7/11 Test #18: TEST:value/test\.case/1!2 \.+ +Passed +[0-9.]+ sec + Start 19: TEST:value/test\.case/"foo"!2 + 8/11 Test #19: TEST:value/test\.case/"foo"!2 \.+ +Passed +[0-9.]+ sec + Start 20: TEST:param/special\.case/"semicolon;"!2 + 9/11 Test #20: TEST:param/special\.case/"semicolon;"!2 \.+ +Passed +[0-9.]+ sec + Start 21: TEST:param/special\.case/"backslash\\"!2 +10/11 Test #21: TEST:param/special\.case/"backslash\\"!2 \.+ +Passed +[0-9.]+ sec + Start 22: TEST:param/special\.case/"\$\{var\}"!2 +11/11 Test #22: TEST:param/special\.case/"\$\{var\}"!2 \.+ +Passed +[0-9.]+ sec -100% tests passed, 0 tests failed out of 6 +100% tests passed, 0 tests failed out of 9 Total Test time \(real\) = +[0-9.]+ sec The following tests did not run: -.*11 - TEST:basic\.disabled_case!2 \(Disabled\) -.*12 - TEST:disabled\.case!2 \(Disabled\) +.*14 - TEST:basic\.disabled_case!2 \(Disabled\) +.*15 - TEST:disabled\.case!2 \(Disabled\) diff --git a/Tests/RunCMake/GoogleTest/fake_gtest.cpp b/Tests/RunCMake/GoogleTest/fake_gtest.cpp index f1bd7ef..a8127bf 100644 --- a/Tests/RunCMake/GoogleTest/fake_gtest.cpp +++ b/Tests/RunCMake/GoogleTest/fake_gtest.cpp @@ -21,6 +21,10 @@ int main(int argc, char** argv) std::cout << "value/test." << std::endl; std::cout << " case/0 # GetParam() = 1" << std::endl; std::cout << " case/1 # GetParam() = \"foo\"" << std::endl; + std::cout << "param/special." << std::endl; + std::cout << " case/0 # GetParam() = \"semicolon;\"" << std::endl; + std::cout << " case/1 # GetParam() = \"backslash\\\"" << std::endl; + std::cout << " case/2 # GetParam() = \"${var}\"" << std::endl; return 0; } @@ -60,7 +60,7 @@ cmake_version_minor="`cmake_version_component MINOR`" cmake_version_patch="`cmake_version_component PATCH`" cmake_version="${cmake_version_major}.${cmake_version_minor}.${cmake_version_patch}" cmake_version_rc="`cmake_version_component RC`" -if [ "$cmake_version_rc" != "" ]; then +if test "$cmake_version_rc" != ""; then cmake_version="${cmake_version}-rc${cmake_version_rc}" fi @@ -209,13 +209,13 @@ esac # Choose the default install prefix. if ${cmake_system_mingw}; then - if [ "x${PROGRAMFILES}" != "x" ]; then + if test "x${PROGRAMFILES}" != "x"; then cmake_default_prefix=`cmake_fix_slashes "${PROGRAMFILES}/CMake"` - elif [ "x${ProgramFiles}" != "x" ]; then + elif test "x${ProgramFiles}" != "x"; then cmake_default_prefix=`cmake_fix_slashes "${ProgramFiles}/CMake"` - elif [ "x${SYSTEMDRIVE}" != "x" ]; then + elif test "x${SYSTEMDRIVE}" != "x"; then cmake_default_prefix=`cmake_fix_slashes "${SYSTEMDRIVE}/Program Files/CMake"` - elif [ "x${SystemDrive}" != "x" ]; then + elif test "x${SystemDrive}" != "x"; then cmake_default_prefix=`cmake_fix_slashes "${SystemDrive}/Program Files/CMake"` else cmake_default_prefix="c:/Program Files/CMake" @@ -671,7 +671,7 @@ cmake_error() echo "Error when bootstrapping CMake:" echo "$*" echo "---------------------------------------------" - if [ -f cmake_bootstrap.log ]; then + if test -f cmake_bootstrap.log; then echo "Log of errors: `pwd`/cmake_bootstrap.log" #cat cmake_bootstrap.log echo "---------------------------------------------" @@ -698,9 +698,9 @@ cmake_replace_string () OUTFILE="$2" SEARCHFOR="$3" REPLACEWITH="$4" - if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then + if test -f "${INFILE}" || ${cmake_system_openvms}; then sed "s/\@${SEARCHFOR}\@/${REPLACEWITH}/g" "${INFILE}" > "${OUTFILE}${_tmp}" - if [ -f "${OUTFILE}${_tmp}" ]; then + if test -f "${OUTFILE}${_tmp}"; then if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then #echo "Files are the same" rm -f "${OUTFILE}${_tmp}" @@ -719,7 +719,7 @@ cmake_kwsys_config_replace_string () OUTFILE="$2" shift 2 APPEND="$*" - if [ -f "${INFILE}" ] || ${cmake_system_openvms}; then + if test -f "${INFILE}" || ${cmake_system_openvms}; then echo "${APPEND}" > "${OUTFILE}${_tmp}" sed "/./ {s/\@KWSYS_NAMESPACE\@/cmsys/g; s/@KWSYS_BUILD_SHARED@/${KWSYS_BUILD_SHARED}/g; @@ -730,7 +730,7 @@ cmake_kwsys_config_replace_string () s/@KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H@/${KWSYS_CXX_HAS_EXT_STDIO_FILEBUF_H}/g; s/@KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP@/${KWSYS_SYSTEMTOOLS_USE_TRANSLATION_MAP}/g; }" "${INFILE}" >> "${OUTFILE}${_tmp}" - if [ -f "${OUTFILE}${_tmp}" ]; then + if test -f "${OUTFILE}${_tmp}"; then if "${_diff}" "${OUTFILE}" "${OUTFILE}${_tmp}" > /dev/null 2> /dev/null ; then #echo "Files are the same" rm -f "${OUTFILE}${_tmp}" @@ -787,7 +787,7 @@ cmake_try_run () COMPILER=$1 FLAGS=$2 TESTFILE=$3 - if [ ! -f "${TESTFILE}" ]; then + if test ! -f "${TESTFILE}"; then echo "Test file ${TESTFILE} missing. Please verify your CMake source tree." exit 4 fi @@ -799,18 +799,18 @@ cmake_try_run () echo "------------------------------------------" "${COMPILER}" ${FLAGS} "${TESTFILE}" -o "${TMPFILE}" RES=$? - if [ "${RES}" -ne "0" ]; then + if test "${RES}" -ne "0"; then echo "Test failed to compile" return 1 fi - if [ ! -f "${TMPFILE}" ] && [ ! -f "${TMPFILE}.exe" ]; then + if test ! -f "${TMPFILE}" && test ! -f "${TMPFILE}.exe"; then echo "Test failed to produce executable" return 2 fi ./${TMPFILE} RES=$? rm -f "${TMPFILE}" - if [ "${RES}" -ne "0" ]; then + if test "${RES}" -ne "0"; then echo "Test produced non-zero return code" return 3 fi @@ -826,18 +826,18 @@ cmake_try_make () echo "Try: ${MAKE_PROC}" "${MAKE_PROC}" ${MAKE_FLAGS} RES=$? - if [ "${RES}" -ne "0" ]; then + if test "${RES}" -ne "0"; then echo "${MAKE_PROC} does not work" return 1 fi - if [ ! -f "test" ] && [ ! -f "test.exe" ]; then + if test ! -f "test" && test ! -f "test.exe"; then echo "${COMPILER} does not produce output" return 2 fi ./test RES=$? rm -f "test" - if [ "${RES}" -ne "0" ]; then + if test "${RES}" -ne "0"; then echo "${MAKE_PROC} produces strange executable" return 3 fi @@ -894,13 +894,13 @@ while test $# != 0; do done # If verbose, display some information about bootstrap -if [ -n "${cmake_verbose}" ]; then +if test -n "${cmake_verbose}"; then echo "---------------------------------------------" echo "Source directory: ${cmake_source_dir}" echo "Binary directory: ${cmake_binary_dir}" echo "Prefix directory: ${cmake_prefix_dir}" echo "System: ${cmake_system}" - if [ "x${cmake_parallel_make}" != "x" ]; then + if test "x${cmake_parallel_make}" != "x"; then echo "Doing parallel make: ${cmake_parallel_make}" fi echo "" @@ -912,18 +912,18 @@ echo "`cmake_version_display`" # Check for in-source build cmake_in_source_build= -if [ -f "${cmake_binary_dir}/Source/cmake.cxx" -a \ - -f "${cmake_binary_dir}/Source/cmake.h" ]; then - if [ -n "${cmake_verbose}" ]; then +if test -f "${cmake_binary_dir}/Source/cmake.cxx" && + test -f "${cmake_binary_dir}/Source/cmake.h"; then + if test -n "${cmake_verbose}"; then echo "Warning: This is an in-source build" fi cmake_in_source_build=TRUE fi # If this is not an in-source build, then Bootstrap stuff should not exist. -if [ -z "${cmake_in_source_build}" ]; then +if test -z "${cmake_in_source_build}"; then # Did somebody bootstrap in the source tree? - if [ -d "${cmake_source_dir}/Bootstrap${_cmk}" ]; then + if test -d "${cmake_source_dir}/Bootstrap${_cmk}"; then cmake_error 10 "Found directory \"${cmake_source_dir}/Bootstrap${_cmk}\". Looks like somebody did bootstrap CMake in the source tree, but now you are trying to do bootstrap in the binary tree. Please remove Bootstrap${_cmk} @@ -931,7 +931,7 @@ directory from the source tree." fi # Is there a cache in the source tree? for cmake_problematic_file in ${CMAKE_PROBLEMATIC_FILES}; do - if [ -f "${cmake_source_dir}/${cmake_problematic_file}" ]; then + if test -f "${cmake_source_dir}/${cmake_problematic_file}"; then cmake_error 10 "Found \"${cmake_source_dir}/${cmake_problematic_file}\". Looks like somebody tried to build CMake in the source tree, but now you are trying to do bootstrap in the binary tree. Please remove \"${cmake_problematic_file}\" @@ -941,14 +941,14 @@ from the source tree." fi # Make bootstrap directory -[ -d "${cmake_bootstrap_dir}" ] || mkdir "${cmake_bootstrap_dir}" -if [ ! -d "${cmake_bootstrap_dir}" ]; then +test -d "${cmake_bootstrap_dir}" || mkdir "${cmake_bootstrap_dir}" +if test ! -d "${cmake_bootstrap_dir}"; then cmake_error 3 "Cannot create directory ${cmake_bootstrap_dir} to bootstrap CMake." fi cd "${cmake_bootstrap_dir}" -[ -d "cmsys" ] || mkdir "cmsys" -if [ ! -d "cmsys" ]; then +test -d "cmsys" || mkdir "cmsys" +if test ! -d "cmsys"; then cmake_error 4 "Cannot create directory ${cmake_bootstrap_dir}/cmsys" fi @@ -959,7 +959,7 @@ rm -f "${cmake_bootstrap_dir}/cmVersionConfig.h${_tmp}" # If building in-source, remove any cmConfigure.h that may # have been created by a previous run of the bootstrap cmake. -if [ -n "${cmake_in_source_build}" ]; then +if test -n "${cmake_in_source_build}"; then rm -f "${cmake_source_dir}/Source/cmConfigure.h" fi @@ -1044,7 +1044,7 @@ cmake_toolchain_detect() done } -if [ -z "${CC}" -a -z "${CXX}" ]; then +if test -z "${CC}" && test -z "${CXX}"; then cmake_toolchain_detect fi @@ -1058,9 +1058,9 @@ esac cmake_c_compiler= # If CC is set, use that for compiler, otherwise use list of known compilers -if [ -n "${cmake_toolchain}" ]; then +if test -n "${cmake_toolchain}"; then eval cmake_c_compilers="\${cmake_toolchain_${cmake_toolchain}_CC}" -elif [ -n "${CC}" ]; then +elif test -n "${CC}"; then cmake_c_compilers="${CC}" else cmake_c_compilers="${CMAKE_KNOWN_C_COMPILERS}" @@ -1111,7 +1111,7 @@ for std in 11 99 90; do done rm -f "${TMPFILE}.c" -if [ -z "${cmake_c_compiler}" ]; then +if test -z "${cmake_c_compiler}"; then cmake_error 6 "Cannot find appropriate C compiler on this system. Please specify one using environment variable CC. See cmake_bootstrap.log for compilers attempted. @@ -1126,9 +1126,9 @@ cmake_cxx_compiler= # On Mac OSX, CC is the same as cc, so make sure not to try CC as c++ compiler. # If CC is set, use that for compiler, otherwise use list of known compilers -if [ -n "${cmake_toolchain}" ]; then +if test -n "${cmake_toolchain}"; then eval cmake_cxx_compilers="\${cmake_toolchain_${cmake_toolchain}_CXX}" -elif [ -n "${CXX}" ]; then +elif test -n "${CXX}"; then cmake_cxx_compilers="${CXX}" else cmake_cxx_compilers="${CMAKE_KNOWN_CXX_COMPILERS}" @@ -1232,7 +1232,7 @@ for std in 17 14 11; do done rm -f "${TMPFILE}.cxx" -if [ -z "${cmake_cxx_compiler}" ]; then +if test -z "${cmake_cxx_compiler}"; then cmake_error 7 "Cannot find a C++ compiler that supports both C++11 and the specified C++ flags. Please specify one using environment variable CXX. The C++ flags are \"$cmake_cxx_flags\". @@ -1259,7 +1259,7 @@ cmake_have_cxx_features="" for feature in ${cmake_cxx_features}; do feature_variable="cmake_have_cxx_${feature}" eval "feature_value=\${${feature_variable}}" - if [ "${feature_value}" -eq "1" ]; then + if test "${feature_value}" -eq "1"; then cmake_have_cxx_features="${cmake_have_cxx_features} -DCMake_HAVE_CXX_`cmake_toupper ${feature}`=${feature_value}" fi done @@ -1271,7 +1271,7 @@ cmake_make_processor= cmake_make_flags= # If MAKE is set, use that for make processor, otherwise use list of known make -if [ -n "${MAKE}" ]; then +if test -n "${MAKE}"; then cmake_make_processors="${MAKE}" else cmake_make_processors="${CMAKE_KNOWN_MAKE_PROCESSORS}" @@ -1290,20 +1290,20 @@ echo ' int main(){ printf("1%c", (char)0x0a); return 0; } ' > "test.c" cmake_original_make_flags="${cmake_make_flags}" -if [ "x${cmake_parallel_make}" != "x" ]; then +if test "x${cmake_parallel_make}" != "x"; then cmake_make_flags="${cmake_make_flags} -j ${cmake_parallel_make}" fi for a in ${cmake_make_processors}; do - if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then + if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then cmake_make_processor="${a}" fi done cmake_full_make_flags="${cmake_make_flags}" -if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then - if [ -z "${cmake_make_processor}" ]; then +if test "x${cmake_original_make_flags}" != "x${cmake_make_flags}"; then + if test -z "${cmake_make_processor}"; then cmake_make_flags="${cmake_original_make_flags}" for a in ${cmake_make_processors}; do - if [ -z "${cmake_make_processor}" ] && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then + if test -z "${cmake_make_processor}" && cmake_try_make "${a}" "${cmake_make_flags}" >> ../cmake_bootstrap.log 2>&1; then cmake_make_processor="${a}" fi done @@ -1311,13 +1311,13 @@ if [ "x${cmake_original_make_flags}" != "x${cmake_make_flags}" ]; then fi cd "${cmake_bootstrap_dir}" -if [ -z "${cmake_make_processor}" ]; then +if test -z "${cmake_make_processor}"; then cmake_error 8 "Cannot find appropriate Makefile processor on this system. Please specify one using environment variable MAKE." fi rm -rf "${cmake_bootstrap_dir}/${TMPFILE}" echo "Makefile processor on this system is: ${cmake_make_processor}" -if [ "x${cmake_full_make_flags}" != "x${cmake_make_flags}" ]; then +if test "x${cmake_full_make_flags}" != "x${cmake_make_flags}"; then echo "---------------------------------------------" echo "Makefile processor ${cmake_make_processor} does not support parallel build" echo "---------------------------------------------" @@ -1382,7 +1382,7 @@ else echo "${cmake_cxx_compiler} does not have <ext/stdio_filebuf.h>" fi -if [ -n "${cmake_ccache_enabled}" ]; then +if test -n "${cmake_ccache_enabled}"; then echo "Building CMake with ccache" cmake_c_compiler="ccache ${cmake_c_compiler}" cmake_cxx_compiler="ccache ${cmake_cxx_compiler}" @@ -1532,15 +1532,15 @@ else fi uv_c_flags="${uv_c_flags} `cmake_escape "-I${cmake_source_dir}/Utilities/cmlibuv/src"`" -if [ "x${cmake_ansi_cxx_flags}" != "x" ]; then +if test "x${cmake_ansi_cxx_flags}" != "x"; then cmake_cxx_flags="${cmake_ansi_cxx_flags} ${cmake_cxx_flags}" fi -if [ "x${cmake_c_flags}" != "x" ]; then +if test "x${cmake_c_flags}" != "x"; then cmake_c_flags="${cmake_c_flags} " fi -if [ "x${cmake_cxx_flags}" != "x" ]; then +if test "x${cmake_cxx_flags}" != "x"; then cmake_cxx_flags="${cmake_cxx_flags} " fi @@ -1637,42 +1637,42 @@ set (CMAKE_XDGDATA_DIR "'"${cmake_xdgdata_dir}"'" CACHE PATH "Install location f ' > "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" # Add configuration settings given as command-line options. -if [ "x${cmake_bootstrap_qt_gui}" != "x" ]; then +if test "x${cmake_bootstrap_qt_gui}" != "x"; then echo ' set (BUILD_QtDialog '"${cmake_bootstrap_qt_gui}"' CACHE BOOL "Build Qt dialog for CMake" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_bootstrap_qt_qmake}" != "x" ]; then +if test "x${cmake_bootstrap_qt_qmake}" != "x"; then echo ' set (QT_QMAKE_EXECUTABLE "'"${cmake_bootstrap_qt_qmake}"'" CACHE FILEPATH "Location of Qt qmake" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_info}" != "x" ]; then +if test "x${cmake_sphinx_info}" != "x"; then echo ' set (SPHINX_INFO "'"${cmake_sphinx_info}"'" CACHE BOOL "Build Info manual with Sphinx" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_man}" != "x" ]; then +if test "x${cmake_sphinx_man}" != "x"; then echo ' set (SPHINX_MAN "'"${cmake_sphinx_man}"'" CACHE BOOL "Build man pages with Sphinx" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_html}" != "x" ]; then +if test "x${cmake_sphinx_html}" != "x"; then echo ' set (SPHINX_HTML "'"${cmake_sphinx_html}"'" CACHE BOOL "Build html help with Sphinx" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_qthelp}" != "x" ]; then +if test "x${cmake_sphinx_qthelp}" != "x"; then echo ' set (SPHINX_QTHELP "'"${cmake_sphinx_qthelp}"'" CACHE BOOL "Build qch help with Sphinx" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_build}" != "x" ]; then +if test "x${cmake_sphinx_build}" != "x"; then echo ' set (SPHINX_EXECUTABLE "'"${cmake_sphinx_build}"'" CACHE FILEPATH "Location of Qt sphinx-build" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi -if [ "x${cmake_sphinx_flags}" != "x" ]; then +if test "x${cmake_sphinx_flags}" != "x"; then echo ' set (SPHINX_FLAGS [==['"${cmake_sphinx_flags}"']==] CACHE STRING "Flags to pass to sphinx-build" FORCE) ' >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" @@ -1682,7 +1682,7 @@ fi # specification of cmake_init_file. ( cd "${cmake_binary_dir}" -if [ -f "${cmake_init_file}" ]; then +if test -f "${cmake_init_file}"; then cat "${cmake_init_file}" >> "${cmake_bootstrap_dir}/InitialCacheFlags.cmake" fi ) @@ -1690,13 +1690,13 @@ fi echo "---------------------------------------------" # Run make to build bootstrap cmake -if [ "x${cmake_parallel_make}" != "x" ]; then +if test "x${cmake_parallel_make}" != "x"; then ${cmake_make_processor} ${cmake_make_flags} else ${cmake_make_processor} fi RES=$? -if [ "${RES}" -ne "0" ]; then +if test "${RES}" -ne "0"; then cmake_error 9 "Problem while running ${cmake_make_processor}" fi cd "${cmake_binary_dir}" @@ -1715,12 +1715,12 @@ export LDFLAGS # Run bootstrap CMake to configure real CMake cmake_options="-DCMAKE_BOOTSTRAP=1" -if [ -n "${cmake_verbose}" ]; then +if test -n "${cmake_verbose}"; then cmake_options="${cmake_options} -DCMAKE_VERBOSE_MAKEFILE=1" fi "${cmake_bootstrap_dir}/cmake" "${cmake_source_dir}" "-C${cmake_bootstrap_dir}/InitialCacheFlags.cmake" "-G${cmake_bootstrap_generator}" ${cmake_options} ${cmake_bootstrap_system_libs} "$@" RES=$? -if [ "${RES}" -ne "0" ]; then +if test "${RES}" -ne "0"; then cmake_error 11 "Problem while running initial CMake" fi |