diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-07-27 22:41:13 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2016-07-27 22:41:13 (GMT) |
commit | 5d0d980d9949daf596e10715d686adc95c1c232b (patch) | |
tree | 45ec5b1fd21b10dc996083f5fe5657d8b07c3232 | |
parent | 73c618be7036c693cbff764b3765de1bf4626cfb (diff) | |
download | CMake-5d0d980d9949daf596e10715d686adc95c1c232b.zip CMake-5d0d980d9949daf596e10715d686adc95c1c232b.tar.gz CMake-5d0d980d9949daf596e10715d686adc95c1c232b.tar.bz2 |
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'
58 files changed, 240 insertions, 240 deletions
diff --git a/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in b/Modules/BasicConfigVersion-AnyNewerVersion.cmake.in index bc78016..3e8c511 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 de4a23a..5741007 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 a32245d..0fad8a3 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 f1db46e..f4044e5 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 6b37208..8bf7288 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 1d341e5..17e5302 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 70ceaa6..64d9bed 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 0f27a78..596fc5f 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 5e5302f..828ea9e 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 da029bc..f6d07e5 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<num>). 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 474fa41..61a0909 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} = <NOTFOUND>\n") + string(APPEND msg " ${item}.${prop} = <NOTFOUND>\n") endif() endforeach() endif() diff --git a/Modules/CPack.cmake b/Modules/CPack.cmake index 4d51a3e..675b38b 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 6a33086..085992a 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 2f0e03e..ebc5c90 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 0ce6486..c195746 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 c79119f..1a57d00 100644 --- a/Modules/CTestUseLaunchers.cmake +++ b/Modules/CTestUseLaunchers.cmake @@ -59,7 +59,7 @@ if(CTEST_USE_LAUNCHERS) "${__launch_common_options} --output <OUTPUT>") if("${CMAKE_GENERATOR}" MATCHES "Ninja") - set(__launch_compile_options "${__launch_compile_options} --filter-prefix <CMAKE_CL_SHOWINCLUDES_PREFIX>") + string(APPEND __launch_compile_options " --filter-prefix <CMAKE_CL_SHOWINCLUDES_PREFIX>") endif() set(CTEST_LAUNCH_COMPILE diff --git a/Modules/CheckIncludeFile.cmake b/Modules/CheckIncludeFile.cmake index ef1e39d..cfbc28f 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 9a6df3b..59df7cb 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 843cd35..3657c95 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 e203d4c..b9345e7 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 6c15205..e9e5a18 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 c4dff3f..a62d1e1 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 5938d6c..827905b 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 <sys/types.h>\n") + string(APPEND headers "#include <sys/types.h>\n") endif() if(HAVE_STDINT_H) - set(headers "${headers}#include <stdint.h>\n") + string(APPEND headers "#include <stdint.h>\n") endif() if(HAVE_STDDEF_H) - set(headers "${headers}#include <stddef.h>\n") + string(APPEND headers "#include <stddef.h>\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 397f95c..83817f7 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 db487d8..90298d6 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 de475e4..f5ac959 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 02d2b15..a0bffe7 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 7e179aa..755b4fb 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}-$<CONFIG>-impl.cmake" CONTENT "${code}") set(command ${CMAKE_COMMAND} "-Dmake=\${make}" "-Dconfig=\${config}" -P ${stamp_dir}/${name}-${step}-$<CONFIG>-impl.cmake) endif() diff --git a/Modules/FeatureSummary.cmake b/Modules/FeatureSummary.cmake index dc31086..764a5f7 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 ed149c6..1f03841 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 8c000a0..6d9b833 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_<CONFIG> 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_<CONFIG> 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 802f93a..7b5389e 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 12b83e0..ff1f515 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 51eb7c5..6f70455 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 653094c..70fc35b 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 e38e5ed..35dc17d 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 fbc6795..4f78623 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 25fff8c..7eab161 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 fe2dbea..96590cb 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 d16460b..b6156dd 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 d167a13..bf41ea1 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 494d358..b378c34 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 0b36d6f..f4dc5ae 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 8c07e6c..2974b9e 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 6e441c3..e405257 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 c12dd4c..ae01541 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 5540236..735a0d7 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 631220b..322cbd3 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 77b7afe..0ef4c3e 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 9372166..dc066b7 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 "<CMAKE_C_COMPILER> <DEFINES> ${BGQ_SYSTEM_INCLUDES} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") set(CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${BGQ_SYSTEM_INCLUDES} <INCLUDES> <FLAGS> -o <OBJECT> -c <SOURCE>") diff --git a/Modules/Platform/Linux-Intel-Fortran.cmake b/Modules/Platform/Linux-Intel-Fortran.cmake index 0c9523c..d8e94d0 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 14d4c9b..723c69e 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 3b0a6cc..4b066b74 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 cf9c2d7..f4b5e52 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 d757f65..2631ca1 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 d3025ac..597b4ec 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 b3633a6..4d16482 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 2669a84..4b829e5 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<bool> struct ${prefix_arg}StaticAssert;\ntemplate<> struct ${prefix_arg}StaticAssert<true>{};\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<X>)\n# define ${def_value_msg} sizeof(${prefix_arg}StaticAssert<X>)") - 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" |