Commit 7a649111 authored by Daniel Pfeifer's avatar Daniel Pfeifer

Use string(APPEND) in Tests

Automate with:

find Tests -type f -print0 | xargs -0 perl -i -0pe \
's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g'
parent 5d0d980d
......@@ -8,7 +8,7 @@ set(CMAKE_CXX_STANDARD 98)
# template support also need a flag to use the newer C++ library.
if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND
CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA")
string(APPEND CMAKE_CXX_FLAGS " -AA")
endif ()
# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers
......
......@@ -50,7 +50,7 @@ else ()
endif ()
if (CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
string(APPEND CMAKE_CXX_FLAGS " -O3")
unset(CSE_RESULT_O3 CACHE)
message(STATUS "Testing with optimization -O3")
......
......@@ -77,7 +77,7 @@ endforeach()
set(CMAKE_TRY_COMPILE_CONFIGURATION ${CMAKE_BUILD_TYPE})
if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
string(APPEND CMAKE_C_FLAGS " -O3")
unset(CSHM_RESULT_O3 CACHE)
unset(CSHM_RESULT_O3_C CACHE)
unset(CSHM_RESULT_O3_CXX CACHE)
......
......@@ -39,7 +39,7 @@ else ()
endif ()
if (CMAKE_COMPILER_IS_GNUCC)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3")
string(APPEND CMAKE_C_FLAGS " -O3")
unset(CSE_RESULT_O3 CACHE)
message(STATUS "Testing with optimization -O3")
......
......@@ -35,7 +35,7 @@ foreach(module ${all_modules})
message(STATUS "module: ${module}")
file(READ "${dir}/${module}" module_content)
if(NOT "${module_content}" MATCHES "${notice_regex}")
set(notice_missing "${notice_missing} ${module}\n")
string(APPEND notice_missing " ${module}\n")
endif()
endforeach()
......
......@@ -2,13 +2,13 @@ set(NUMBERS "")
set(COUNT 0)
while(COUNT LESS 200)
set(NUMBERS "${NUMBERS} ${COUNT}")
string(APPEND NUMBERS " ${COUNT}")
set(COUNT "2${COUNT}")
set(NCOUNT 3)
while(NCOUNT LESS 31)
set(NUMBERS "${NUMBERS} ${NCOUNT}")
set(NCOUNT "${NCOUNT}0")
string(APPEND NUMBERS " ${NCOUNT}")
string(APPEND NCOUNT "0")
endwhile()
endwhile()
......
......@@ -41,7 +41,7 @@ if(LINTIAN_EXECUTABLE)
FILENAME "${_f}"
ERROR_REGEX_STRINGS "${STRINGS_TO_AVOID}")
set(lintian_output_errors_all "${lintian_output_errors_all}${lintian_output_errors}")
string(APPEND lintian_output_errors_all "${lintian_output_errors}")
endforeach()
if(NOT "${lintian_output_errors_all}" STREQUAL "")
......
......@@ -126,7 +126,7 @@ function(lintian_check_specific_errors output_errors)
string(REGEX MATCHALL "${_s}" "_TMP_CHECK_ERROR" "${lintian_output}")
if(NOT "${_TMP_CHECK_ERROR}" STREQUAL "")
set(ERROR_ACC "${ERROR_ACC}\nlintian: ${_f}: output contains an undesirable regex:\n\t${_TMP_CHECK_ERROR}")
string(APPEND ERROR_ACC "\nlintian: ${_f}: output contains an undesirable regex:\n\t${_TMP_CHECK_ERROR}")
endif()
endforeach()
......
......@@ -4,7 +4,7 @@
#-----------------------------------------------------------------------------
# Test in a directory next to this script.
get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(TOP "${TOP}/@CTestUpdateBZR_DIR@")
string(APPEND TOP "/@CTestUpdateBZR_DIR@")
# Include code common to all update tests.
include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
......
......@@ -4,7 +4,7 @@
#-----------------------------------------------------------------------------
# Test in a directory next to this script.
get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(TOP "${TOP}/@CTestUpdateCVS_DIR@")
string(APPEND TOP "/@CTestUpdateCVS_DIR@")
set(UPDATE_NOT_GLOBAL 1)
set(UPDATE_MAYBE Updated{CTestConfig.cmake})
......
......@@ -84,9 +84,9 @@ function(check_updates build)
set(MSG "")
if(MISSING)
# List the missing entries
set(MSG "${MSG}Update.xml is missing expected entries:\n")
string(APPEND MSG "Update.xml is missing expected entries:\n")
foreach(f ${MISSING})
set(MSG "${MSG} ${f}\n")
string(APPEND MSG " ${f}\n")
endforeach()
else()
# Success
......@@ -96,9 +96,9 @@ function(check_updates build)
# Report the result
if(EXTRA)
# List the extra entries
set(MSG "${MSG}Update.xml has extra unexpected entries:\n")
string(APPEND MSG "Update.xml has extra unexpected entries:\n")
foreach(f ${EXTRA})
set(MSG "${MSG} ${f}\n")
string(APPEND MSG " ${f}\n")
endforeach()
else()
# Success
......@@ -112,9 +112,9 @@ function(check_updates build)
if(UPDATE_LOG_FILE)
file(READ ${UPDATE_LOG_FILE} UPDATE_LOG LIMIT ${max_update_xml_size})
string(REPLACE "\n" "\n " UPDATE_LOG "${UPDATE_LOG}")
set(MSG "${MSG}Update log:\n ${UPDATE_LOG}")
string(APPEND MSG "Update log:\n ${UPDATE_LOG}")
else()
set(MSG "${MSG}No update log found!")
string(APPEND MSG "No update log found!")
endif()
# Display the error message
......
......@@ -4,7 +4,7 @@
#-----------------------------------------------------------------------------
# Test in a directory next to this script.
get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(TOP "${TOP}/@CTestUpdateGIT_DIR@")
string(APPEND TOP "/@CTestUpdateGIT_DIR@")
set(UPDATE_EXTRA Updated{module})
# Include code common to all update tests.
......
......@@ -4,7 +4,7 @@
#-----------------------------------------------------------------------------
# Test in a directory next to this script.
get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(TOP "${TOP}/@CTestUpdateHG_DIR@")
string(APPEND TOP "/@CTestUpdateHG_DIR@")
# Include code common to all update tests.
include("@CMAKE_CURRENT_SOURCE_DIR@/CTestUpdateCommon.cmake")
......
......@@ -5,7 +5,7 @@
# Test in a directory next to this script.
get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(P4_TOP "${TOP}")
set(TOP "${TOP}/@CTestUpdateP4_DIR@")
string(APPEND TOP "/@CTestUpdateP4_DIR@")
# Include code common to all update tests.
set(REPOSITORY_FILE_PREFIX "//ctest/")
......@@ -48,9 +48,9 @@ if(UNIX)
file(MAKE_DIRECTORY ${P4_ROOT})
set(P4_SERVER "nohup '${P4D}' -d -r '${P4_ROOT}'")
set(P4_SERVER "${P4_SERVER} -L '${P4_ROOT}/p4.log'")
set(P4_SERVER "${P4_SERVER} -J '${P4_ROOT}/journal'")
set(P4_SERVER "${P4_SERVER} -p ${P4_PORT} >/dev/null 2>&1 &")
string(APPEND P4_SERVER " -L '${P4_ROOT}/p4.log'")
string(APPEND P4_SERVER " -J '${P4_ROOT}/journal'")
string(APPEND P4_SERVER " -p ${P4_PORT} >/dev/null 2>&1 &")
message("Server command line: ${P4_SERVER}")
......
......@@ -4,7 +4,7 @@
#-----------------------------------------------------------------------------
# Test in a directory next to this script.
get_filename_component(TOP "${CMAKE_CURRENT_LIST_FILE}" PATH)
set(TOP "${TOP}/@CTestUpdateSVN_DIR@")
string(APPEND TOP "/@CTestUpdateSVN_DIR@")
set(UPDATE_GLOBAL_ELEMENTS SVNPath)
# Include code common to all update tests.
......
......@@ -95,7 +95,7 @@ endif()
if(CMAKE_SYSTEM MATCHES "OSF1-V")
if(NOT CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
string(APPEND CMAKE_CXX_FLAGS " -timplicit_local -no_implicit_include ")
endif()
endif()
......@@ -436,7 +436,7 @@ set(CMAKE_CXX_EXTENSIONS TRUE)
# template support also need a flag to use the newer C++ library.
if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND
CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA")
string(APPEND CMAKE_CXX_FLAGS " -AA")
endif ()
# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers
......
#
# Create exe.
#
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
string(APPEND CMAKE_CXX_FLAGS " -DTEST_CXX_FLAGS")
string(APPEND CMAKE_C_FLAGS " -DTEST_C_FLAGS")
# Create an imported target for if(TARGET) test below.
add_library(ExeImportedTarget UNKNOWN IMPORTED)
......
......@@ -43,7 +43,7 @@ endif()
#
set(SharedLibrarySources sharedFile)
add_library(CMakeTestLibraryShared SHARED ${SharedLibrarySources})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
string(APPEND CMAKE_C_FLAGS " -DTEST_C_FLAGS")
add_library(CMakeTestCLibraryShared SHARED testConly.c)
define_property(
TARGET PROPERTY FOO
......
......@@ -180,5 +180,5 @@ endforeach()
set(FOREACH_CONCAT "")
foreach (INDEX a;b;c;d;e;f;g)
set(FOREACH_CONCAT "${FOREACH_CONCAT}${INDEX}")
string(APPEND FOREACH_CONCAT "${INDEX}")
endforeach()
......@@ -88,7 +88,7 @@ endif()
if(CMAKE_SYSTEM MATCHES "OSF1-V")
if(NOT CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -timplicit_local -no_implicit_include ")
string(APPEND CMAKE_CXX_FLAGS " -timplicit_local -no_implicit_include ")
endif()
endif()
......@@ -399,7 +399,7 @@ set(CMAKE_CXX_EXTENSIONS TRUE)
# template support also need a flag to use the newer C++ library.
if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND
CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA")
string(APPEND CMAKE_CXX_FLAGS " -AA")
endif ()
# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers
......
#
# Create exe.
#
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DTEST_CXX_FLAGS")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
string(APPEND CMAKE_CXX_FLAGS " -DTEST_CXX_FLAGS")
string(APPEND CMAKE_C_FLAGS " -DTEST_C_FLAGS")
# Create an imported target for if(TARGET) test below.
add_library(ExeImportedTarget UNKNOWN IMPORTED)
......
......@@ -43,7 +43,7 @@ endif()
#
set(SharedLibrarySources sharedFile)
add_library(CMakeTestLibraryShared SHARED ${SharedLibrarySources})
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DTEST_C_FLAGS")
string(APPEND CMAKE_C_FLAGS " -DTEST_C_FLAGS")
add_library(CMakeTestCLibraryShared SHARED testConly.c)
define_property(
TARGET PROPERTY FOO
......
......@@ -180,5 +180,5 @@ endforeach()
set(FOREACH_CONCAT "")
foreach (INDEX a;b;c;d;e;f;g)
set(FOREACH_CONCAT "${FOREACH_CONCAT}${INDEX}")
string(APPEND FOREACH_CONCAT "${INDEX}")
endforeach()
......@@ -376,8 +376,8 @@ foreach(arg ${CHECK_ARGS} "")
set(ARG "${arg}")
string(REPLACE "\\" "\\\\" ARG "${ARG}")
string(REPLACE "\"" "\\\"" ARG "${ARG}")
set(EXPECTED_ARGUMENTS
"${EXPECTED_ARGUMENTS} \"${ARG}\",
string(APPEND EXPECTED_ARGUMENTS
" \"${ARG}\",
")
endforeach()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/check_command_line.c.in
......@@ -476,7 +476,7 @@ add_custom_command(
add_library(NormOutput "${gen_file}")
set(gen_path "${gen_path}/bar")
string(APPEND gen_path "/bar")
set(gen_file "${gen_path}/bar.cxx")
add_custom_command(
......
......@@ -333,7 +333,7 @@ endif()
# Choose a unique version.
string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
string(RANDOM LENGTH 4 ALPHABET "0123456789" v)
set(version "${version}.${v}")
string(APPEND version ".${v}")
message(STATUS "Preparing export(PACKAGE) test project")
try_compile(EXPORTER_COMPILED
......
......@@ -188,7 +188,7 @@ if(TEST_MODULE_DEPENDS)
if("${testf_BINARY_DIR}" MATCHES " ")
# Our build tree has a space, so the build tool supports spaces.
# Test using modules from a path with spaces.
set(External_BINARY_DIR "${External_BINARY_DIR} Build")
string(APPEND External_BINARY_DIR " Build")
endif()
add_custom_command(
OUTPUT ${testf_BINARY_DIR}/ExternalProject
......
......@@ -39,9 +39,9 @@ if(WATCOM OR MSVC60)
set(USE_FULLPATH FALSE)
endif()
if(USE_FULLPATH)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} \"-I${CMAKE_BINARY_DIR}/Flags\"")
string(APPEND CMAKE_CXX_FLAGS " \"-I${CMAKE_BINARY_DIR}/Flags\"")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -IFlags")
string(APPEND CMAKE_CXX_FLAGS " -IFlags")
endif()
include_directories(${CMAKE_BINARY_DIR}/IncDir)
......
......@@ -34,7 +34,7 @@ endforeach()
# Configure an executable to check that all the files are missing.
set(CHECK_FILES)
foreach(f ${TOCLEAN_FILES})
set(CHECK_FILES "${CHECK_FILES} \"${f}\",\n")
string(APPEND CHECK_FILES " \"${f}\",\n")
endforeach()
configure_file(${MakeClean_SOURCE_DIR}/check_clean.c.in
${MakeClean_BINARY_DIR}/check_clean.c @ONLY)
......
......@@ -16,7 +16,7 @@ set(FILE_EXPRESSIONS "")
foreach(expression
${expressions})
math(EXPR expr "${expression}")
set(FILE_EXPRESSIONS "${FILE_EXPRESSIONS}TEST_EXPRESSION(${expression}, ${expr})\n")
string(APPEND FILE_EXPRESSIONS "TEST_EXPRESSION(${expression}, ${expr})\n")
endforeach()
configure_file(
......
......@@ -64,7 +64,7 @@ set(CMAKE_CXX_STANDARD 98)
# template support also need a flag to use the newer C++ library.
if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND
CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA")
string(APPEND CMAKE_CXX_FLAGS " -AA")
endif ()
# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers
......@@ -103,7 +103,7 @@ endif()
if (CMAKE_COMPILER_IS_GNUCXX OR (${CMAKE_CXX_COMPILER_ID} MATCHES Clang))
# No need to clutter the test output with warnings.
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations")
string(APPEND CMAKE_CXX_FLAGS " -Wno-deprecated-declarations")
endif()
if(MSVC AND COMPILER_HAS_DEPRECATED)
......
......@@ -32,7 +32,7 @@ set(CMAKE_CXX_STANDARD 98)
# template support also need a flag to use the newer C++ library.
if (CMAKE_CXX_COMPILER_ID STREQUAL HP AND
CMAKE_CXX98_STANDARD_COMPILE_OPTION STREQUAL "+hpxstd98")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -AA")
string(APPEND CMAKE_CXX_FLAGS " -AA")
endif ()
# Clang/C2 in C++98 mode cannot properly handle some of MSVC headers
......
......@@ -57,7 +57,7 @@ if(NOT BORLAND AND NOT PP_VS70)
set(SEMICOLON "\;")
endif()
set(STRING_EXTRA "${STRING_EXTRA} ")
string(APPEND STRING_EXTRA " ")
if(NOT PP_BORLAND AND NOT PP_WATCOM)
# Borland, WMake: multiple spaces
......@@ -65,7 +65,7 @@ if(NOT PP_BORLAND AND NOT PP_WATCOM)
# quoted strings when passing to the compiler. It does not have
# trouble passing to other tools, and the compiler may be directly
# invoked from the command line.
set(STRING_EXTRA "${STRING_EXTRA} ")
string(APPEND STRING_EXTRA " ")
endif()
if(NOT PP_VS)
......@@ -73,21 +73,21 @@ if(NOT PP_VS)
# Visual Studio will not accept a comma in the value of a definition.
# The comma-separated list of PreprocessorDefinitions in the project
# file seems to be parsed before the content of entries is examined.
set(STRING_EXTRA "${STRING_EXTRA},")
string(APPEND STRING_EXTRA ",")
endif()
if(NOT PP_MINGW)
# MinGW: &
# When inside -D"FOO=\"a & b\"" MinGW make wants -D"FOO=\"a "&" b\""
# but it does not like quoted ampersand elsewhere.
set(STRING_EXTRA "${STRING_EXTRA}&")
string(APPEND STRING_EXTRA "&")
endif()
if(NOT PP_MINGW)
# MinGW: |
# When inside -D"FOO=\"a | b\"" MinGW make wants -D"FOO=\"a "|" b\""
# but it does not like quoted pipe elsewhere.
set(STRING_EXTRA "${STRING_EXTRA}|")
string(APPEND STRING_EXTRA "|")
endif()
if(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE)
......@@ -95,13 +95,13 @@ if(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE)
# When inside -D"FOO=\"a ^ b\"" the make tools want -D"FOO=\"a "^" b\""
# but do not like quoted carrot elsewhere. In NMake the non-quoted
# syntax works when the flags are not in a make variable.
set(STRING_EXTRA "${STRING_EXTRA}^")
string(APPEND STRING_EXTRA "^")
endif()
if(NOT PP_BORLAND AND NOT PP_MINGW AND NOT PP_NMAKE)
# Borland, MinGW: < >
# Angle-brackets have funny behavior that is hard to escape.
set(STRING_EXTRA "${STRING_EXTRA}<>")
string(APPEND STRING_EXTRA "<>")
endif()
set(EXPR_OP1 "/")
......@@ -122,7 +122,7 @@ if((NOT MSVC OR PP_NMAKE) AND
# be written just '%'. However nmake requires '%%' except when using
# response files. Currently we have no way to affect escaping based
# on whether flags go in a response file, so we just have to skip it.
set(STRING_EXTRA "${STRING_EXTRA}%")
string(APPEND STRING_EXTRA "%")
set(EXPR_OP1 "%")
endif()
......@@ -130,9 +130,9 @@ endif()
# The XL compiler cannot pass unbalanced parens correctly to a tool
# it launches internally.
if(CMAKE_C_COMPILER_ID STREQUAL "XL")
set(STRING_EXTRA "${STRING_EXTRA}()")
string(APPEND STRING_EXTRA "()")
else()
set(STRING_EXTRA "${STRING_EXTRA})(")
string(APPEND STRING_EXTRA ")(")
endif()
# General: \"
......@@ -146,7 +146,7 @@ endif()
# internal tool to do preprocessing .
if((PP_NMAKE OR PP_UMAKE) AND
NOT CMAKE_C_COMPILER_ID STREQUAL "XL")
set(STRING_EXTRA "${STRING_EXTRA}\\\"")
string(APPEND STRING_EXTRA "\\\"")
endif()
# General: #
......@@ -183,15 +183,15 @@ set(EXPR "x*y+!(x==(y+1*2))*f(x${EXPR_OP1}2)")
if(NOT WATCOM)
# Watcom does not support - or / because it parses them as options.
set(EXPR "${EXPR} + y/x-x")
string(APPEND EXPR " + y/x-x")
endif()
#-----------------------------------------------------------------------------
# Inform the test if the debug configuration is getting built.
# The NDEBUG definition takes care of this for release.
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -DPREPROCESS_DEBUG")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DPREPROCESS_DEBUG")
string(APPEND CMAKE_C_FLAGS_DEBUG " -DPREPROCESS_DEBUG")
string(APPEND CMAKE_CXX_FLAGS_DEBUG " -DPREPROCESS_DEBUG")
# Inform the test if it built from Xcode.
if(PP_XCODE)
......@@ -265,7 +265,7 @@ add_custom_target(drive COMMAND Preprocess)
# Configure the header file with the desired string value.
if(SEMICOLON)
set(STRING_VALUE "${STRING_VALUE};")
string(APPEND STRING_VALUE ";")
endif()
configure_file(${Preprocess_SOURCE_DIR}/preprocess.h.in
${Preprocess_BINARY_DIR}/preprocess.h)
......
......@@ -6,7 +6,7 @@ if(EXISTS ${RunCMake_TEST_BINARY_DIR}/check-debug.cmake)
foreach(exe IN LISTS check_exes)
execute_process(COMMAND ${exe} RESULT_VARIABLE res)
if(NOT res EQUAL ${check_step})
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}
string(APPEND RunCMake_TEST_FAILED "
'${exe}' returned '${res}' but expected '${check_step}'
")
endif()
......@@ -16,15 +16,15 @@ if(EXISTS ${RunCMake_TEST_BINARY_DIR}/check-debug.cmake)
set(lhs "${CMAKE_MATCH_1}")
set(rhs "${CMAKE_MATCH_2}")
if(NOT EXISTS "${lhs}")
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}
string(APPEND RunCMake_TEST_FAILED "
'${lhs}' missing
")
elseif(NOT EXISTS "${rhs}")
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}
string(APPEND RunCMake_TEST_FAILED "
'${rhs}' missing
")
elseif(NOT "${lhs}" IS_NEWER_THAN "${rhs}")
set(RunCMake_TEST_FAILED "${RunCMake_TEST_FAILED}
string(APPEND RunCMake_TEST_FAILED "
'${lhs}' is not newer than '${rhs}'
")
endif()
......
......@@ -25,7 +25,7 @@ while(NOT LOOP_VAR STREQUAL "xx")
cmake_policy(SET CMP0054 NEW)
set(LOOP_VAR "${LOOP_VAR}x")
string(APPEND LOOP_VAR "x")
endwhile()
while("FOO" STREQUAL BAR)
......@@ -57,7 +57,7 @@ while(NOT LOOP_VAR STREQUAL "xx")
cmake_policy(SET CMP0054 OLD)
set(LOOP_VAR "${LOOP_VAR}x")
string(APPEND LOOP_VAR "x")
endwhile()
if(NOT "FOO" STREQUAL BAR)
......
......@@ -40,13 +40,13 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR)
set(error_extra " Extra: install files '${deb_install_files}'")
if(deb_install_files_errors)
set(error_extra "${error_extra}; errors \"${deb_install_files_errors}\"")
string(APPEND error_extra "; errors \"${deb_install_files_errors}\"")
endif()
find_program(READELF_EXECUTABLE NAMES readelf)
if(READELF_EXECUTABLE)
set(error_extra "${error_extra}; readelf \"\n")
string(APPEND error_extra "; readelf \"\n")
# Only dynamically linked ELF files are included
# Extract only file name infront of ":"
......@@ -61,13 +61,13 @@ function(getMissingShlibsErrorExtra FILE RESULT_VAR)
ERROR_VARIABLE err_
OUTPUT_STRIP_TRAILING_WHITESPACE)
set(error_extra "${error_extra} name '${CMAKE_MATCH_1}'\n result '${result}'\n output '${output}'\n error '${err_}'\n")
string(APPEND error_extra " name '${CMAKE_MATCH_1}'\n result '${result}'\n output '${output}'\n error '${err_}'\n")
endif()
endforeach()
set(error_extra "${error_extra}\"")
string(APPEND error_extra "\"")
else()
set(error_extra "${error_extra}; error readelf missing")
string(APPEND error_extra "; error readelf missing")
endif()
endif()
......
......@@ -16,7 +16,7 @@ include("${src_dir}/${GENERATOR_TYPE}/${RunCMake_TEST}-ExpectedFiles.cmake")
if(NOT EXPECTED_FILES_COUNT EQUAL 0)
foreach(file_no_ RANGE 1 ${EXPECTED_FILES_COUNT})
file(GLOB FOUND_FILE_${file_no_} RELATIVE "${bin_dir}" "${EXPECTED_FILE_${file_no_}}")
set(foundFiles_ "${foundFiles_};${FOUND_FILE_${file_no_}}")
string(APPEND foundFiles_ ";${FOUND_FILE_${file_no_}}")
list(LENGTH FOUND_FILE_${file_no_} foundFilesCount_)
if(foundFilesCount_ EQUAL 1)
......@@ -45,7 +45,7 @@ if(NOT EXPECTED_FILES_COUNT EQUAL 0)
# check that there were no extra files generated
foreach(all_files_glob_ IN LISTS ALL_FILES_GLOB)
file(GLOB foundAll_ RELATIVE "${bin_dir}" "${all_files_glob_}")
set(allFoundFiles_ "${allFoundFiles_};${foundAll_}")
string(APPEND allFoundFiles_ ";${foundAll_}")
endforeach()
list(LENGTH foundFiles_ foundFilesCount_)
......
......@@ -95,7 +95,7 @@ function(run_cmake test)
endif()
set(msg "")
if(NOT "${actual_result}" MATCHES "${expect_result}")
set(msg "${msg}Result is [${actual_result}], not [${expect_result}].\n")
string(APPEND msg "Result is [${actual_result}], not [${expect_result}].\n")
endif()
foreach(o out err)
string(REGEX REPLACE "\r\n" "\n" actual_std${o} "${actual_std${o}}")
......@@ -107,7 +107,7 @@ function(run_cmake test)
string(REGEX REPLACE "\n" "\n expect-${o}> " expect_${o}
" expect-${o}> ${expect_std${o}}")
set(expect_${o} "Expected std${o} to match:\n${expect_${o}}\n")
set(msg "${msg}std${o} does not match that expected.\n")
string(APPEND msg "std${o} does not match that expected.\n")
endif()
endif()
endforeach()
......@@ -122,7 +122,7 @@ function(run_cmake test)
endif()
if(msg AND RunCMake_TEST_COMMAND)
string(REPLACE ";" "\" \"" command "\"${RunCMake_TEST_COMMAND}\"")
set(msg "${msg}Command was:\n command> ${command}\n")
string(APPEND msg "Command was:\n command> ${command}\n")
endif()
if(msg)
string(REGEX REPLACE "\n" "\n actual-out> " actual_out " actual-out> ${actual_stdout}")
......
message(STATUS "start")
unset(iter)
while(NOT "${iter}" STREQUAL "aaaaa")
set(iter "${iter}a")
string(APPEND iter "a")
if("${iter}" STREQUAL "aaa")
continue()
endif()
......
set(d "/long/path/to/directory")
foreach(i RANGE 11)
set(d "${d}${d}")
string(APPEND d "${d}")
endforeach()
string(LENGTH "${d}" dl)
if(IS_DIRECTORY "${d}/")
......
......@@ -91,7 +91,7 @@ function(check_project test name guid type platform)
if(guid)
check_project_guid("${sln}" "${name}" "${guid}" passed_guid)
if(NOT passed_guid)
set(failed "${failed}${sep}${name} solution has no project with expected GUID=${guid}")
string(APPEND failed "${sep}${name} solution has no project with expected GUID=${guid}")
set(sep "\n")
endif()
else()
......@@ -99,12 +99,12 @@ function(check_project test name guid type platform)
endif()
check_project_type("${sln}" "${name}" "${type}" passed_type)
if(NOT passed_type)
set(failed "${failed}${sep}${name} solution has no project with expected TYPE=${type}")
string(APPEND failed "${sep}${name} solution has no project with expected TYPE=${type}")
set(sep "\n")
endif()
check_custom_platform("${sln}" "${name}" "${platform}" passed_platform)
if(NOT passed_platform)
set(failed "${failed}${sep}${name} solution has no project with expected PLATFORM=${platform}")
string(APPEND failed "${sep}${name} solution has no project with expected PLATFORM=${platform}")
set(sep "\n")
endif()
set(RunCMake_TEST_FAILED "${failed}" PARENT_SCOPE)
......
......@@ -3,11 +3,11 @@ execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_in
OUTPUT_VARIABLE out ERROR_VARIABLE err)
if(out MATCHES "-- Installing: [^\n]*prefix/dir")
string(REGEX REPLACE "\n" "\n " out " ${out}")
set(RunCMake_TEST_FAILED
"${RunCMake_TEST_FAILED}Installation output was not quiet:\n${out}")
string(APPEND RunCMake_TEST_FAILED
"Installation output was not quiet:\n${out}")
endif()
set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt)
if(NOT EXISTS "${f}")
set(RunCMake_TEST_FAILED
"${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n")
string(APPEND RunCMake_TEST_FAILED
"File was not installed:\n ${f}\n")
endif()
......@@ -7,13 +7,13 @@ set(expect "
")
if(NOT out MATCHES "${expect}")
string(REGEX REPLACE "\n" "\n " out " ${out}")
set(RunCMake_TEST_FAILED
"${RunCMake_TEST_FAILED}First install did not say 'Installing' as expected:\n${out}")
string(APPEND RunCMake_TEST_FAILED
"First install did not say 'Installing' as expected:\n${out}")
endif()
set(f ${RunCMake_TEST_BINARY_DIR}/prefix/dir/empty.txt)
if(NOT EXISTS "${f}")
set(RunCMake_TEST_FAILED
"${RunCMake_TEST_FAILED}File was not installed:\n ${f}\n")
string(APPEND RunCMake_TEST_FAILED