From 5d0d980d9949daf596e10715d686adc95c1c232b Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 28 Jul 2016 00:41:13 +0200 Subject: [PATCH 1/2] Use string(APPEND) in Modules Automate with: find Modules -type f -print0 | xargs -0 perl -i -0pe \ 's/set\(([a-zA-Z0-9_]+)(\s+)"\$\{\1\}([^"])/string(APPEND \1\2"\3/g' --- ...asicConfigVersion-AnyNewerVersion.cmake.in | 2 +- .../BasicConfigVersion-ExactVersion.cmake.in | 2 +- ...sicConfigVersion-SameMajorVersion.cmake.in | 2 +- Modules/CMakeBackwardCompatibilityCXX.cmake | 2 +- Modules/CMakeCommonLanguageInclude.cmake | 6 +- Modules/CMakeCompilerIdDetection.cmake | 8 +-- Modules/CMakeDetermineCompilerId.cmake | 6 +- Modules/CMakeDetermineFortranCompiler.cmake | 6 +- Modules/CMakePackageConfigHelpers.cmake | 8 +-- Modules/CMakeParseImplicitLinkInfo.cmake | 44 ++++++------- Modules/CMakePrintHelpers.cmake | 12 ++-- Modules/CPack.cmake | 2 +- Modules/CPackComponent.cmake | 10 +-- Modules/CPackIFW.cmake | 4 +- Modules/CPackRPM.cmake | 64 +++++++++---------- Modules/CTestUseLaunchers.cmake | 2 +- Modules/CheckIncludeFile.cmake | 2 +- Modules/CheckIncludeFileCXX.cmake | 2 +- Modules/CheckIncludeFiles.cmake | 8 +-- Modules/CheckPrototypeDefinition.cmake | 4 +- Modules/CheckStructHasMember.cmake | 2 +- Modules/CheckSymbolExists.cmake | 8 +-- Modules/CheckTypeSize.cmake | 10 +-- .../AppleClang-DetermineCompiler.cmake | 2 +- Modules/Dart.cmake | 2 +- Modules/DeployQt4.cmake | 4 +- Modules/ExternalData.cmake | 16 ++--- Modules/ExternalProject.cmake | 16 ++--- Modules/FeatureSummary.cmake | 12 ++-- Modules/FindBoost.cmake | 48 +++++++------- Modules/FindCUDA.cmake | 4 +- Modules/FindCUDA/make2cmake.cmake | 2 +- Modules/FindCUDA/run_nvcc.cmake | 2 +- Modules/FindCups.cmake | 2 +- Modules/FindEXPAT.cmake | 2 +- Modules/FindFreetype.cmake | 2 +- Modules/FindMPI.cmake | 8 +-- Modules/FindPHP4.cmake | 8 +-- Modules/FindPackageHandleStandardArgs.cmake | 18 +++--- Modules/FindPkgConfig.cmake | 2 +- Modules/FindQt4.cmake | 2 +- Modules/FindSDL_sound.cmake | 4 +- Modules/FindZLIB.cmake | 2 +- Modules/FindwxWidgets.cmake | 2 +- Modules/FindwxWindows.cmake | 2 +- Modules/FortranCInterface.cmake | 8 +-- Modules/GenerateExportHeader.cmake | 2 +- Modules/GetPrerequisites.cmake | 2 +- Modules/MatlabTestsRedirect.cmake | 2 +- Modules/Platform/BlueGeneQ-base.cmake | 2 +- Modules/Platform/Linux-Intel-Fortran.cmake | 2 +- Modules/Platform/Windows-MSVC.cmake | 2 +- Modules/Qt4Macros.cmake | 4 +- Modules/UseJava.cmake | 6 +- Modules/UseSWIG.cmake | 12 ++-- Modules/Use_wxWindows.cmake | 2 +- Modules/UsewxWidgets.cmake | 2 +- Modules/WriteCompilerDetectionHeader.cmake | 56 ++++++++-------- 58 files changed, 240 insertions(+), 240 deletions(-) diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in index bc78016df..3e8c51195 100644 --- a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in +++ b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in @@ -26,6 +26,6 @@ endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + string(APPEND PACKAGE_VERSION " (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) endif() diff --git a/Modules/BasicConfigVersion-ExactVersion.cmake.in b/Modules/BasicConfigVersion-ExactVersion.cmake.in index de4a23af0..5741007cc 100644 --- a/Modules/BasicConfigVersion-ExactVersion.cmake.in +++ b/Modules/BasicConfigVersion-ExactVersion.cmake.in @@ -42,6 +42,6 @@ endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + string(APPEND PACKAGE_VERSION " (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) endif() diff --git a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in index a32245dd5..0fad8a329 100644 --- a/Modules/BasicConfigVersion-SameMajorVersion.cmake.in +++ b/Modules/BasicConfigVersion-SameMajorVersion.cmake.in @@ -41,6 +41,6 @@ endif() # check that the installed version has the same 32/64bit-ness as the one which is currently searching: if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "@CMAKE_SIZEOF_VOID_P@") math(EXPR installedBits "@CMAKE_SIZEOF_VOID_P@ * 8") - set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") + string(APPEND PACKAGE_VERSION " (${installedBits}bit)") set(PACKAGE_VERSION_UNSUITABLE TRUE) endif() diff --git a/Modules/CMakeBackwardCompatibilityCXX.cmake b/Modules/CMakeBackwardCompatibilityCXX.cmake index f1db46e54..f4044e598 100644 --- a/Modules/CMakeBackwardCompatibilityCXX.cmake +++ b/Modules/CMakeBackwardCompatibilityCXX.cmake @@ -50,7 +50,7 @@ if(NOT CMAKE_SKIP_COMPATIBILITY_TESTS) endif() endif() set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_ANSI_CXXFLAGS}") + string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_ANSI_CXXFLAGS}") include(TestForANSIStreamHeaders) include(CheckIncludeFileCXX) include(TestForSTDNamespace) diff --git a/Modules/CMakeCommonLanguageInclude.cmake b/Modules/CMakeCommonLanguageInclude.cmake index 6b372089e..8bf72886b 100644 --- a/Modules/CMakeCommonLanguageInclude.cmake +++ b/Modules/CMakeCommonLanguageInclude.cmake @@ -16,9 +16,9 @@ # cache values that can be initialized in the platform-compiler.cmake file # it may be included by more than one language. -set(CMAKE_EXE_LINKER_FLAGS_INIT "${CMAKE_EXE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}") -set(CMAKE_SHARED_LINKER_FLAGS_INIT "${CMAKE_SHARED_LINKER_FLAGS_INIT} $ENV{LDFLAGS}") -set(CMAKE_MODULE_LINKER_FLAGS_INIT "${CMAKE_MODULE_LINKER_FLAGS_INIT} $ENV{LDFLAGS}") +string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}") +string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " $ENV{LDFLAGS}") +string(APPEND CMAKE_MODULE_LINKER_FLAGS_INIT " $ENV{LDFLAGS}") foreach(t EXE SHARED MODULE STATIC) foreach(c "" _DEBUG _RELEASE _MINSIZEREL _RELWITHDEBINFO) diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 1d341e516..17e530247 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -120,18 +120,18 @@ function(compiler_id_detection outvar lang) if (CID_ID_STRING) set(PREFIX ${CID_PREFIX}) string(CONFIGURE "${_compiler_id_simulate_${Id}}" SIMULATE_BLOCK @ONLY) - set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}") + string(APPEND id_content "# define ${CID_PREFIX}COMPILER_ID \"${Id}\"${SIMULATE_BLOCK}") endif() if (CID_ID_DEFINE) - set(id_content "${id_content}# undef ${CID_PREFIX}COMPILER_IS_${Id}\n") - set(id_content "${id_content}# define ${CID_PREFIX}COMPILER_IS_${Id} 1\n") + string(APPEND id_content "# undef ${CID_PREFIX}COMPILER_IS_${Id}\n") + string(APPEND id_content "# define ${CID_PREFIX}COMPILER_IS_${Id} 1\n") endif() if (CID_VERSION_STRINGS) set(PREFIX ${CID_PREFIX}) set(MACRO_DEC DEC) set(MACRO_HEX HEX) string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY) - set(id_content "${id_content}${VERSION_BLOCK}\n") + string(APPEND id_content "${VERSION_BLOCK}\n") endif() set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${id_content}") set(pp_if "#elif") diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 70ceaa6f8..64d9bed87 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -493,11 +493,11 @@ function(CMAKE_DETERMINE_COMPILER_ID_CHECK lang file) if(NOT DEFINED COMPILER_VERSION AND HAVE_COMPILER_VERSION_MAJOR) set(COMPILER_VERSION "${COMPILER_VERSION_MAJOR}") if(HAVE_COMPILER_VERSION_MINOR) - set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_MINOR}") + string(APPEND COMPILER_VERSION ".${COMPILER_VERSION_MINOR}") if(HAVE_COMPILER_VERSION_PATCH) - set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_PATCH}") + string(APPEND COMPILER_VERSION ".${COMPILER_VERSION_PATCH}") if(HAVE_COMPILER_VERSION_TWEAK) - set(COMPILER_VERSION "${COMPILER_VERSION}.${COMPILER_VERSION_TWEAK}") + string(APPEND COMPILER_VERSION ".${COMPILER_VERSION_TWEAK}") endif() endif() endif() diff --git a/Modules/CMakeDetermineFortranCompiler.cmake b/Modules/CMakeDetermineFortranCompiler.cmake index 0f27a789c..596fc5fd7 100644 --- a/Modules/CMakeDetermineFortranCompiler.cmake +++ b/Modules/CMakeDetermineFortranCompiler.cmake @@ -141,10 +141,10 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) set(_version_info "") foreach(m MAJOR MINOR PATCH TWEAK) set(_COMP "_${m}") - set(_version_info "${_version_info} + string(APPEND _version_info " #if defined(COMPILER_VERSION${_COMP})") foreach(d 1 2 3 4 5 6 7 8) - set(_version_info "${_version_info} + string(APPEND _version_info " # undef DEC # undef HEX # define DEC(n) DEC_${d}(n) @@ -172,7 +172,7 @@ if(NOT CMAKE_Fortran_COMPILER_ID_RUN) # endif ") endforeach() - set(_version_info "${_version_info} + string(APPEND _version_info " #endif") endforeach() set(CMAKE_Fortran_COMPILER_ID_VERSION_INFO "${_version_info}") diff --git a/Modules/CMakePackageConfigHelpers.cmake b/Modules/CMakePackageConfigHelpers.cmake index 5e5302fcc..828ea9e3f 100644 --- a/Modules/CMakePackageConfigHelpers.cmake +++ b/Modules/CMakePackageConfigHelpers.cmake @@ -280,7 +280,7 @@ get_filename_component(PACKAGE_PREFIX_DIR \"\${CMAKE_CURRENT_LIST_DIR}/${PACKAGE if("${absInstallDir}" MATCHES "^(/usr)?/lib(64)?/.+") # Handle "/usr move" symlinks created by some Linux distros. - set(PACKAGE_INIT "${PACKAGE_INIT} + string(APPEND PACKAGE_INIT " # Use original install prefix when loaded through a \"/usr move\" # cross-prefix symbolic link such as /lib -> /usr/lib. get_filename_component(_realCurr \"\${CMAKE_CURRENT_LIST_DIR}\" REALPATH) @@ -294,7 +294,7 @@ unset(_realCurr) endif() if(NOT CCF_NO_SET_AND_CHECK_MACRO) - set(PACKAGE_INIT "${PACKAGE_INIT} + string(APPEND PACKAGE_INIT " macro(set_and_check _var _file) set(\${_var} \"\${_file}\") if(NOT EXISTS \"\${_file}\") @@ -306,7 +306,7 @@ endmacro() if(NOT CCF_NO_CHECK_REQUIRED_COMPONENTS_MACRO) - set(PACKAGE_INIT "${PACKAGE_INIT} + string(APPEND PACKAGE_INIT " macro(check_required_components _NAME) foreach(comp \${\${_NAME}_FIND_COMPONENTS}) if(NOT \${_NAME}_\${comp}_FOUND) @@ -319,7 +319,7 @@ endmacro() ") endif() - set(PACKAGE_INIT "${PACKAGE_INIT} + string(APPEND PACKAGE_INIT " ####################################################################################") configure_file("${_inputFile}" "${_outputFile}" @ONLY) diff --git a/Modules/CMakeParseImplicitLinkInfo.cmake b/Modules/CMakeParseImplicitLinkInfo.cmake index da029bc4d..f6d07e50b 100644 --- a/Modules/CMakeParseImplicitLinkInfo.cmake +++ b/Modules/CMakeParseImplicitLinkInfo.cmake @@ -32,7 +32,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj # whole line and just the command (argv[0]). set(linker_regex "^( *|.*[/\\])(${linker}|([^/\\]+-)?ld|collect2)[^/\\]*( |$)") set(linker_exclude_regex "collect2 version |^[A-Za-z0-9_]+=|/ldfe ") - set(log "${log} link line regex: [${linker_regex}]\n") + string(APPEND log " link line regex: [${linker_regex}]\n") string(REGEX REPLACE "\r?\n" ";" output_lines "${text}") foreach(line IN LISTS output_lines) set(cmd) @@ -44,7 +44,7 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj string(REGEX REPLACE "([][+.*()^])" "\\\\\\1" _dir_regex "${CMAKE_BINARY_DIR}") string(REGEX REPLACE " -[FL]${_dir_regex}/([^ ]| [^-])+( |$)" " " xline "${line}") if(NOT "x${xline}" STREQUAL "x${line}") - set(log "${log} reduced line: [${line}]\n to: [${xline}]\n") + string(APPEND log " reduced line: [${line}]\n to: [${xline}]\n") set(line "${xline}") endif() endif() @@ -56,67 +56,67 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj list(GET args 0 cmd) endif() if("${cmd}" MATCHES "${linker_regex}") - set(log "${log} link line: [${line}]\n") + string(APPEND log " link line: [${line}]\n") string(REGEX REPLACE ";-([LYz]);" ";-\\1" args "${args}") foreach(arg IN LISTS args) if("${arg}" MATCHES "^-L(.:)?[/\\]") # Unix search path. string(REGEX REPLACE "^-L" "" dir "${arg}") list(APPEND implicit_dirs_tmp ${dir}) - set(log "${log} arg [${arg}] ==> dir [${dir}]\n") + string(APPEND log " arg [${arg}] ==> dir [${dir}]\n") elseif("${arg}" MATCHES "^-l([^:].*)$") # Unix library. set(lib "${CMAKE_MATCH_1}") list(APPEND implicit_libs_tmp ${lib}) - set(log "${log} arg [${arg}] ==> lib [${lib}]\n") + string(APPEND log " arg [${arg}] ==> lib [${lib}]\n") elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.a$") # Unix library full path. list(APPEND implicit_libs_tmp ${arg}) - set(log "${log} arg [${arg}] ==> lib [${arg}]\n") + string(APPEND log " arg [${arg}] ==> lib [${arg}]\n") elseif("${arg}" MATCHES "^(.:)?[/\\].*\\.o$" AND obj_regex AND "${arg}" MATCHES "${obj_regex}") # Object file full path. list(APPEND implicit_libs_tmp ${arg}) - set(log "${log} arg [${arg}] ==> obj [${arg}]\n") + string(APPEND log " arg [${arg}] ==> obj [${arg}]\n") elseif("${arg}" MATCHES "^-Y(P,)?[^0-9]") # Sun search path ([^0-9] avoids conflict with Mac -Y). string(REGEX REPLACE "^-Y(P,)?" "" dirs "${arg}") string(REPLACE ":" ";" dirs "${dirs}") list(APPEND implicit_dirs_tmp ${dirs}) - set(log "${log} arg [${arg}] ==> dirs [${dirs}]\n") + string(APPEND log " arg [${arg}] ==> dirs [${dirs}]\n") elseif("${arg}" MATCHES "^-l:") # HP named library. list(APPEND implicit_libs_tmp ${arg}) - set(log "${log} arg [${arg}] ==> lib [${arg}]\n") + string(APPEND log " arg [${arg}] ==> lib [${arg}]\n") elseif("${arg}" MATCHES "^-z(all|default|weak)extract") # Link editor option. list(APPEND implicit_libs_tmp ${arg}) - set(log "${log} arg [${arg}] ==> opt [${arg}]\n") + string(APPEND log " arg [${arg}] ==> opt [${arg}]\n") else() - set(log "${log} arg [${arg}] ==> ignore\n") + string(APPEND log " arg [${arg}] ==> ignore\n") endif() endforeach() break() elseif("${line}" MATCHES "LPATH(=| is:? *)(.*)$") - set(log "${log} LPATH line: [${line}]\n") + string(APPEND log " LPATH line: [${line}]\n") # HP search path. string(REPLACE ":" ";" paths "${CMAKE_MATCH_2}") list(APPEND implicit_dirs_tmp ${paths}) - set(log "${log} dirs [${paths}]\n") + string(APPEND log " dirs [${paths}]\n") else() - set(log "${log} ignore line: [${line}]\n") + string(APPEND log " ignore line: [${line}]\n") endif() endforeach() # Look for library search paths reported by linker. if("${output_lines}" MATCHES ";Library search paths:((;\t[^;]+)+)") string(REPLACE ";\t" ";" implicit_dirs_match "${CMAKE_MATCH_1}") - set(log "${log} Library search paths: [${implicit_dirs_match}]\n") + string(APPEND log " Library search paths: [${implicit_dirs_match}]\n") list(APPEND implicit_dirs_tmp ${implicit_dirs_match}) endif() if("${output_lines}" MATCHES ";Framework search paths:((;\t[^;]+)+)") string(REPLACE ";\t" ";" implicit_fwks_match "${CMAKE_MATCH_1}") - set(log "${log} Framework search paths: [${implicit_fwks_match}]\n") + string(APPEND log " Framework search paths: [${implicit_fwks_match}]\n") list(APPEND implicit_fwks_tmp ${implicit_fwks_match}) endif() @@ -125,11 +125,11 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj set(implicit_libs "") foreach(lib IN LISTS implicit_libs_tmp) if("x${lib}" MATCHES "^x(crt.*\\.o|gcc.*|System.*|.*libclang_rt.*)$") - set(log "${log} remove lib [${lib}]\n") + string(APPEND log " remove lib [${lib}]\n") elseif(IS_ABSOLUTE "${lib}") get_filename_component(abs "${lib}" ABSOLUTE) if(NOT "x${lib}" STREQUAL "x${abs}") - set(log "${log} collapse lib [${lib}] ==> [${abs}]\n") + string(APPEND log " collapse lib [${lib}] ==> [${abs}]\n") endif() list(APPEND implicit_libs "${abs}") else() @@ -151,15 +151,15 @@ function(CMAKE_PARSE_IMPLICIT_LINK_INFO text lib_var dir_var fwk_var log_var obj set(msg "") list(APPEND implicit_${t} "${dir}") endif() - set(log "${log} collapse ${desc_${t}} dir [${d}] ==> [${dir}]${msg}\n") + string(APPEND log " collapse ${desc_${t}} dir [${d}] ==> [${dir}]${msg}\n") endforeach() list(REMOVE_DUPLICATES implicit_${t}) endforeach() # Log results. - set(log "${log} implicit libs: [${implicit_libs}]\n") - set(log "${log} implicit dirs: [${implicit_dirs}]\n") - set(log "${log} implicit fwks: [${implicit_fwks}]\n") + string(APPEND log " implicit libs: [${implicit_libs}]\n") + string(APPEND log " implicit dirs: [${implicit_dirs}]\n") + string(APPEND log " implicit fwks: [${implicit_fwks}]\n") # Return results. set(${lib_var} "${implicit_libs}" PARENT_SCOPE) diff --git a/Modules/CMakePrintHelpers.cmake b/Modules/CMakePrintHelpers.cmake index 474fa41b9..61a090941 100644 --- a/Modules/CMakePrintHelpers.cmake +++ b/Modules/CMakePrintHelpers.cmake @@ -55,9 +55,9 @@ function(CMAKE_PRINT_VARIABLES) set(msg "") foreach(var ${ARGN}) if(msg) - set(msg "${msg} ; ") + string(APPEND msg " ; ") endif() - set(msg "${msg}${var}=\"${${var}}\"") + string(APPEND msg "${var}=\"${${var}}\"") endforeach() message(STATUS "${msg}") endfunction() @@ -132,21 +132,21 @@ function(CMAKE_PRINT_PROPERTIES ) if(keyword STREQUAL "TARGET") if(NOT TARGET ${item}) set(itemExists FALSE) - set(msg "${msg}\n No such TARGET \"${item}\" !\n\n") + string(APPEND msg "\n No such TARGET \"${item}\" !\n\n") endif() endif() if (itemExists) - set(msg "${msg} Properties for ${keyword} ${item}:\n") + string(APPEND msg " Properties for ${keyword} ${item}:\n") foreach(prop ${CPP_PROPERTIES}) get_property(propertySet ${keyword} ${item} PROPERTY "${prop}" SET) if(propertySet) get_property(property ${keyword} ${item} PROPERTY "${prop}") - set(msg "${msg} ${item}.${prop} = \"${property}\"\n") + string(APPEND msg " ${item}.${prop} = \"${property}\"\n") else() - set(msg "${msg} ${item}.${prop} = \n") + string(APPEND msg " ${item}.${prop} = \n") endif() endforeach() endif() diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 4d51a3ee3..675b38ba6 100644 --- a/Modules/CPack.cmake +++ b/Modules/CPack.cmake @@ -332,7 +332,7 @@ function(cpack_encode_variables) set(value "${${var}}") endif() - set(commands "${commands}\nSET(${var} \"${value}\")") + string(APPEND commands "\nSET(${var} \"${value}\")") endif() endforeach() diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 6a330867e..085992a02 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -409,11 +409,11 @@ macro(cpack_add_component compname) # moduled was included. if(NOT CPACK_COMPONENTS_ALL_SET_BY_USER) get_cmake_property(_CPACK_ADDCOMP_COMPONENTS COMPONENTS) - set(_CPACK_ADDCOMP_STR "${_CPACK_ADDCOMP_STR}\nSET(CPACK_COMPONENTS_ALL") + string(APPEND _CPACK_ADDCOMP_STR "\nSET(CPACK_COMPONENTS_ALL") foreach(COMP ${_CPACK_ADDCOMP_COMPONENTS}) - set(_CPACK_ADDCOMP_STR "${_CPACK_ADDCOMP_STR} ${COMP}") + string(APPEND _CPACK_ADDCOMP_STR " ${COMP}") endforeach() - set(_CPACK_ADDCOMP_STR "${_CPACK_ADDCOMP_STR})\n") + string(APPEND _CPACK_ADDCOMP_STR ")\n") endif() endif() @@ -501,8 +501,8 @@ macro(cpack_add_install_type insttype) set(_CPACK_INSTTYPE_STR "\n# Configuration for installation type \"${insttype}\"\n") - set(_CPACK_INSTTYPE_STR - "${_CPACK_INSTTYPE_STR}list(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n") + string(APPEND _CPACK_INSTTYPE_STR + "list(APPEND CPACK_ALL_INSTALL_TYPES ${insttype})\n") cpack_append_string_variable_set_command( CPACK_INSTALL_TYPE_${_CPACK_INSTTYPE_UNAME}_DISPLAY_NAME _CPACK_INSTTYPE_STR) diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 2f0e03efd..ebc5c90d8 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -645,7 +645,7 @@ macro(cpack_ifw_add_repository reponame) endforeach() list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame}) - set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n") + string(APPEND _CPACK_IFWREPO_STR "list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n") if(CPack_CMake_INCLUDED) file(APPEND "${CPACK_OUTPUT_CONFIG_FILE}" "${_CPACK_IFWREPO_STR}") @@ -687,7 +687,7 @@ macro(cpack_ifw_update_repository reponame) OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REMOVE OR CPACK_IFW_REPOSITORY_${_CPACK_IFWREPO_UNAME}_REPLACE) list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame}) - set(_CPACK_IFWREPO_STR "${_CPACK_IFWREPO_STR}list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n") + string(APPEND _CPACK_IFWREPO_STR "list(APPEND CPACK_IFW_REPOSITORIES_ALL ${reponame})\n") else() set(_CPACK_IFWREPO_STR) endif() diff --git a/Modules/CPackRPM.cmake b/Modules/CPackRPM.cmake index 0ce6486df..c19574684 100644 --- a/Modules/CPackRPM.cmake +++ b/Modules/CPackRPM.cmake @@ -761,7 +761,7 @@ function(cpack_rpm_prepare_relocation_paths) if(NOT CPACK_RPM_NO_INSTALL_PREFIX_RELOCATION AND NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT}_INSTALL_PREFIX_RELOCATION AND NOT CPACK_RPM_NO_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_INSTALL_PREFIX_RELOCATION) - set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PATH_PREFIX}\n") + string(APPEND TMP_RPM_PREFIXES "Prefix: ${PATH_PREFIX}\n") list(APPEND RPM_USED_PACKAGE_PREFIXES "${PATH_PREFIX}") if(CPACK_RPM_PACKAGE_DEBUG) @@ -779,7 +779,7 @@ function(cpack_rpm_prepare_relocation_paths) endif() if(EXISTS "${WDIR}/${PREPARED_RELOCATION_PATH}") - set(TMP_RPM_PREFIXES "${TMP_RPM_PREFIXES}Prefix: ${PREPARED_RELOCATION_PATH}\n") + string(APPEND TMP_RPM_PREFIXES "Prefix: ${PREPARED_RELOCATION_PATH}\n") list(APPEND RPM_USED_PACKAGE_PREFIXES "${PREPARED_RELOCATION_PATH}") endif() endforeach() @@ -954,7 +954,7 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) if("${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") set(INDENT "") else() - set(SCRIPT_PART "${SCRIPT_PART} if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + string(APPEND SCRIPT_PART " if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") set(INDENT " ") endif() @@ -971,14 +971,14 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") - set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") - set(SCRIPT_PART "${SCRIPT_PART} ${INDENT}fi\n") + string(APPEND SCRIPT_PART " ${INDENT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + string(APPEND SCRIPT_PART " ${INDENT}ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + string(APPEND SCRIPT_PART " ${INDENT}CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + string(APPEND SCRIPT_PART " ${INDENT}fi\n") endforeach() if(NOT "${SYMLINK_INDEX}" EQUAL "${POINT_INDEX}") - set(SCRIPT_PART "${SCRIPT_PART} fi\n") + string(APPEND SCRIPT_PART " fi\n") endif() endif() endforeach() @@ -998,16 +998,16 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - set(SCRIPT_PART "${SCRIPT_PART} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - set(SCRIPT_PART "${SCRIPT_PART} ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") - set(SCRIPT_PART "${SCRIPT_PART} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") - set(SCRIPT_PART "${SCRIPT_PART} fi\n") + string(APPEND SCRIPT_PART " if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + string(APPEND SCRIPT_PART " ln -s \"${POINT_}\" \"$RPM_INSTALL_PREFIX${SYMLINK_INDEX}${SYMLINK_}\"\n") + string(APPEND SCRIPT_PART " CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + string(APPEND SCRIPT_PART " fi\n") endforeach() endif() if(PARTS_CNT) set(SCRIPT "${SCRIPT_PART}") - set(SCRIPT "${SCRIPT}fi\n") + string(APPEND SCRIPT "fi\n") endif() endforeach() @@ -1018,7 +1018,7 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) string(LENGTH "${POINT_PATH}" POINT_PATH_LEN) if(_RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) - set(SCRIPT "${SCRIPT}if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") + string(APPEND SCRIPT "if [ \"$RPM_INSTALL_PREFIX${POINT_INDEX}\" != \"${POINT_PATH}\" ]; then\n") foreach(RELOCATION_NO IN LISTS _RPM_RELOCATION_SCRIPT_X_${POINT_INDEX}) math(EXPR RELOCATION_INDEX ${RELOCATION_NO}-1) @@ -1030,13 +1030,13 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1+${POINT_PATH_LEN}) string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - set(SCRIPT "${SCRIPT} if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - set(SCRIPT "${SCRIPT} ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n") - set(SCRIPT "${SCRIPT} CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") - set(SCRIPT "${SCRIPT} fi\n") + string(APPEND SCRIPT " if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + string(APPEND SCRIPT " ln -s \"$RPM_INSTALL_PREFIX${POINT_INDEX}${POINT_}\" \"${SYMLINK_}\"\n") + string(APPEND SCRIPT " CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}=true\n") + string(APPEND SCRIPT " fi\n") endforeach() - set(SCRIPT "${SCRIPT}fi\n") + string(APPEND SCRIPT "fi\n") endif() endforeach() @@ -1052,9 +1052,9 @@ function(cpack_rpm_symlink_create_relocation_script PACKAGE_PREFIXES) math(EXPR POINT_PATH_START ${SPLIT_INDEX}+1) string(SUBSTRING ${RELOCATION_SCRIPT_PAIR} ${POINT_PATH_START} -1 POINT_) - set(SCRIPT "${SCRIPT}if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") - set(SCRIPT "${SCRIPT} ln -s \"${POINT_}\" \"${SYMLINK_}\"\n") - set(SCRIPT "${SCRIPT}fi\n") + string(APPEND SCRIPT "if [ -z \"$CPACK_RPM_RELOCATED_SYMLINK_${RELOCATION_INDEX}\" ]; then\n") + string(APPEND SCRIPT " ln -s \"${POINT_}\" \"${SYMLINK_}\"\n") + string(APPEND SCRIPT "fi\n") endforeach() endif() @@ -1217,7 +1217,7 @@ function(cpack_rpm_prepare_install_files INSTALL_FILES_LIST WDIR PACKAGE_PREFIXE set(DIRECTIVE "%dir ") endif() - set(INSTALL_FILES "${INSTALL_FILES}${DIRECTIVE}\"${F}\"\n") + string(APPEND INSTALL_FILES "${DIRECTIVE}\"${F}\"\n") endforeach() if(REQUIRES_SYMLINK_RELOCATION_SCRIPT) @@ -1348,7 +1348,7 @@ function(cpack_rpm_generate_package) endif() if(CPACK_RPM_PACKAGE_COMPONENT) - set(CPACK_RPM_PACKAGE_NAME "${CPACK_RPM_PACKAGE_NAME}-${CPACK_RPM_PACKAGE_COMPONENT}") + string(APPEND CPACK_RPM_PACKAGE_NAME "-${CPACK_RPM_PACKAGE_COMPONENT}") cpack_rpm_variable_fallback("CPACK_RPM_PACKAGE_NAME" "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT}_PACKAGE_NAME" "CPACK_RPM_${CPACK_RPM_PACKAGE_COMPONENT_UPPER}_PACKAGE_NAME") @@ -1407,7 +1407,7 @@ function(cpack_rpm_generate_package) endif() if(CPACK_RPM_PACKAGE_RELEASE_DIST) - set(CPACK_RPM_PACKAGE_RELEASE "${CPACK_RPM_PACKAGE_RELEASE}%{?dist}") + string(APPEND CPACK_RPM_PACKAGE_RELEASE "%{?dist}") endif() # CPACK_RPM_PACKAGE_LICENSE @@ -1526,13 +1526,13 @@ function(cpack_rpm_generate_package) string(SUBSTRING ${_RPM_SPEC_HEADER} 1 -1 _PACKAGE_HEADER_TAIL) string(TOLOWER "${_PACKAGE_HEADER_TAIL}" _PACKAGE_HEADER_TAIL) string(SUBSTRING ${_RPM_SPEC_HEADER} 0 1 _PACKAGE_HEADER_NAME) - set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}${_PACKAGE_HEADER_TAIL}") + string(APPEND _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_TAIL}") # The following keywords require parentheses around the "pre" or "post" suffix in the final RPM spec file. set(SCRIPTS_REQUIREMENTS_LIST REQUIRES_PRE REQUIRES_POST REQUIRES_PREUN REQUIRES_POSTUN) list(FIND SCRIPTS_REQUIREMENTS_LIST ${_RPM_SPEC_HEADER} IS_SCRIPTS_REQUIREMENT_FOUND) if(NOT ${IS_SCRIPTS_REQUIREMENT_FOUND} EQUAL -1) string(REPLACE "_" "(" _PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME}") - set(_PACKAGE_HEADER_NAME "${_PACKAGE_HEADER_NAME})") + string(APPEND _PACKAGE_HEADER_NAME ")") endif() if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: User defined ${_PACKAGE_HEADER_NAME}:\n ${CPACK_RPM_PACKAGE_${_RPM_SPEC_HEADER}_TMP}") @@ -1692,10 +1692,10 @@ function(cpack_rpm_generate_package) message("CPackRPM:Debug: F_PREFIX=<${F_PREFIX}>, F_PATH=<${F_PATH}>") endif() if(F_PREFIX) - set(F_PREFIX "${F_PREFIX} ") + string(APPEND F_PREFIX " ") endif() # Rebuild the user list file - set(CPACK_RPM_USER_INSTALL_FILES "${CPACK_RPM_USER_INSTALL_FILES}${F_PREFIX}\"${F_PATH}\"\n") + string(APPEND CPACK_RPM_USER_INSTALL_FILES "${F_PREFIX}\"${F_PATH}\"\n") # Remove from CPACK_RPM_INSTALL_FILES and CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL list(REMOVE_ITEM CPACK_RPM_INSTALL_FILES_LIST ${F_PATH}) @@ -1708,7 +1708,7 @@ function(cpack_rpm_generate_package) # Rebuild CPACK_RPM_INSTALL_FILES set(CPACK_RPM_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + string(APPEND CPACK_RPM_INSTALL_FILES "\"${F}\"\n") endforeach() else() set(CPACK_RPM_USER_INSTALL_FILES "") @@ -1729,12 +1729,12 @@ function(cpack_rpm_generate_package) # Rebuild INSTALL_FILES set(CPACK_RPM_INSTALL_FILES "") foreach(F IN LISTS CPACK_RPM_INSTALL_FILES_LIST) - set(CPACK_RPM_INSTALL_FILES "${CPACK_RPM_INSTALL_FILES}\"${F}\"\n") + string(APPEND CPACK_RPM_INSTALL_FILES "\"${F}\"\n") endforeach() # Build ABSOLUTE_INSTALL_FILES set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "") foreach(F IN LISTS CPACK_ABSOLUTE_DESTINATION_FILES_INTERNAL) - set(CPACK_RPM_ABSOLUTE_INSTALL_FILES "${CPACK_RPM_ABSOLUTE_INSTALL_FILES}%config \"${F}\"\n") + string(APPEND CPACK_RPM_ABSOLUTE_INSTALL_FILES "%config \"${F}\"\n") endforeach() if(CPACK_RPM_PACKAGE_DEBUG) message("CPackRPM:Debug: CPACK_RPM_ABSOLUTE_INSTALL_FILES=${CPACK_RPM_ABSOLUTE_INSTALL_FILES}") diff --git a/Modules/CTestUseLaunchers.cmake b/Modules/CTestUseLaunchers.cmake index c79119f95..1a57d0025 100644 --- a/Modules/CTestUseLaunchers.cmake +++ b/Modules/CTestUseLaunchers.cmake @@ -59,7 +59,7 @@ if(CTEST_USE_LAUNCHERS) "${__launch_common_options} --output ") if("${CMAKE_GENERATOR}" MATCHES "Ninja") - set(__launch_compile_options "${__launch_compile_options} --filter-prefix ") + string(APPEND __launch_compile_options " --filter-prefix ") endif() set(CTEST_LAUNCH_COMPILE diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index ef1e39d69..cfbc28f5e 100644 --- a/Modules/CheckIncludeFile.cmake +++ b/Modules/CheckIncludeFile.cmake @@ -60,7 +60,7 @@ macro(CHECK_INCLUDE_FILE INCLUDE VARIABLE) endif() if(${ARGC} EQUAL 3) set(CMAKE_C_FLAGS_SAVE ${CMAKE_C_FLAGS}) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${ARGV2}") + string(APPEND CMAKE_C_FLAGS " ${ARGV2}") endif() try_compile(${VARIABLE} diff --git a/Modules/CheckIncludeFileCXX.cmake b/Modules/CheckIncludeFileCXX.cmake index 9a6df3b74..59df7cbe2 100644 --- a/Modules/CheckIncludeFileCXX.cmake +++ b/Modules/CheckIncludeFileCXX.cmake @@ -59,7 +59,7 @@ macro(CHECK_INCLUDE_FILE_CXX INCLUDE VARIABLE) endif() if(${ARGC} EQUAL 3) set(CMAKE_CXX_FLAGS_SAVE ${CMAKE_CXX_FLAGS}) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ARGV2}") + string(APPEND CMAKE_CXX_FLAGS " ${ARGV2}") endif() try_compile(${VARIABLE} diff --git a/Modules/CheckIncludeFiles.cmake b/Modules/CheckIncludeFiles.cmake index 843cd35ef..3657c95c6 100644 --- a/Modules/CheckIncludeFiles.cmake +++ b/Modules/CheckIncludeFiles.cmake @@ -55,11 +55,11 @@ macro(CHECK_INCLUDE_FILES INCLUDE VARIABLE) set(CHECK_INCLUDE_FILES_CONTENT "/* */\n") set(MACRO_CHECK_INCLUDE_FILES_FLAGS ${CMAKE_REQUIRED_FLAGS}) foreach(FILE ${INCLUDE}) - set(CMAKE_CONFIGURABLE_FILE_CONTENT - "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n") + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT + "#include <${FILE}>\n") endforeach() - set(CMAKE_CONFIGURABLE_FILE_CONTENT - "${CMAKE_CONFIGURABLE_FILE_CONTENT}\n\nint main(void){return 0;}\n") + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT + "\n\nint main(void){return 0;}\n") configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/CheckIncludeFiles.c" @ONLY) diff --git a/Modules/CheckPrototypeDefinition.cmake b/Modules/CheckPrototypeDefinition.cmake index e203d4c3f..b9345e704 100644 --- a/Modules/CheckPrototypeDefinition.cmake +++ b/Modules/CheckPrototypeDefinition.cmake @@ -75,8 +75,8 @@ function(CHECK_PROTOTYPE_DEFINITION _FUNCTION _PROTOTYPE _RETURN _HEADER _VARIAB endif() foreach(_FILE ${_HEADER}) - set(CHECK_PROTOTYPE_DEFINITION_HEADER - "${CHECK_PROTOTYPE_DEFINITION_HEADER}#include <${_FILE}>\n") + string(APPEND CHECK_PROTOTYPE_DEFINITION_HEADER + "#include <${_FILE}>\n") endforeach() set(CHECK_PROTOTYPE_DEFINITION_SYMBOL ${_FUNCTION}) diff --git a/Modules/CheckStructHasMember.cmake b/Modules/CheckStructHasMember.cmake index 6c1520592..e9e5a1807 100644 --- a/Modules/CheckStructHasMember.cmake +++ b/Modules/CheckStructHasMember.cmake @@ -54,7 +54,7 @@ include(CheckCXXSourceCompiles) macro (CHECK_STRUCT_HAS_MEMBER _STRUCT _MEMBER _HEADER _RESULT) set(_INCLUDE_FILES) foreach (it ${_HEADER}) - set(_INCLUDE_FILES "${_INCLUDE_FILES}#include <${it}>\n") + string(APPEND _INCLUDE_FILES "#include <${it}>\n") endforeach () if("x${ARGN}" STREQUAL "x") diff --git a/Modules/CheckSymbolExists.cmake b/Modules/CheckSymbolExists.cmake index c4dff3faa..a62d1e1cc 100644 --- a/Modules/CheckSymbolExists.cmake +++ b/Modules/CheckSymbolExists.cmake @@ -71,11 +71,11 @@ macro(_CHECK_SYMBOL_EXISTS SOURCEFILE SYMBOL FILES VARIABLE) set(CMAKE_SYMBOL_EXISTS_INCLUDES) endif() foreach(FILE ${FILES}) - set(CMAKE_CONFIGURABLE_FILE_CONTENT - "${CMAKE_CONFIGURABLE_FILE_CONTENT}#include <${FILE}>\n") + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT + "#include <${FILE}>\n") endforeach() - set(CMAKE_CONFIGURABLE_FILE_CONTENT - "${CMAKE_CONFIGURABLE_FILE_CONTENT}\nint main(int argc, char** argv)\n{\n (void)argv;\n#ifndef ${SYMBOL}\n return ((int*)(&${SYMBOL}))[argc];\n#else\n (void)argc;\n return 0;\n#endif\n}\n") + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT + "\nint main(int argc, char** argv)\n{\n (void)argv;\n#ifndef ${SYMBOL}\n return ((int*)(&${SYMBOL}))[argc];\n#else\n (void)argc;\n return 0;\n#endif\n}\n") configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" "${SOURCEFILE}" @ONLY) diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 5938d6c9a..827905b33 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -97,17 +97,17 @@ function(__check_type_size_impl type var map builtin language) set(headers) if(builtin) if(HAVE_SYS_TYPES_H) - set(headers "${headers}#include \n") + string(APPEND headers "#include \n") endif() if(HAVE_STDINT_H) - set(headers "${headers}#include \n") + string(APPEND headers "#include \n") endif() if(HAVE_STDDEF_H) - set(headers "${headers}#include \n") + string(APPEND headers "#include \n") endif() endif() foreach(h ${CMAKE_EXTRA_INCLUDE_FILES}) - set(headers "${headers}#include \"${h}\"\n") + string(APPEND headers "#include \"${h}\"\n") endforeach() # Perform the check. @@ -157,7 +157,7 @@ function(__check_type_size_impl type var map builtin language) string(REGEX MATCH "${regex_key}" key "${info}") string(REGEX REPLACE "${regex_key}" "\\1" key "${key}") if(key) - set(code "${code}\nset(${var}-${key} \"${size}\")") + string(APPEND code "\nset(${var}-${key} \"${size}\")") list(APPEND keys ${key}) endif() endif() diff --git a/Modules/Compiler/AppleClang-DetermineCompiler.cmake b/Modules/Compiler/AppleClang-DetermineCompiler.cmake index 397f95cbe..83817f754 100644 --- a/Modules/Compiler/AppleClang-DetermineCompiler.cmake +++ b/Modules/Compiler/AppleClang-DetermineCompiler.cmake @@ -3,5 +3,5 @@ set(_compiler_id_pp_test "defined(__clang__) && defined(__apple_build_version__) include("${CMAKE_CURRENT_LIST_DIR}/Clang-DetermineCompilerInternal.cmake") -set(_compiler_id_version_compute "${_compiler_id_version_compute} +string(APPEND _compiler_id_version_compute " # define @PREFIX@COMPILER_VERSION_TWEAK @MACRO_DEC@(__apple_build_version__)") diff --git a/Modules/Dart.cmake b/Modules/Dart.cmake index db487d8f5..90298d64b 100644 --- a/Modules/Dart.cmake +++ b/Modules/Dart.cmake @@ -119,7 +119,7 @@ if(BUILD_TESTING) # add testing targets set(DART_EXPERIMENTAL_NAME Experimental) if(DART_EXPERIMENTAL_USE_PROJECT_NAME) - set(DART_EXPERIMENTAL_NAME "${DART_EXPERIMENTAL_NAME}${PROJECT_NAME}") + string(APPEND DART_EXPERIMENTAL_NAME "${PROJECT_NAME}") endif() endif () diff --git a/Modules/DeployQt4.cmake b/Modules/DeployQt4.cmake index de475e45f..f5ac95997 100644 --- a/Modules/DeployQt4.cmake +++ b/Modules/DeployQt4.cmake @@ -247,7 +247,7 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va set(plugins_path ".") endif() if(plugins_dir) - set(plugins_path "${plugins_path}/${plugins_dir}") + string(APPEND plugins_path "/${plugins_dir}") endif() endif() @@ -263,7 +263,7 @@ function(install_qt4_plugin_path plugin executable copy installed_plugin_path_va get_filename_component(plugin_group "${plugin_path}" NAME) set(${plugin_group_var} "${plugin_group}") endif() - set(plugins_path "${plugins_path}/${plugin_group}") + string(APPEND plugins_path "/${plugin_group}") if(${copy}) file(MAKE_DIRECTORY "${plugins_path}") diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 02d2b157d..a0bffe771 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -473,10 +473,10 @@ function(ExternalData_expand_arguments target outArgsVar) if("x${piece}" MATCHES "^x${data_regex}$") # Replace this DATA{}-piece with a file path. _ExternalData_arg("${target}" "${piece}" "${CMAKE_MATCH_1}" file) - set(outArg "${outArg}${file}") + string(APPEND outArg "${file}") else() # No replacement needed for this piece. - set(outArg "${outArg}${piece}") + string(APPEND outArg "${piece}") endif() endforeach() else() @@ -696,12 +696,12 @@ macro(_ExternalData_arg_associated) get_filename_component(reldir "${reldata}" PATH) endif() if(reldir) - set(reldir "${reldir}/") + string(APPEND reldir "/") endif() _ExternalData_exact_regex(reldir_regex "${reldir}") if(recurse_option) set(glob GLOB_RECURSE) - set(reldir_regex "${reldir_regex}(.+/)?") + string(APPEND reldir_regex "(.+/)?") else() set(glob GLOB) endif() @@ -717,7 +717,7 @@ macro(_ExternalData_arg_associated) set(all "") set(sep "") foreach(regex ${associated_regex}) - set(all "${all}${sep}${reldir_regex}${regex}") + string(APPEND all "${sep}${reldir_regex}${regex}") set(sep "|") endforeach() _ExternalData_arg_find_files(${glob} "${reldir}" "${all}") @@ -978,9 +978,9 @@ function(_ExternalData_download_object name hash algo var_obj) else() _ExternalData_download_file("${url}" "${tmp}" err errMsg) endif() - set(tried "${tried}\n ${url}") + string(APPEND tried "\n ${url}") if(err) - set(tried "${tried} (${errMsg})") + string(APPEND tried " (${errMsg})") else() # Verify downloaded object. _ExternalData_compute_hash(dl_hash "${algo}" "${tmp}") @@ -988,7 +988,7 @@ function(_ExternalData_download_object name hash algo var_obj) set(found 1) break() else() - set(tried "${tried} (wrong hash ${algo}=${dl_hash})") + string(APPEND tried " (wrong hash ${algo}=${dl_hash})") if("$ENV{ExternalData_DEBUG_DOWNLOAD}" MATCHES ".") file(RENAME "${tmp}" "${store}/${algo}/${dl_hash}") endif() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index 7e179aa68..755b4fb87 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -1117,8 +1117,8 @@ function(_ep_command_line_to_initial_cache var args force) set(line "${CMAKE_MATCH_1}") if(setArg) # This is required to build up lists in variables, or complete an entry - set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})") - set(script_initial_cache "${script_initial_cache}\n${setArg}") + string(APPEND setArg "${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})") + string(APPEND script_initial_cache "\n${setArg}") set(accumulator "") set(setArg "") endif() @@ -1132,13 +1132,13 @@ function(_ep_command_line_to_initial_cache var args force) endif() else() # Assume this is a list to append to the last var - set(accumulator "${accumulator};${line}") + string(APPEND accumulator ";${line}") endif() endforeach() # Catch the final line of the args if(setArg) - set(setArg "${setArg}${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})") - set(script_initial_cache "${script_initial_cache}\n${setArg}") + string(APPEND setArg "${accumulator}\" CACHE ${type} \"Initial cache\" ${forceArg})") + string(APPEND script_initial_cache "\n${setArg}") endif() set(${var} ${script_initial_cache} PARENT_SCOPE) endfunction() @@ -1332,16 +1332,16 @@ endif() foreach(arg IN LISTS command) if("x${arg}" STREQUAL "xCOMMAND") if(NOT "x${cmd}" STREQUAL "x") - set(code "${code}set(command \"${cmd}\")${code_execute_process}") + string(APPEND code "set(command \"${cmd}\")${code_execute_process}") endif() set(cmd "") set(sep "") else() - set(cmd "${cmd}${sep}${arg}") + string(APPEND cmd "${sep}${arg}") set(sep ";") endif() endforeach() - set(code "${code}set(command \"${cmd}\")${code_execute_process}") + string(APPEND code "set(command \"${cmd}\")${code_execute_process}") file(GENERATE OUTPUT "${stamp_dir}/${name}-${step}-$-impl.cmake" CONTENT "${code}") set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-$-impl.cmake) endif() diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index dc3108623..764a5f7ab 100644 --- a/Modules/FeatureSummary.cmake +++ b/Modules/FeatureSummary.cmake @@ -411,23 +411,23 @@ function(_FS_GET_FEATURE_SUMMARY _property _var _includeQuiet) if(includeThisOne) - set(_currentFeatureText "${_currentFeatureText}\n * ${_currentFeature}") + string(APPEND _currentFeatureText "\n * ${_currentFeature}") get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_REQUIRED_VERSION) if(_info) - set(_currentFeatureText "${_currentFeatureText} (required version ${_info})") + string(APPEND _currentFeatureText " (required version ${_info})") endif() get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_DESCRIPTION) if(_info) - set(_currentFeatureText "${_currentFeatureText} , ${_info}") + string(APPEND _currentFeatureText " , ${_info}") endif() get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_URL) if(_info) - set(_currentFeatureText "${_currentFeatureText} , <${_info}>") + string(APPEND _currentFeatureText " , <${_info}>") endif() get_property(_info GLOBAL PROPERTY _CMAKE_${_currentFeature}_PURPOSE) foreach(_purpose ${_info}) - set(_currentFeatureText "${_currentFeatureText}\n ${_purpose}") + string(APPEND _currentFeatureText "\n ${_purpose}") endforeach() endif() @@ -527,7 +527,7 @@ function(FEATURE_SUMMARY) set(_tmp) _FS_GET_FEATURE_SUMMARY( ${part} _tmp ${_FS_INCLUDE_QUIET_PACKAGES}) if(_tmp) - set(_fullText "${_fullText}\n-- ${title_${part}}\n${_tmp}\n") + string(APPEND _fullText "\n-- ${title_${part}}\n${_tmp}\n") if("${part}" STREQUAL "REQUIRED_PACKAGES_NOT_FOUND") set(requiredPackagesNotFound TRUE) endif() diff --git a/Modules/FindBoost.cmake b/Modules/FindBoost.cmake index ed149c618..1f03841f4 100644 --- a/Modules/FindBoost.cmake +++ b/Modules/FindBoost.cmake @@ -1181,8 +1181,8 @@ if(Boost_INCLUDE_DIR) math(EXPR Boost_MINOR_VERSION "${Boost_VERSION} / 100 % 1000") math(EXPR Boost_SUBMINOR_VERSION "${Boost_VERSION} % 100") - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") + string(APPEND Boost_ERROR_REASON + "Boost version: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}\nBoost include path: ${Boost_INCLUDE_DIR}") if(Boost_DEBUG) message(STATUS "[ ${CMAKE_CURRENT_LIST_FILE}:${CMAKE_CURRENT_LIST_LINE} ] " "version.hpp reveals boost " @@ -1204,16 +1204,16 @@ if(Boost_INCLUDE_DIR) endif() if(NOT Boost_FOUND) # State that we found a version of Boost that is too new or too old. - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") + string(APPEND Boost_ERROR_REASON + "\nDetected version of Boost is too ${_Boost_VERSION_AGE}. Requested version was ${Boost_FIND_VERSION_MAJOR}.${Boost_FIND_VERSION_MINOR}") if (Boost_FIND_VERSION_PATCH) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}.${Boost_FIND_VERSION_PATCH}") + string(APPEND Boost_ERROR_REASON + ".${Boost_FIND_VERSION_PATCH}") endif () if (NOT Boost_FIND_VERSION_EXACT) - set(Boost_ERROR_REASON "${Boost_ERROR_REASON} (or newer)") + string(APPEND Boost_ERROR_REASON " (or newer)") endif () - set(Boost_ERROR_REASON "${Boost_ERROR_REASON}.") + string(APPEND Boost_ERROR_REASON ".") endif () else() # Caller will accept any Boost version. @@ -1221,8 +1221,8 @@ if(Boost_INCLUDE_DIR) endif() else() set(Boost_FOUND 0) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") + string(APPEND Boost_ERROR_REASON + "Unable to find the Boost header files. Please set BOOST_ROOT to the root directory containing Boost or BOOST_INCLUDEDIR to the directory containing Boost's headers.") endif() # ------------------------------------------------------------------------ @@ -1302,15 +1302,15 @@ if(WIN32 AND Boost_USE_DEBUG_RUNTIME) if("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC" OR "${CMAKE_CXX_COMPILER}" MATCHES "icl" OR "${CMAKE_CXX_COMPILER}" MATCHES "icpc") - set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}g") + string(APPEND _boost_DEBUG_ABI_TAG "g") endif() endif() # y using special debug build of python if(Boost_USE_DEBUG_PYTHON) - set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}y") + string(APPEND _boost_DEBUG_ABI_TAG "y") endif() # d using a debug version of your code -set(_boost_DEBUG_ABI_TAG "${_boost_DEBUG_ABI_TAG}d") +string(APPEND _boost_DEBUG_ABI_TAG "d") # p using the STLport standard library rather than the # default one supplied with your compiler if(Boost_USE_STLPORT) @@ -1640,26 +1640,26 @@ if(Boost_FOUND) set(Boost_FOUND 0) # We were unable to find some libraries, so generate a sensible # error message that lists the libraries we were unable to find. - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}\nCould not find the following") + string(APPEND Boost_ERROR_REASON + "\nCould not find the following") if(Boost_USE_STATIC_LIBS) - set(Boost_ERROR_REASON "${Boost_ERROR_REASON} static") + string(APPEND Boost_ERROR_REASON " static") endif() - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON} Boost libraries:\n") + string(APPEND Boost_ERROR_REASON + " Boost libraries:\n") foreach(COMPONENT ${_Boost_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON} ${Boost_NAMESPACE}_${COMPONENT}\n") + string(APPEND Boost_ERROR_REASON + " ${Boost_NAMESPACE}_${COMPONENT}\n") endforeach() list(LENGTH Boost_FIND_COMPONENTS Boost_NUM_COMPONENTS_WANTED) list(LENGTH _Boost_MISSING_COMPONENTS Boost_NUM_MISSING_COMPONENTS) if (${Boost_NUM_COMPONENTS_WANTED} EQUAL ${Boost_NUM_MISSING_COMPONENTS}) - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + string(APPEND Boost_ERROR_REASON + "No Boost libraries were found. You may need to set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") else () - set(Boost_ERROR_REASON - "${Boost_ERROR_REASON}Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") + string(APPEND Boost_ERROR_REASON + "Some (but not all) of the required Boost libraries were found. You may need to install these additional Boost libraries. Alternatively, set BOOST_LIBRARYDIR to the directory containing Boost libraries or BOOST_ROOT to the location of Boost.") endif () endif () diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index 8c000a096..6d9b83396 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1324,13 +1324,13 @@ macro(CUDA_WRAP_SRCS cuda_target format generated_files) set(_cuda_C_FLAGS "${CMAKE_${CUDA_C_OR_CXX}_FLAGS_${config_upper}}") endif() - set(_cuda_host_flags "${_cuda_host_flags}\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})") + string(APPEND _cuda_host_flags "\nset(CMAKE_HOST_FLAGS_${config_upper} ${_cuda_C_FLAGS})") endif() # Note that if we ever want CUDA_NVCC_FLAGS_ to be string (instead of a list # like it is currently), we can remove the quotes around the # ${CUDA_NVCC_FLAGS_${config_upper}} variable like the CMAKE_HOST_FLAGS_ variable. - set(_cuda_nvcc_flags_config "${_cuda_nvcc_flags_config}\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})") + string(APPEND _cuda_nvcc_flags_config "\nset(CUDA_NVCC_FLAGS_${config_upper} ${CUDA_NVCC_FLAGS_${config_upper}} ;; ${CUDA_WRAP_OPTION_NVCC_FLAGS_${config_upper}})") endforeach() # Process the C++11 flag. If the host sets the flag, we need to add it to nvcc and diff --git a/Modules/FindCUDA/make2cmake.cmake b/Modules/FindCUDA/make2cmake.cmake index 802f93ace..7b5389ec5 100644 --- a/Modules/FindCUDA/make2cmake.cmake +++ b/Modules/FindCUDA/make2cmake.cmake @@ -100,7 +100,7 @@ list(REMOVE_DUPLICATES dependency_list) list(SORT dependency_list) foreach(file ${dependency_list}) - set(cuda_nvcc_depend "${cuda_nvcc_depend} \"${file}\"\n") + string(APPEND cuda_nvcc_depend " \"${file}\"\n") endforeach() file(WRITE ${output_file} "# Generated by: make2cmake.cmake\nSET(CUDA_NVCC_DEPEND\n ${cuda_nvcc_depend})\n\n") diff --git a/Modules/FindCUDA/run_nvcc.cmake b/Modules/FindCUDA/run_nvcc.cmake index 12b83e0d2..ff1f515ff 100644 --- a/Modules/FindCUDA/run_nvcc.cmake +++ b/Modules/FindCUDA/run_nvcc.cmake @@ -95,7 +95,7 @@ string(TOUPPER "${build_configuration}" build_configuration) #message("CUDA_NVCC_HOST_COMPILER_FLAGS = ${CUDA_NVCC_HOST_COMPILER_FLAGS}") foreach(flag ${CMAKE_HOST_FLAGS} ${CMAKE_HOST_FLAGS_${build_configuration}}) # Extra quotes are added around each flag to help nvcc parse out flags with spaces. - set(nvcc_host_compiler_flags "${nvcc_host_compiler_flags},\"${flag}\"") + string(APPEND nvcc_host_compiler_flags ",\"${flag}\"") endforeach() if (nvcc_host_compiler_flags) set(nvcc_host_compiler_flags "-Xcompiler" ${nvcc_host_compiler_flags}) diff --git a/Modules/FindCups.cmake b/Modules/FindCups.cmake index 51eb7c58e..6f7045584 100644 --- a/Modules/FindCups.cmake +++ b/Modules/FindCups.cmake @@ -55,7 +55,7 @@ if (CUPS_INCLUDE_DIR AND EXISTS "${CUPS_INCLUDE_DIR}/cups/cups.h") if(VLINE MATCHES "^#[\t ]*define[\t ]+CUPS_VERSION_${VPART}[\t ]+([0-9]+)$") set(CUPS_VERSION_PART "${CMAKE_MATCH_1}") if(CUPS_VERSION_STRING) - set(CUPS_VERSION_STRING "${CUPS_VERSION_STRING}.${CUPS_VERSION_PART}") + string(APPEND CUPS_VERSION_STRING ".${CUPS_VERSION_PART}") else() set(CUPS_VERSION_STRING "${CUPS_VERSION_PART}") endif() diff --git a/Modules/FindEXPAT.cmake b/Modules/FindEXPAT.cmake index 653094cd3..70fc35b92 100644 --- a/Modules/FindEXPAT.cmake +++ b/Modules/FindEXPAT.cmake @@ -41,7 +41,7 @@ if (EXPAT_INCLUDE_DIR AND EXISTS "${EXPAT_INCLUDE_DIR}/expat.h") if(VLINE MATCHES "^#[\t ]*define[\t ]+XML_${VPART}_VERSION[\t ]+([0-9]+)$") set(EXPAT_VERSION_PART "${CMAKE_MATCH_1}") if(EXPAT_VERSION_STRING) - set(EXPAT_VERSION_STRING "${EXPAT_VERSION_STRING}.${EXPAT_VERSION_PART}") + string(APPEND EXPAT_VERSION_STRING ".${EXPAT_VERSION_PART}") else() set(EXPAT_VERSION_STRING "${EXPAT_VERSION_PART}") endif() diff --git a/Modules/FindFreetype.cmake b/Modules/FindFreetype.cmake index e38e5ed39..35dc17d6c 100644 --- a/Modules/FindFreetype.cmake +++ b/Modules/FindFreetype.cmake @@ -135,7 +135,7 @@ if(FREETYPE_INCLUDE_DIR_freetype2 AND FREETYPE_H) if(VLINE MATCHES "^#[\t ]*define[\t ]+FREETYPE_${VPART}[\t ]+([0-9]+)$") set(FREETYPE_VERSION_PART "${CMAKE_MATCH_1}") if(FREETYPE_VERSION_STRING) - set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_STRING}.${FREETYPE_VERSION_PART}") + string(APPEND FREETYPE_VERSION_STRING ".${FREETYPE_VERSION_PART}") else() set(FREETYPE_VERSION_STRING "${FREETYPE_VERSION_PART}") endif() diff --git a/Modules/FindMPI.cmake b/Modules/FindMPI.cmake index fbc679556..4f7862307 100644 --- a/Modules/FindMPI.cmake +++ b/Modules/FindMPI.cmake @@ -327,7 +327,7 @@ function (interrogate_mpi_compiler lang try_libs) foreach(FLAG ${MPI_ALL_COMPILE_FLAGS}) if (MPI_COMPILE_FLAGS_WORK) - set(MPI_COMPILE_FLAGS_WORK "${MPI_COMPILE_FLAGS_WORK} ${FLAG}") + string(APPEND MPI_COMPILE_FLAGS_WORK " ${FLAG}") else() set(MPI_COMPILE_FLAGS_WORK ${FLAG}) endif() @@ -376,7 +376,7 @@ function (interrogate_mpi_compiler lang try_libs) set(MPI_LINK_FLAGS_WORK) foreach(FLAG ${MPI_ALL_LINK_FLAGS}) if (MPI_LINK_FLAGS_WORK) - set(MPI_LINK_FLAGS_WORK "${MPI_LINK_FLAGS_WORK} ${FLAG}") + string(APPEND MPI_LINK_FLAGS_WORK " ${FLAG}") else() set(MPI_LINK_FLAGS_WORK ${FLAG}) endif() @@ -398,8 +398,8 @@ function (interrogate_mpi_compiler lang try_libs) # in the showme list that can only be found in the implicit # link directories of the compiler. if (DEFINED CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES) - set(MPI_LINK_PATH - "${MPI_LINK_PATH};${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}") + string(APPEND MPI_LINK_PATH + ";${CMAKE_${lang}_IMPLICIT_LINK_DIRECTORIES}") endif () # Determine full path names for all of the libraries that one needs diff --git a/Modules/FindPHP4.cmake b/Modules/FindPHP4.cmake index 25fff8c73..7eab16106 100644 --- a/Modules/FindPHP4.cmake +++ b/Modules/FindPHP4.cmake @@ -58,8 +58,8 @@ mark_as_advanced( if(APPLE) # this is a hack for now - set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS - "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -Wl,-flat_namespace") + string(APPEND CMAKE_SHARED_MODULE_CREATE_C_FLAGS + " -Wl,-flat_namespace") foreach(symbol __efree __emalloc @@ -82,8 +82,8 @@ if(APPLE) _zend_wrong_param_count _zval_used_for_init ) - set(CMAKE_SHARED_MODULE_CREATE_C_FLAGS - "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS},-U,${symbol}") + string(APPEND CMAKE_SHARED_MODULE_CREATE_C_FLAGS + ",-U,${symbol}") endforeach() endif() diff --git a/Modules/FindPackageHandleStandardArgs.cmake b/Modules/FindPackageHandleStandardArgs.cmake index fe2dbeaa6..96590cb58 100644 --- a/Modules/FindPackageHandleStandardArgs.cmake +++ b/Modules/FindPackageHandleStandardArgs.cmake @@ -169,10 +169,10 @@ macro(_FPHSA_HANDLE_FAILURE_CONFIG_MODE) foreach(currentConfigIndex RANGE ${configsCount}) list(GET ${_NAME}_CONSIDERED_CONFIGS ${currentConfigIndex} filename) list(GET ${_NAME}_CONSIDERED_VERSIONS ${currentConfigIndex} version) - set(configsText "${configsText} ${filename} (version ${version})\n") + string(APPEND configsText " ${filename} (version ${version})\n") endforeach() if (${_NAME}_NOT_FOUND_MESSAGE) - set(configsText "${configsText} Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") + string(APPEND configsText " Reason given by package: ${${_NAME}_NOT_FOUND_MESSAGE}\n") endif() _FPHSA_FAILURE_MESSAGE("${FPHSA_FAIL_MESSAGE} ${VERSION_MSG}, checked the following files:\n${configsText}") @@ -253,9 +253,9 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) foreach(_CURRENT_VAR ${FPHSA_REQUIRED_VARS}) if(NOT ${_CURRENT_VAR}) set(FPHSA_FOUND_${_NAME} FALSE) - set(MISSING_VARS "${MISSING_VARS} ${_CURRENT_VAR}") + string(APPEND MISSING_VARS " ${_CURRENT_VAR}") else() - set(DETAILS "${DETAILS}[${${_CURRENT_VAR}}]") + string(APPEND DETAILS "[${${_CURRENT_VAR}}]") endif() endforeach() if(FPHSA_FOUND_${_NAME}) @@ -277,24 +277,24 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) if(NOT DEFINED FOUND_COMPONENTS_MSG) set(FOUND_COMPONENTS_MSG "found components: ") endif() - set(FOUND_COMPONENTS_MSG "${FOUND_COMPONENTS_MSG} ${comp}") + string(APPEND FOUND_COMPONENTS_MSG " ${comp}") else() if(NOT DEFINED MISSING_COMPONENTS_MSG) set(MISSING_COMPONENTS_MSG "missing components: ") endif() - set(MISSING_COMPONENTS_MSG "${MISSING_COMPONENTS_MSG} ${comp}") + string(APPEND MISSING_COMPONENTS_MSG " ${comp}") if(${_NAME}_FIND_REQUIRED_${comp}) set(${_NAME}_FOUND FALSE) - set(MISSING_VARS "${MISSING_VARS} ${comp}") + string(APPEND MISSING_VARS " ${comp}") endif() endif() endforeach() set(COMPONENT_MSG "${FOUND_COMPONENTS_MSG} ${MISSING_COMPONENTS_MSG}") - set(DETAILS "${DETAILS}[c${COMPONENT_MSG}]") + string(APPEND DETAILS "[c${COMPONENT_MSG}]") endif() # version handling: @@ -368,7 +368,7 @@ function(FIND_PACKAGE_HANDLE_STANDARD_ARGS _NAME _FIRST_ARG) endif () if(VERSION_OK) - set(DETAILS "${DETAILS}[v${VERSION}(${${_NAME}_FIND_VERSION})]") + string(APPEND DETAILS "[v${VERSION}(${${_NAME}_FIND_VERSION})]") else() set(${_NAME}_FOUND FALSE) endif() diff --git a/Modules/FindPkgConfig.cmake b/Modules/FindPkgConfig.cmake index d16460b6e..b6156dd45 100644 --- a/Modules/FindPkgConfig.cmake +++ b/Modules/FindPkgConfig.cmake @@ -200,7 +200,7 @@ function(_pkg_create_imp_target _prefix _no_cmake_path _no_cmake_environment_pat set(_find_opts "NO_CMAKE_PATH") endif() if(_no_cmake_environment_path) - set(_find_opts "${_find_opts} NO_CMAKE_ENVIRONMENT_PATH") + string(APPEND _find_opts " NO_CMAKE_ENVIRONMENT_PATH") endif() foreach (flag IN LISTS ${_prefix}_LDFLAGS) diff --git a/Modules/FindQt4.cmake b/Modules/FindQt4.cmake index d167a1392..bf41ea197 100644 --- a/Modules/FindQt4.cmake +++ b/Modules/FindQt4.cmake @@ -764,7 +764,7 @@ if (QT_QMAKE_EXECUTABLE AND ############################################# cmake_push_check_state() # Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES - set(CMAKE_REQUIRED_INCLUDES "${CMAKE_REQUIRED_INCLUDES};${QT_INCLUDE_DIR}") + string(APPEND CMAKE_REQUIRED_INCLUDES ";${QT_INCLUDE_DIR}") set(CMAKE_REQUIRED_QUIET ${Qt4_FIND_QUIETLY}) # Check for Window system symbols (note: only one should end up being set) CHECK_CXX_SYMBOL_EXISTS(Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11) diff --git a/Modules/FindSDL_sound.cmake b/Modules/FindSDL_sound.cmake index 494d358b3..b378c348d 100644 --- a/Modules/FindSDL_sound.cmake +++ b/Modules/FindSDL_sound.cmake @@ -123,7 +123,7 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # To get multiple single variables to work, I must separate them with a "\;" # I could go back and modify the FindSDL.cmake module, but that's kind of painful. # The solution would be to try something like: - # set(SDL_TRY_COMPILE_LIBRARY_LIST "${SDL_TRY_COMPILE_LIBRARY_LIST}\;${CMAKE_THREAD_LIBS_INIT}") + # string(APPEND SDL_TRY_COMPILE_LIBRARY_LIST "\;${CMAKE_THREAD_LIBS_INIT}") # Instead, it was suggested on the mailing list to write a temporary CMakeLists.txt # with a temporary test project and invoke that with TRY_COMPILE. # See message thread "Figuring out dependencies for a library in order to build" @@ -173,7 +173,7 @@ if(SDL_FOUND AND SDL_SOUND_INCLUDE_DIR AND SDL_SOUND_LIBRARY) # would fix the problem. set(TMP_TRY_LIBS) foreach(lib ${SDL_SOUND_LIBRARY} ${SDL_LIBRARY}) - set(TMP_TRY_LIBS "${TMP_TRY_LIBS} \"${lib}\"") + string(APPEND TMP_TRY_LIBS " \"${lib}\"") endforeach() # message("TMP_TRY_LIBS ${TMP_TRY_LIBS}") diff --git a/Modules/FindZLIB.cmake b/Modules/FindZLIB.cmake index 0b36d6f71..f4dc5ae2c 100644 --- a/Modules/FindZLIB.cmake +++ b/Modules/FindZLIB.cmake @@ -110,7 +110,7 @@ if(ZLIB_INCLUDE_DIR AND EXISTS "${ZLIB_INCLUDE_DIR}/zlib.h") set(ZLIB_VERSION_TWEAK "") if( "${ZLIB_H}" MATCHES "ZLIB_VERSION \"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+)") set(ZLIB_VERSION_TWEAK "${CMAKE_MATCH_1}") - set(ZLIB_VERSION_STRING "${ZLIB_VERSION_STRING}.${ZLIB_VERSION_TWEAK}") + string(APPEND ZLIB_VERSION_STRING ".${ZLIB_VERSION_TWEAK}") endif() set(ZLIB_MAJOR_VERSION "${ZLIB_VERSION_MAJOR}") diff --git a/Modules/FindwxWidgets.cmake b/Modules/FindwxWidgets.cmake index 8c07e6cf8..2974b9e95 100644 --- a/Modules/FindwxWidgets.cmake +++ b/Modules/FindwxWidgets.cmake @@ -854,7 +854,7 @@ else() if(_retv EQUAL 0) file(TO_CMAKE_PATH ${_native_path} _native_path) DBG_MSG_V("Path ${_path} converted to ${_native_path}") - set(_tmp_path "${_tmp_path} ${_native_path}") + string(APPEND _tmp_path " ${_native_path}") endif() endforeach() DBG_MSG("Setting wxWidgets_INCLUDE_DIRS = ${_tmp_path}") diff --git a/Modules/FindwxWindows.cmake b/Modules/FindwxWindows.cmake index 6e441c3a4..e405257da 100644 --- a/Modules/FindwxWindows.cmake +++ b/Modules/FindwxWindows.cmake @@ -650,7 +650,7 @@ else() # do we need additionial wx GL stuff like GLCanvas ? if(WXWINDOWS_USE_GL) - set(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" ) + string(APPEND WX_CONFIG_ARGS_LIBS " --gl-libs" ) endif() ##message("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===") diff --git a/Modules/FortranCInterface.cmake b/Modules/FortranCInterface.cmake index c12dd4c64..ae0154184 100644 --- a/Modules/FortranCInterface.cmake +++ b/Modules/FortranCInterface.cmake @@ -270,7 +270,7 @@ function(FortranCInterface_HEADER file) set(_desc_MODULE_ "/* Mangling for Fortran module symbols with underscores. */") foreach(macro GLOBAL GLOBAL_ MODULE MODULE_) if(FortranCInterface_${macro}_MACRO) - set(HEADER_CONTENT "${HEADER_CONTENT} + string(APPEND HEADER_CONTENT " ${_desc_${macro}} #define ${MACRO_NAMESPACE}${macro}${FortranCInterface_${macro}_MACRO} ") @@ -279,7 +279,7 @@ ${_desc_${macro}} # Generate symbol mangling definitions. if(SYMBOLS) - set(HEADER_CONTENT "${HEADER_CONTENT} + string(APPEND HEADER_CONTENT " /*--------------------------------------------------------------------------*/ /* Mangle some symbols automatically. */ ") @@ -300,7 +300,7 @@ ${_desc_${macro}} set(form "") endif() if(FortranCInterface_MODULE${form}_MACRO) - set(HEADER_CONTENT "${HEADER_CONTENT}#define ${SYMBOL_NAMESPACE}${module}_${function} ${MACRO_NAMESPACE}MODULE${form}(${m_lower},${f_lower}, ${m_upper},${f_upper})\n") + string(APPEND HEADER_CONTENT "#define ${SYMBOL_NAMESPACE}${module}_${function} ${MACRO_NAMESPACE}MODULE${form}(${m_lower},${f_lower}, ${m_upper},${f_upper})\n") else() message(AUTHOR_WARNING "No FortranCInterface mangling known for ${f}") endif() @@ -314,7 +314,7 @@ ${_desc_${macro}} string(TOUPPER "${f}" f_upper) string(TOLOWER "${f}" f_lower) if(FortranCInterface_GLOBAL${form}_MACRO) - set(HEADER_CONTENT "${HEADER_CONTENT}#define ${SYMBOL_NAMESPACE}${f} ${MACRO_NAMESPACE}GLOBAL${form}(${f_lower}, ${f_upper})\n") + string(APPEND HEADER_CONTENT "#define ${SYMBOL_NAMESPACE}${f} ${MACRO_NAMESPACE}GLOBAL${form}(${f_lower}, ${f_upper})\n") else() message(AUTHOR_WARNING "No FortranCInterface mangling known for ${f}") endif() diff --git a/Modules/GenerateExportHeader.cmake b/Modules/GenerateExportHeader.cmake index 5540236be..735a0d789 100644 --- a/Modules/GenerateExportHeader.cmake +++ b/Modules/GenerateExportHeader.cmake @@ -415,6 +415,6 @@ function(add_compiler_export_flags) if(ARGC GREATER 0) set(${ARGV0} "${EXTRA_FLAGS}" PARENT_SCOPE) else() - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${EXTRA_FLAGS}" PARENT_SCOPE) + string(APPEND CMAKE_CXX_FLAGS " ${EXTRA_FLAGS}" PARENT_SCOPE) endif() endfunction() diff --git a/Modules/GetPrerequisites.cmake b/Modules/GetPrerequisites.cmake index 631220bf0..322cbd338 100644 --- a/Modules/GetPrerequisites.cmake +++ b/Modules/GetPrerequisites.cmake @@ -796,7 +796,7 @@ function(get_prerequisites target prerequisites_var exclude_system recurse exepa set(old_ld_env "$ENV{LD_LIBRARY_PATH}") set(new_ld_env "${exepath}") foreach(dir ${dirs}) - set(new_ld_env "${new_ld_env}:${dir}") + string(APPEND new_ld_env ":${dir}") endforeach() set(ENV{LD_LIBRARY_PATH} "${new_ld_env}:$ENV{LD_LIBRARY_PATH}") endif() diff --git a/Modules/MatlabTestsRedirect.cmake b/Modules/MatlabTestsRedirect.cmake index 77b7afe69..0ef4c3eb5 100644 --- a/Modules/MatlabTestsRedirect.cmake +++ b/Modules/MatlabTestsRedirect.cmake @@ -46,7 +46,7 @@ get_filename_component(unittest_file_to_run_name "${unittest_file_to_run}" NAME_ set(concat_string '${unittest_file_directory}') foreach(s IN LISTS additional_paths) if(NOT "${s}" STREQUAL "") - set(concat_string "${concat_string}, '${s}'") + string(APPEND concat_string ", '${s}'") endif() endforeach() diff --git a/Modules/Platform/BlueGeneQ-base.cmake b/Modules/Platform/BlueGeneQ-base.cmake index 9372166e8..dc066b75d 100644 --- a/Modules/Platform/BlueGeneQ-base.cmake +++ b/Modules/Platform/BlueGeneQ-base.cmake @@ -110,7 +110,7 @@ macro(__BlueGeneQ_common_setup compiler_id lang) # to do the same thing as the MPI compilers, which add these flags. set(BGQ_SYSTEM_INCLUDES "") foreach(dir ${CMAKE_SYSTEM_INCLUDE_PATH}) - set(BGQ_SYSTEM_INCLUDES "${BGQ_SYSTEM_INCLUDES} -I${dir}") + string(APPEND BGQ_SYSTEM_INCLUDES " -I${dir}") endforeach() set(CMAKE_C_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") set(CMAKE_CXX_COMPILE_OBJECT " ${BGQ_SYSTEM_INCLUDES} -o -c ") diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake index 0c9523c8c..d8e94d0de 100644 --- a/Modules/Platform/Linux-Intel-Fortran.cmake +++ b/Modules/Platform/Linux-Intel-Fortran.cmake @@ -1,4 +1,4 @@ include(Platform/Linux-Intel) __linux_compiler_intel(Fortran) -set(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS} -nofor_main") +string(APPEND CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS " -nofor_main") set(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 14d4c9b81..723c69e64 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -171,7 +171,7 @@ if(WINCE) endforeach() if (MSVC_VERSION LESS 1600) - set(CMAKE_C_STANDARD_LIBRARIES_INIT "${CMAKE_C_STANDARD_LIBRARIES_INIT} corelibc.lib") + string(APPEND CMAKE_C_STANDARD_LIBRARIES_INIT " corelibc.lib") endif () elseif(WINDOWS_PHONE OR WINDOWS_STORE) set(_PLATFORM_DEFINES "/DWIN32") diff --git a/Modules/Qt4Macros.cmake b/Modules/Qt4Macros.cmake index 3b0a6cc26..4b066b741 100644 --- a/Modules/Qt4Macros.cmake +++ b/Modules/Qt4Macros.cmake @@ -441,14 +441,14 @@ macro(QT4_CREATE_TRANSLATION _qm_files) set(_ts_pro ${CMAKE_CURRENT_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/${_ts_name}_lupdate.pro) set(_pro_srcs) foreach(_pro_src ${_my_sources}) - set(_pro_srcs "${_pro_srcs} \\\n \"${_pro_src}\"") + string(APPEND _pro_srcs " \\\n \"${_pro_src}\"") endforeach() set(_pro_includes) get_directory_property(_inc_DIRS INCLUDE_DIRECTORIES) list(REMOVE_DUPLICATES _inc_DIRS) foreach(_pro_include ${_inc_DIRS}) get_filename_component(_abs_include "${_pro_include}" ABSOLUTE) - set(_pro_includes "${_pro_includes} \\\n \"${_abs_include}\"") + string(APPEND _pro_includes " \\\n \"${_abs_include}\"") endforeach() file(WRITE ${_ts_pro} "SOURCES =${_pro_srcs}\nINCLUDEPATH =${_pro_includes}\n") endif() diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index cf9c2d723..f4b5e52c4 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -522,7 +522,7 @@ function(add_jar _TARGET_NAME) endif() foreach (JAVA_INCLUDE_DIR ${CMAKE_JAVA_INCLUDE_PATH}) - set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") + string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${JAVA_INCLUDE_DIR}") endforeach() set(CMAKE_JAVA_CLASS_OUTPUT_PATH "${_add_jar_OUTPUT_DIR}${CMAKE_FILES_DIRECTORY}/${_TARGET_NAME}.dir") @@ -594,7 +594,7 @@ function(add_jar _TARGET_NAME) if (TARGET ${_JAVA_INCLUDE_JAR}) get_target_property(_JAVA_JAR_PATH ${_JAVA_INCLUDE_JAR} JAR_FILE) if (_JAVA_JAR_PATH) - set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}") + string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_JAR_PATH}") list(APPEND CMAKE_JAVA_INCLUDE_PATH ${_JAVA_JAR_PATH}) list(APPEND _JAVA_DEPENDS ${_JAVA_INCLUDE_JAR}) list(APPEND _JAVA_COMPILE_DEPENDS ${_JAVA_INCLUDE_JAR}) @@ -602,7 +602,7 @@ function(add_jar _TARGET_NAME) message(SEND_ERROR "add_jar: INCLUDE_JARS target ${_JAVA_INCLUDE_JAR} is not a jar") endif () else () - set(CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_PATH_FINAL}${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}") + string(APPEND CMAKE_JAVA_INCLUDE_PATH_FINAL "${CMAKE_JAVA_INCLUDE_FLAG_SEP}${_JAVA_INCLUDE_JAR}") list(APPEND CMAKE_JAVA_INCLUDE_PATH "${_JAVA_INCLUDE_JAR}") list(APPEND _JAVA_DEPENDS "${_JAVA_INCLUDE_JAR}") list(APPEND _JAVA_COMPILE_DEPENDS "${_JAVA_INCLUDE_JAR}") diff --git a/Modules/UseSWIG.cmake b/Modules/UseSWIG.cmake index d757f65f7..2631ca1b2 100644 --- a/Modules/UseSWIG.cmake +++ b/Modules/UseSWIG.cmake @@ -163,15 +163,15 @@ macro(SWIG_ADD_SOURCE_TO_MODULE name outfiles infile) "${swig_outdir}/${swig_source_file_name_we}") # add the language into the name of the file (i.e. TCL_wrap) # this allows for the same .i file to be wrapped into different languages - set(swig_generated_file_fullname - "${swig_generated_file_fullname}${SWIG_MODULE_${name}_LANGUAGE}_wrap") + string(APPEND swig_generated_file_fullname + "${SWIG_MODULE_${name}_LANGUAGE}_wrap") if(swig_source_file_cplusplus) - set(swig_generated_file_fullname - "${swig_generated_file_fullname}.${SWIG_CXX_EXTENSION}") + string(APPEND swig_generated_file_fullname + ".${SWIG_CXX_EXTENSION}") else() - set(swig_generated_file_fullname - "${swig_generated_file_fullname}.c") + string(APPEND swig_generated_file_fullname + ".c") endif() #message("Full path to source file: ${swig_source_file_fullname}") diff --git a/Modules/Use_wxWindows.cmake b/Modules/Use_wxWindows.cmake index d3025ac12..597b4ecd3 100644 --- a/Modules/Use_wxWindows.cmake +++ b/Modules/Use_wxWindows.cmake @@ -68,7 +68,7 @@ if(WXWINDOWS_FOUND) link_libraries(${WXWINDOWS_LIBRARIES}) endif() if (CMAKE_WXWINDOWS_CXX_FLAGS) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_WXWINDOWS_CXX_FLAGS}") + string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_WXWINDOWS_CXX_FLAGS}") endif() if(WXWINDOWS_DEFINITIONS) add_definitions(${WXWINDOWS_DEFINITIONS}) diff --git a/Modules/UsewxWidgets.cmake b/Modules/UsewxWidgets.cmake index b3633a6c2..4d16482b0 100644 --- a/Modules/UsewxWidgets.cmake +++ b/Modules/UsewxWidgets.cmake @@ -90,7 +90,7 @@ if (wxWidgets_FOUND) if (wxWidgets_CXX_FLAGS) # Flags are expected to be a string here, not a list. string(REPLACE ";" " " wxWidgets_CXX_FLAGS_str "${wxWidgets_CXX_FLAGS}") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS_str}") + string(APPEND CMAKE_CXX_FLAGS " ${wxWidgets_CXX_FLAGS_str}") MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS_str}") unset(wxWidgets_CXX_FLAGS_str) endif() diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index 2669a84f6..4b829e59c 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -282,9 +282,9 @@ function(write_compiler_detection_header set(_min_version 3.1.0) # Version which introduced this function if (_WCD_VERSION VERSION_LESS _min_version) set(err "VERSION compatibility for write_compiler_detection_header is set to ${_WCD_VERSION}, which is too low.") - set(err "${err} It must be set to at least ${_min_version}. ") - set(err "${err} Either set the VERSION parameter to the write_compiler_detection_header function, or update") - set(err "${err} your minimum required CMake version with the cmake_minimum_required command.") + string(APPEND err " It must be set to at least ${_min_version}. ") + string(APPEND err " Either set the VERSION parameter to the write_compiler_detection_header function, or update") + string(APPEND err " your minimum required CMake version with the cmake_minimum_required command.") message(FATAL_ERROR "${err}") endif() @@ -349,11 +349,11 @@ function(write_compiler_detection_header ") if (_WCD_PROLOG) - set(file_content "${file_content}\n${_WCD_PROLOG}\n") + string(APPEND file_content "\n${_WCD_PROLOG}\n") endif() if (_need_hex_conversion) - set(file_content "${file_content} + string(APPEND file_content " #define ${prefix_arg}_DEC(X) (X) #define ${prefix_arg}_HEX(X) ( \\ ((X)>>28 & 0xF) * 10000000 + \\ @@ -406,24 +406,24 @@ function(write_compiler_detection_header endforeach() if(_lang STREQUAL CXX) - set(file_content "${file_content}\n#ifdef __cplusplus\n") + string(APPEND file_content "\n#ifdef __cplusplus\n") else() - set(file_content "${file_content}\n#ifndef __cplusplus\n") + string(APPEND file_content "\n#ifndef __cplusplus\n") endif() compiler_id_detection(ID_CONTENT ${_lang} PREFIX ${prefix_arg}_ ID_DEFINE ) - set(file_content "${file_content}${ID_CONTENT}\n") + string(APPEND file_content "${ID_CONTENT}\n") set(pp_if "if") foreach(compiler ${target_compilers}) - set(file_content "${file_content}\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n") + string(APPEND file_content "\n# ${pp_if} ${prefix_arg}_COMPILER_IS_${compiler}\n") if(_WCD_OUTPUT_FILES_VAR) set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h") - set(file_content "${file_content}\n# include \"${compile_file_name}\"\n") + string(APPEND file_content "\n# include \"${compile_file_name}\"\n") endif() if(_WCD_OUTPUT_FILES_VAR) @@ -466,7 +466,7 @@ function(write_compiler_detection_header endforeach() endforeach() if(pp_if STREQUAL "elif") - set(file_content "${file_content} + string(APPEND file_content " # else # error Unsupported compiler # endif\n") @@ -477,7 +477,7 @@ function(write_compiler_detection_header set(def_name ${prefix_arg}_${feature_PP}) if (feature STREQUAL c_restrict) set(def_value "${prefix_arg}_RESTRICT") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} restrict # else @@ -487,7 +487,7 @@ function(write_compiler_detection_header endif() if (feature STREQUAL cxx_constexpr) set(def_value "${prefix_arg}_CONSTEXPR") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} constexpr # else @@ -497,7 +497,7 @@ function(write_compiler_detection_header endif() if (feature STREQUAL cxx_final) set(def_value "${prefix_arg}_FINAL") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} final # else @@ -507,7 +507,7 @@ function(write_compiler_detection_header endif() if (feature STREQUAL cxx_override) set(def_value "${prefix_arg}_OVERRIDE") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} override # else @@ -521,11 +521,11 @@ function(write_compiler_detection_header set(static_assert_struct "template struct ${prefix_arg}StaticAssert;\ntemplate<> struct ${prefix_arg}StaticAssert{};\n") set(def_standard "# define ${def_value} static_assert(X, #X)\n# define ${def_value_msg} static_assert(X, MSG)") set(def_alternative "${static_assert_struct}# define ${def_value} sizeof(${prefix_arg}StaticAssert)\n# define ${def_value_msg} sizeof(${prefix_arg}StaticAssert)") - set(file_content "${file_content}# if ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n") + string(APPEND file_content "# if ${def_name}\n${def_standard}\n# else\n${def_alternative}\n# endif\n\n") endif() if (feature STREQUAL cxx_alignas) set(def_value "${prefix_arg}_ALIGNAS(X)") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} alignas(X) # elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang @@ -539,7 +539,7 @@ function(write_compiler_detection_header endif() if (feature STREQUAL cxx_alignof) set(def_value "${prefix_arg}_ALIGNOF(X)") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} alignof(X) # elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang @@ -551,7 +551,7 @@ function(write_compiler_detection_header endif() if (feature STREQUAL cxx_deleted_functions) set(def_value "${prefix_arg}_DELETED_FUNCTION") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} = delete # else @@ -561,7 +561,7 @@ function(write_compiler_detection_header endif() if (feature STREQUAL cxx_extern_templates) set(def_value "${prefix_arg}_EXTERN_TEMPLATE") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} extern # else @@ -571,7 +571,7 @@ function(write_compiler_detection_header endif() if (feature STREQUAL cxx_noexcept) set(def_value "${prefix_arg}_NOEXCEPT") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} noexcept # define ${def_value}_EXPR(X) noexcept(X) @@ -583,7 +583,7 @@ function(write_compiler_detection_header endif() if (feature STREQUAL cxx_nullptr) set(def_value "${prefix_arg}_NULLPTR") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} nullptr # else @@ -593,7 +593,7 @@ function(write_compiler_detection_header endif() if (feature STREQUAL cxx_thread_local) set(def_value "${prefix_arg}_THREAD_LOCAL") - set(file_content "${file_content} + string(APPEND file_content " # if ${def_name} # define ${def_value} thread_local # elif ${prefix_arg}_COMPILER_IS_GNU || ${prefix_arg}_COMPILER_IS_Clang || ${prefix_arg}_COMPILER_IS_AppleClang @@ -608,7 +608,7 @@ function(write_compiler_detection_header if (feature STREQUAL cxx_attribute_deprecated) set(def_name ${prefix_arg}_${feature_PP}) set(def_value "${prefix_arg}_DEPRECATED") - set(file_content "${file_content} + string(APPEND file_content " # ifndef ${def_value} # if ${def_name} # define ${def_value} [[deprecated]] @@ -628,7 +628,7 @@ function(write_compiler_detection_header endif() endforeach() - set(file_content "${file_content}#endif\n") + string(APPEND file_content "#endif\n") endforeach() @@ -637,7 +637,7 @@ function(write_compiler_detection_header foreach(_lang ${_langs}) if(compiler_file_content_${compiler}_${_lang}) set(CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_}") - set(CMAKE_CONFIGURABLE_FILE_CONTENT "${CMAKE_CONFIGURABLE_FILE_CONTENT}${compiler_file_content_${compiler}_${_lang}}") + string(APPEND CMAKE_CONFIGURABLE_FILE_CONTENT "${compiler_file_content_${compiler}_${_lang}}") set(compile_file_name "${_WCD_OUTPUT_DIR}${prefix_arg}_COMPILER_INFO_${compiler}_${_lang}.h") set(full_path "${main_file_dir}/${compile_file_name}") @@ -653,9 +653,9 @@ function(write_compiler_detection_header endif() if (_WCD_EPILOG) - set(file_content "${file_content}\n${_WCD_EPILOG}\n") + string(APPEND file_content "\n${_WCD_EPILOG}\n") endif() - set(file_content "${file_content}\n#endif") + string(APPEND file_content "\n#endif") set(CMAKE_CONFIGURABLE_FILE_CONTENT ${file_content}) configure_file("${CMAKE_ROOT}/Modules/CMakeConfigurableFile.in" From 7a649111cdea2b10f2ec57084416be619867fbfb Mon Sep 17 00:00:00 2001 From: Daniel Pfeifer Date: Thu, 28 Jul 2016 00:43:04 +0200 Subject: [PATCH 2/2] 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' --- Tests/AliasTarget/CMakeLists.txt | 2 +- .../CheckCXXSymbolExists/CMakeLists.txt | 2 +- .../CheckStructHasMember/CMakeLists.txt | 2 +- .../CheckSymbolExists/CMakeLists.txt | 2 +- Tests/CMakeTests/ModuleNoticesTest.cmake.in | 2 +- Tests/CMakeTests/WhileTest.cmake.in | 6 ++-- ...lt-components-lintian-dpkgdeb-checks.cmake | 2 +- .../RunCPackVerifyResult.cmake | 2 +- Tests/CTestUpdateBZR.cmake.in | 2 +- Tests/CTestUpdateCVS.cmake.in | 2 +- Tests/CTestUpdateCommon.cmake | 12 ++++---- Tests/CTestUpdateGIT.cmake.in | 2 +- Tests/CTestUpdateHG.cmake.in | 2 +- Tests/CTestUpdateP4.cmake.in | 8 ++--- Tests/CTestUpdateSVN.cmake.in | 2 +- Tests/Complex/CMakeLists.txt | 4 +-- Tests/Complex/Executable/CMakeLists.txt | 4 +-- Tests/Complex/Library/CMakeLists.txt | 2 +- Tests/Complex/VarTests.cmake | 2 +- Tests/ComplexOneConfig/CMakeLists.txt | 4 +-- .../Executable/CMakeLists.txt | 4 +-- Tests/ComplexOneConfig/Library/CMakeLists.txt | 2 +- Tests/ComplexOneConfig/VarTests.cmake | 2 +- Tests/CustomCommand/CMakeLists.txt | 6 ++-- Tests/FindPackageTest/CMakeLists.txt | 2 +- Tests/Fortran/CMakeLists.txt | 2 +- Tests/IncludeDirectories/CMakeLists.txt | 4 +-- Tests/MakeClean/CMakeLists.txt | 2 +- Tests/MathTest/CMakeLists.txt | 2 +- .../GenerateExportHeader/CMakeLists.txt | 4 +-- Tests/Plugin/CMakeLists.txt | 2 +- Tests/Preprocess/CMakeLists.txt | 30 +++++++++---------- Tests/RunCMake/BuildDepends/check.cmake | 8 ++--- .../CMP0054/CMP0054-policy-while-scope.cmake | 4 +-- Tests/RunCMake/CPack/DEB/Helpers.cmake | 10 +++---- Tests/RunCMake/CPack/VerifyResult.cmake | 4 +-- Tests/RunCMake/RunCMake.cmake | 6 ++-- Tests/RunCMake/continue/ContinueWhile.cmake | 2 +- Tests/RunCMake/if/IsDirectoryLong.cmake | 2 +- .../check_utils.cmake | 6 ++-- .../DIRECTORY-MESSAGE_NEVER-check.cmake | 8 ++--- .../install/DIRECTORY-message-check.cmake | 12 ++++---- .../DIRECTORY-message-lazy-check.cmake | 12 ++++---- Tests/SimpleInstall/CMakeLists.txt | 4 +-- Tests/SimpleInstallS2/CMakeLists.txt | 4 +-- Tests/TryCompile/CMakeLists.txt | 4 +-- Tests/VSMASM/CMakeLists.txt | 2 +- 47 files changed, 108 insertions(+), 108 deletions(-) diff --git a/Tests/AliasTarget/CMakeLists.txt b/Tests/AliasTarget/CMakeLists.txt index 47ccbdc9b..f9ae03ad6 100644 --- a/Tests/AliasTarget/CMakeLists.txt +++ b/Tests/AliasTarget/CMakeLists.txt @@ -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 diff --git a/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt b/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt index 9528aa357..f058c19fb 100644 --- a/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckCXXSymbolExists/CMakeLists.txt @@ -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") diff --git a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt index f06d5c34d..a58450515 100644 --- a/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckStructHasMember/CMakeLists.txt @@ -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) diff --git a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt index 765657712..7f01463c0 100644 --- a/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt +++ b/Tests/CMakeOnly/CheckSymbolExists/CMakeLists.txt @@ -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") diff --git a/Tests/CMakeTests/ModuleNoticesTest.cmake.in b/Tests/CMakeTests/ModuleNoticesTest.cmake.in index 8ecebd338..7bea0af48 100644 --- a/Tests/CMakeTests/ModuleNoticesTest.cmake.in +++ b/Tests/CMakeTests/ModuleNoticesTest.cmake.in @@ -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() diff --git a/Tests/CMakeTests/WhileTest.cmake.in b/Tests/CMakeTests/WhileTest.cmake.in index cc22978ce..90665448e 100644 --- a/Tests/CMakeTests/WhileTest.cmake.in +++ b/Tests/CMakeTests/WhileTest.cmake.in @@ -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() diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake index d51650c0a..f1391cd73 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult-components-lintian-dpkgdeb-checks.cmake @@ -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 "") diff --git a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake index b4e567c9e..2f9e2fc92 100644 --- a/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake +++ b/Tests/CPackComponentsDEB/RunCPackVerifyResult.cmake @@ -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() diff --git a/Tests/CTestUpdateBZR.cmake.in b/Tests/CTestUpdateBZR.cmake.in index 8fb1d3483..da181d2ed 100644 --- a/Tests/CTestUpdateBZR.cmake.in +++ b/Tests/CTestUpdateBZR.cmake.in @@ -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") diff --git a/Tests/CTestUpdateCVS.cmake.in b/Tests/CTestUpdateCVS.cmake.in index 277b3a603..5389bdf51 100644 --- a/Tests/CTestUpdateCVS.cmake.in +++ b/Tests/CTestUpdateCVS.cmake.in @@ -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}) diff --git a/Tests/CTestUpdateCommon.cmake b/Tests/CTestUpdateCommon.cmake index 458e42743..61aa13b94 100644 --- a/Tests/CTestUpdateCommon.cmake +++ b/Tests/CTestUpdateCommon.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 diff --git a/Tests/CTestUpdateGIT.cmake.in b/Tests/CTestUpdateGIT.cmake.in index 46230cca3..7d0fa0fab 100644 --- a/Tests/CTestUpdateGIT.cmake.in +++ b/Tests/CTestUpdateGIT.cmake.in @@ -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. diff --git a/Tests/CTestUpdateHG.cmake.in b/Tests/CTestUpdateHG.cmake.in index c76bf9192..055d309e6 100644 --- a/Tests/CTestUpdateHG.cmake.in +++ b/Tests/CTestUpdateHG.cmake.in @@ -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") diff --git a/Tests/CTestUpdateP4.cmake.in b/Tests/CTestUpdateP4.cmake.in index f0420c42f..5eef9fbe3 100644 --- a/Tests/CTestUpdateP4.cmake.in +++ b/Tests/CTestUpdateP4.cmake.in @@ -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}") diff --git a/Tests/CTestUpdateSVN.cmake.in b/Tests/CTestUpdateSVN.cmake.in index b757a441d..12a3526cb 100644 --- a/Tests/CTestUpdateSVN.cmake.in +++ b/Tests/CTestUpdateSVN.cmake.in @@ -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. diff --git a/Tests/Complex/CMakeLists.txt b/Tests/Complex/CMakeLists.txt index a4a33c3c7..80cc2e3ba 100644 --- a/Tests/Complex/CMakeLists.txt +++ b/Tests/Complex/CMakeLists.txt @@ -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 diff --git a/Tests/Complex/Executable/CMakeLists.txt b/Tests/Complex/Executable/CMakeLists.txt index c30dcbc40..2a796298b 100644 --- a/Tests/Complex/Executable/CMakeLists.txt +++ b/Tests/Complex/Executable/CMakeLists.txt @@ -1,8 +1,8 @@ # # 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) diff --git a/Tests/Complex/Library/CMakeLists.txt b/Tests/Complex/Library/CMakeLists.txt index f00cbd611..dbf806e4f 100644 --- a/Tests/Complex/Library/CMakeLists.txt +++ b/Tests/Complex/Library/CMakeLists.txt @@ -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 diff --git a/Tests/Complex/VarTests.cmake b/Tests/Complex/VarTests.cmake index 70b803a1e..9d35949af 100644 --- a/Tests/Complex/VarTests.cmake +++ b/Tests/Complex/VarTests.cmake @@ -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() diff --git a/Tests/ComplexOneConfig/CMakeLists.txt b/Tests/ComplexOneConfig/CMakeLists.txt index 9090ab5d2..1b833b241 100644 --- a/Tests/ComplexOneConfig/CMakeLists.txt +++ b/Tests/ComplexOneConfig/CMakeLists.txt @@ -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 diff --git a/Tests/ComplexOneConfig/Executable/CMakeLists.txt b/Tests/ComplexOneConfig/Executable/CMakeLists.txt index 4897b484a..f935aed1d 100644 --- a/Tests/ComplexOneConfig/Executable/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Executable/CMakeLists.txt @@ -1,8 +1,8 @@ # # 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) diff --git a/Tests/ComplexOneConfig/Library/CMakeLists.txt b/Tests/ComplexOneConfig/Library/CMakeLists.txt index f00cbd611..dbf806e4f 100644 --- a/Tests/ComplexOneConfig/Library/CMakeLists.txt +++ b/Tests/ComplexOneConfig/Library/CMakeLists.txt @@ -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 diff --git a/Tests/ComplexOneConfig/VarTests.cmake b/Tests/ComplexOneConfig/VarTests.cmake index 70b803a1e..9d35949af 100644 --- a/Tests/ComplexOneConfig/VarTests.cmake +++ b/Tests/ComplexOneConfig/VarTests.cmake @@ -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() diff --git a/Tests/CustomCommand/CMakeLists.txt b/Tests/CustomCommand/CMakeLists.txt index 268069d72..db57e19dc 100644 --- a/Tests/CustomCommand/CMakeLists.txt +++ b/Tests/CustomCommand/CMakeLists.txt @@ -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( diff --git a/Tests/FindPackageTest/CMakeLists.txt b/Tests/FindPackageTest/CMakeLists.txt index fadd0feef..d3e68bc5f 100644 --- a/Tests/FindPackageTest/CMakeLists.txt +++ b/Tests/FindPackageTest/CMakeLists.txt @@ -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 diff --git a/Tests/Fortran/CMakeLists.txt b/Tests/Fortran/CMakeLists.txt index 12689824b..99fcc0a6d 100644 --- a/Tests/Fortran/CMakeLists.txt +++ b/Tests/Fortran/CMakeLists.txt @@ -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 diff --git a/Tests/IncludeDirectories/CMakeLists.txt b/Tests/IncludeDirectories/CMakeLists.txt index 523c4f71c..49205828f 100644 --- a/Tests/IncludeDirectories/CMakeLists.txt +++ b/Tests/IncludeDirectories/CMakeLists.txt @@ -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) diff --git a/Tests/MakeClean/CMakeLists.txt b/Tests/MakeClean/CMakeLists.txt index 8ac624a63..fbd499534 100644 --- a/Tests/MakeClean/CMakeLists.txt +++ b/Tests/MakeClean/CMakeLists.txt @@ -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) diff --git a/Tests/MathTest/CMakeLists.txt b/Tests/MathTest/CMakeLists.txt index 34beaa0aa..ed2c7d48c 100644 --- a/Tests/MathTest/CMakeLists.txt +++ b/Tests/MathTest/CMakeLists.txt @@ -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( diff --git a/Tests/Module/GenerateExportHeader/CMakeLists.txt b/Tests/Module/GenerateExportHeader/CMakeLists.txt index 8b94ca786..56f0f28af 100644 --- a/Tests/Module/GenerateExportHeader/CMakeLists.txt +++ b/Tests/Module/GenerateExportHeader/CMakeLists.txt @@ -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) diff --git a/Tests/Plugin/CMakeLists.txt b/Tests/Plugin/CMakeLists.txt index 49ff317e8..f52b47954 100644 --- a/Tests/Plugin/CMakeLists.txt +++ b/Tests/Plugin/CMakeLists.txt @@ -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 diff --git a/Tests/Preprocess/CMakeLists.txt b/Tests/Preprocess/CMakeLists.txt index b930f5653..15f0338ad 100644 --- a/Tests/Preprocess/CMakeLists.txt +++ b/Tests/Preprocess/CMakeLists.txt @@ -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) diff --git a/Tests/RunCMake/BuildDepends/check.cmake b/Tests/RunCMake/BuildDepends/check.cmake index 26a9eb65d..c7b5c3d32 100644 --- a/Tests/RunCMake/BuildDepends/check.cmake +++ b/Tests/RunCMake/BuildDepends/check.cmake @@ -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() diff --git a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake index 2b22778b5..7fb836eb2 100644 --- a/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake +++ b/Tests/RunCMake/CMP0054/CMP0054-policy-while-scope.cmake @@ -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) diff --git a/Tests/RunCMake/CPack/DEB/Helpers.cmake b/Tests/RunCMake/CPack/DEB/Helpers.cmake index d05f11517..9b1be224d 100644 --- a/Tests/RunCMake/CPack/DEB/Helpers.cmake +++ b/Tests/RunCMake/CPack/DEB/Helpers.cmake @@ -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() diff --git a/Tests/RunCMake/CPack/VerifyResult.cmake b/Tests/RunCMake/CPack/VerifyResult.cmake index 6eab5312a..804766892 100644 --- a/Tests/RunCMake/CPack/VerifyResult.cmake +++ b/Tests/RunCMake/CPack/VerifyResult.cmake @@ -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_) diff --git a/Tests/RunCMake/RunCMake.cmake b/Tests/RunCMake/RunCMake.cmake index fa0c98050..247855ac8 100644 --- a/Tests/RunCMake/RunCMake.cmake +++ b/Tests/RunCMake/RunCMake.cmake @@ -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}") diff --git a/Tests/RunCMake/continue/ContinueWhile.cmake b/Tests/RunCMake/continue/ContinueWhile.cmake index c1fa87ac2..f69993cc4 100644 --- a/Tests/RunCMake/continue/ContinueWhile.cmake +++ b/Tests/RunCMake/continue/ContinueWhile.cmake @@ -1,7 +1,7 @@ message(STATUS "start") unset(iter) while(NOT "${iter}" STREQUAL "aaaaa") - set(iter "${iter}a") + string(APPEND iter "a") if("${iter}" STREQUAL "aaa") continue() endif() diff --git a/Tests/RunCMake/if/IsDirectoryLong.cmake b/Tests/RunCMake/if/IsDirectoryLong.cmake index 0e93be744..e6939ac10 100644 --- a/Tests/RunCMake/if/IsDirectoryLong.cmake +++ b/Tests/RunCMake/if/IsDirectoryLong.cmake @@ -1,6 +1,6 @@ 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}/") diff --git a/Tests/RunCMake/include_external_msproject/check_utils.cmake b/Tests/RunCMake/include_external_msproject/check_utils.cmake index 408cadb78..5dd92f9cc 100644 --- a/Tests/RunCMake/include_external_msproject/check_utils.cmake +++ b/Tests/RunCMake/include_external_msproject/check_utils.cmake @@ -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) diff --git a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake index 2c716e1e2..3605163a0 100644 --- a/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake +++ b/Tests/RunCMake/install/DIRECTORY-MESSAGE_NEVER-check.cmake @@ -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() diff --git a/Tests/RunCMake/install/DIRECTORY-message-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-check.cmake index 857681fbc..c9de3ead1 100644 --- a/Tests/RunCMake/install/DIRECTORY-message-check.cmake +++ b/Tests/RunCMake/install/DIRECTORY-message-check.cmake @@ -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 + "File was not installed:\n ${f}\n") endif() execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake OUTPUT_VARIABLE out ERROR_VARIABLE err) @@ -23,6 +23,6 @@ set(expect " ") if(NOT out MATCHES "${expect}") string(REGEX REPLACE "\n" "\n " out " ${out}") - set(RunCMake_TEST_FAILED - "${RunCMake_TEST_FAILED}Second install did not say 'Up-to-date' as expected:\n${out}") + string(APPEND RunCMake_TEST_FAILED + "Second install did not say 'Up-to-date' as expected:\n${out}") endif() diff --git a/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake index c7e601880..433901201 100644 --- a/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake +++ b/Tests/RunCMake/install/DIRECTORY-message-lazy-check.cmake @@ -7,18 +7,18 @@ 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 + "File was not installed:\n ${f}\n") endif() execute_process(COMMAND ${CMAKE_COMMAND} -P ${RunCMake_TEST_BINARY_DIR}/cmake_install.cmake OUTPUT_VARIABLE out ERROR_VARIABLE err) if(out MATCHES "(Installing|Up-to-date)") string(REGEX REPLACE "\n" "\n " out " ${out}") - set(RunCMake_TEST_FAILED - "${RunCMake_TEST_FAILED}Second install was not silent as expected:\n${out}") + string(APPEND RunCMake_TEST_FAILED + "Second install was not silent as expected:\n${out}") endif() diff --git a/Tests/SimpleInstall/CMakeLists.txt b/Tests/SimpleInstall/CMakeLists.txt index aee92f603..5a1392bb8 100644 --- a/Tests/SimpleInstall/CMakeLists.txt +++ b/Tests/SimpleInstall/CMakeLists.txt @@ -348,7 +348,7 @@ if(UNIX AND NOT APPLE) # if(NOT SKIP_TZ) # message("compress found and it was not a script") # message("output from file command: [${output}]") - # set(CPACK_GENERATOR "${CPACK_GENERATOR};TZ") + # string(APPEND CPACK_GENERATOR ";TZ") # else() # message("compress found, but it was a script so dont use it") # message("output from file command: [${output}]") @@ -357,7 +357,7 @@ if(UNIX AND NOT APPLE) find_program(found_bz2 NAMES bzip2) if(found_bz2) - set(CPACK_GENERATOR "${CPACK_GENERATOR};TBZ2") + string(APPEND CPACK_GENERATOR ";TBZ2") endif() endif() diff --git a/Tests/SimpleInstallS2/CMakeLists.txt b/Tests/SimpleInstallS2/CMakeLists.txt index aee92f603..5a1392bb8 100644 --- a/Tests/SimpleInstallS2/CMakeLists.txt +++ b/Tests/SimpleInstallS2/CMakeLists.txt @@ -348,7 +348,7 @@ if(UNIX AND NOT APPLE) # if(NOT SKIP_TZ) # message("compress found and it was not a script") # message("output from file command: [${output}]") - # set(CPACK_GENERATOR "${CPACK_GENERATOR};TZ") + # string(APPEND CPACK_GENERATOR ";TZ") # else() # message("compress found, but it was a script so dont use it") # message("output from file command: [${output}]") @@ -357,7 +357,7 @@ if(UNIX AND NOT APPLE) find_program(found_bz2 NAMES bzip2) if(found_bz2) - set(CPACK_GENERATOR "${CPACK_GENERATOR};TBZ2") + string(APPEND CPACK_GENERATOR ";TBZ2") endif() endif() diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index d11cfc50a..2f8e4fb3c 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -109,9 +109,9 @@ endif() # try to compile a file that should compile set(_c_flags "${CMAKE_C_FLAGS}") if(WATCOM) - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -dTESTDEF") + string(APPEND CMAKE_C_FLAGS " -dTESTDEF") else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} \"-DTESTDEF\"") + string(APPEND CMAKE_C_FLAGS " \"-DTESTDEF\"") endif() try_compile(SHOULD_PASS ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp diff --git a/Tests/VSMASM/CMakeLists.txt b/Tests/VSMASM/CMakeLists.txt index f2570a309..2923e1527 100644 --- a/Tests/VSMASM/CMakeLists.txt +++ b/Tests/VSMASM/CMakeLists.txt @@ -4,7 +4,7 @@ if(CMAKE_SIZEOF_VOID_P EQUAL 8) add_definitions(-DTESTx64) else() add_definitions(-DTESTi386) - set(CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /safeseh") + string(APPEND CMAKE_ASM_MASM_FLAGS " /safeseh") endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include) add_executable(VSMASM main.c foo.asm)