diff options
author | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-05-17 17:23:34 (GMT) |
---|---|---|
committer | Daniel Pfeifer <daniel@pfeifer-mail.de> | 2017-05-17 17:26:11 (GMT) |
commit | 9e24af01375d370ae84c40a95501aa5a33d3fe97 (patch) | |
tree | cb39dc478d6e4742d143244a16cffe75ff22539c | |
parent | 3f25f873f8f0cd4c9c8d5dce29535c6b2757eaea (diff) | |
download | CMake-9e24af01375d370ae84c40a95501aa5a33d3fe97.zip CMake-9e24af01375d370ae84c40a95501aa5a33d3fe97.tar.gz CMake-9e24af01375d370ae84c40a95501aa5a33d3fe97.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'
-rw-r--r-- | Modules/CMakeCompilerIdDetection.cmake | 8 | ||||
-rw-r--r-- | Modules/CPackComponent.cmake | 10 | ||||
-rw-r--r-- | Modules/CheckTypeSize.cmake | 4 | ||||
-rw-r--r-- | Modules/ExternalData.cmake | 2 | ||||
-rw-r--r-- | Modules/ExternalProject.cmake | 8 | ||||
-rw-r--r-- | Modules/FindCUDA.cmake | 2 | ||||
-rw-r--r-- | Modules/FindOpenGL.cmake | 4 | ||||
-rw-r--r-- | Modules/Platform/AIX-GNU.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/CYGWIN-GNU.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/HP-UX-GNU.cmake | 2 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 4 | ||||
-rw-r--r-- | Modules/UseJava.cmake | 2 | ||||
-rw-r--r-- | Modules/WriteCompilerDetectionHeader.cmake | 6 |
13 files changed, 28 insertions, 28 deletions
diff --git a/Modules/CMakeCompilerIdDetection.cmake b/Modules/CMakeCompilerIdDetection.cmake index 7ca79bd..f2d43b6 100644 --- a/Modules/CMakeCompilerIdDetection.cmake +++ b/Modules/CMakeCompilerIdDetection.cmake @@ -95,13 +95,13 @@ function(compiler_id_detection outvar lang) if(CID_ID_DEFINE) foreach(Id ${ordered_compilers}) - set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n") + string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "# define ${CID_PREFIX}COMPILER_IS_${Id} 0\n") endforeach() endif() set(pp_if "#if") if (CID_VERSION_STRINGS) - set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n/* Version number components: V=Version, R=Revision, P=Patch + string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "\n/* Version number components: V=Version, R=Revision, P=Patch Version date components: YYYY=Year, MM=Month, DD=Day */\n") endif() @@ -126,7 +126,7 @@ function(compiler_id_detection outvar lang) string(CONFIGURE "${_compiler_id_version_compute_${Id}}" VERSION_BLOCK @ONLY) string(APPEND id_content "${VERSION_BLOCK}\n") endif() - set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${id_content}") + string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "\n${id_content}") set(pp_if "#elif") endforeach() @@ -145,7 +145,7 @@ function(compiler_id_detection outvar lang) # define ${CID_PREFIX}COMPILER_ID \"\"") endif() - set(CMAKE_${lang}_COMPILER_ID_CONTENT "${CMAKE_${lang}_COMPILER_ID_CONTENT}\n${platform_compiler_detection}\n#endif") + string(APPEND CMAKE_${lang}_COMPILER_ID_CONTENT "\n${platform_compiler_detection}\n#endif") endif() set(${outvar} ${CMAKE_${lang}_COMPILER_ID_CONTENT} PARENT_SCOPE) diff --git a/Modules/CPackComponent.cmake b/Modules/CPackComponent.cmake index 2adc9b9..3a10b99 100644 --- a/Modules/CPackComponent.cmake +++ b/Modules/CPackComponent.cmake @@ -309,11 +309,11 @@ set(CPackComponent_CMake_INCLUDED 1) # configuration file. macro(cpack_append_variable_set_command var strvar) if (DEFINED ${var}) - set(${strvar} "${${strvar}}set(${var}") + string(APPEND ${strvar} "set(${var}") foreach(APPENDVAL ${${var}}) - set(${strvar} "${${strvar}} ${APPENDVAL}") + string(APPEND ${strvar} " ${APPENDVAL}") endforeach() - set(${strvar} "${${strvar}})\n") + string(APPEND ${strvar} ")\n") endif () endmacro() @@ -325,7 +325,7 @@ macro(cpack_append_string_variable_set_command var strvar) if (DEFINED ${var}) list(LENGTH ${var} CPACK_APP_VALUE_LEN) if(${CPACK_APP_VALUE_LEN} EQUAL 1) - set(${strvar} "${${strvar}}set(${var} \"${${var}}\")\n") + string(APPEND ${strvar} "set(${var} \"${${var}}\")\n") endif() endif () endmacro() @@ -352,7 +352,7 @@ macro(cpack_append_option_set_command var strvar) if (${var}) list(LENGTH ${var} CPACK_APP_VALUE_LEN) if(${CPACK_APP_VALUE_LEN} EQUAL 1) - set(${strvar} "${${strvar}}set(${var} TRUE)\n") + string(APPEND ${strvar} "set(${var} TRUE)\n") endif() endif () endmacro() diff --git a/Modules/CheckTypeSize.cmake b/Modules/CheckTypeSize.cmake index 4b3e223..fcf1df7 100644 --- a/Modules/CheckTypeSize.cmake +++ b/Modules/CheckTypeSize.cmake @@ -247,10 +247,10 @@ macro(CHECK_TYPE_SIZE TYPE VARIABLE) set(${VARIABLE}_CODE) set(_if if) foreach(key ${${VARIABLE}_KEYS}) - set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#${_if} defined(${key})\n# define ${VARIABLE} ${${VARIABLE}-${key}}\n") + string(APPEND ${VARIABLE}_CODE "#${_if} defined(${key})\n# define ${VARIABLE} ${${VARIABLE}-${key}}\n") set(_if elif) endforeach() - set(${VARIABLE}_CODE "${${VARIABLE}_CODE}#else\n# error ${VARIABLE} unknown\n#endif") + string(APPEND ${VARIABLE}_CODE "#else\n# error ${VARIABLE} unknown\n#endif") set(_if) elseif(${VARIABLE}) set(${VARIABLE}_CODE "#define ${VARIABLE} ${${VARIABLE}}") diff --git a/Modules/ExternalData.cmake b/Modules/ExternalData.cmake index 873f88d..7331fb2 100644 --- a/Modules/ExternalData.cmake +++ b/Modules/ExternalData.cmake @@ -1111,7 +1111,7 @@ if("${ExternalData_ACTION}" STREQUAL "fetch") list(GET algo_list ${ii} algo) _ExternalData_download_object("${name}" "${hash}" "${algo}" obj succeeded algoErrorMsg) - set(errorMsg "${errorMsg}\n${algoErrorMsg}") + string(APPEND errorMsg "\n${algoErrorMsg}") if(succeeded) break() endif() diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake index b812845..2495736 100644 --- a/Modules/ExternalProject.cmake +++ b/Modules/ExternalProject.cmake @@ -415,7 +415,7 @@ file(STRINGS "${CMAKE_CURRENT_LIST_FILE}" lines foreach(line IN LISTS lines) if("${line}" MATCHES "^\\.\\. command:: ([A-Za-z0-9_]+)") if(_ep_func) - set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") + string(APPEND _ep_keywords_${_ep_func} ")$") endif() set(_ep_func "${CMAKE_MATCH_1}") #message("function [${_ep_func}]") @@ -424,13 +424,13 @@ foreach(line IN LISTS lines) elseif("${line}" MATCHES "^ ``([A-Z0-9_]+) .*``$") set(_ep_key "${CMAKE_MATCH_1}") #message(" keyword [${_ep_key}]") - set(_ep_keywords_${_ep_func} - "${_ep_keywords_${_ep_func}}${_ep_keyword_sep}${_ep_key}") + string(APPEND _ep_keywords_${_ep_func} + "${_ep_keyword_sep}${_ep_key}") set(_ep_keyword_sep "|") endif() endforeach() if(_ep_func) - set(_ep_keywords_${_ep_func} "${_ep_keywords_${_ep_func}})$") + string(APPEND _ep_keywords_${_ep_func} ")$") endif() # Save regex matching supported hash algorithm names. diff --git a/Modules/FindCUDA.cmake b/Modules/FindCUDA.cmake index e323430..a4dca54 100644 --- a/Modules/FindCUDA.cmake +++ b/Modules/FindCUDA.cmake @@ -1825,7 +1825,7 @@ macro(cuda_compile_base cuda_target format generated_files) else() set(_counter 1) endif() - set(_cuda_target "${_cuda_target}_${_counter}") + string(APPEND _cuda_target "_${_counter}") set_property(DIRECTORY PROPERTY _cuda_internal_phony_counter ${_counter}) # Separate the sources from the options diff --git a/Modules/FindOpenGL.cmake b/Modules/FindOpenGL.cmake index 503d955..af83fb7 100644 --- a/Modules/FindOpenGL.cmake +++ b/Modules/FindOpenGL.cmake @@ -178,7 +178,7 @@ if(OPENGL_FOUND) if(OPENGL_gl_LIBRARY MATCHES "/([^/]+)\\.framework$") set(_gl_fw "${OPENGL_gl_LIBRARY}/${CMAKE_MATCH_1}") if(EXISTS "${_gl_fw}.tbd") - set(_gl_fw "${_gl_fw}.tbd") + string(APPEND _gl_fw ".tbd") endif() set_target_properties(OpenGL::GL PROPERTIES IMPORTED_LOCATION "${_gl_fw}") @@ -201,7 +201,7 @@ if(OPENGL_FOUND) if(OPENGL_glu_LIBRARY MATCHES "/([^/]+)\\.framework$") set(_glu_fw "${OPENGL_glu_LIBRARY}/${CMAKE_MATCH_1}") if(EXISTS "${_glu_fw}.tbd") - set(_glu_fw "${_glu_fw}.tbd") + string(APPEND _glu_fw ".tbd") endif() set_target_properties(OpenGL::GLU PROPERTIES IMPORTED_LOCATION "${_glu_fw}") diff --git a/Modules/Platform/AIX-GNU.cmake b/Modules/Platform/AIX-GNU.cmake index ca6e97c..7f08c4a 100644 --- a/Modules/Platform/AIX-GNU.cmake +++ b/Modules/Platform/AIX-GNU.cmake @@ -19,7 +19,7 @@ string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -Wl,-brtl") macro(__aix_compiler_gnu lang) set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,-blibpath:") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-G,-bnoipath") + string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-G,-bnoipath") set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-bexpall") set(CMAKE_${lang}_USE_IMPLICIT_LINK_DIRECTORIES_IN_RUNTIME_PATH 1) diff --git a/Modules/Platform/CYGWIN-GNU.cmake b/Modules/Platform/CYGWIN-GNU.cmake index d08dc81..784c8c6 100644 --- a/Modules/Platform/CYGWIN-GNU.cmake +++ b/Modules/Platform/CYGWIN-GNU.cmake @@ -40,7 +40,7 @@ macro(__cygwin_compiler_gnu lang) set(CMAKE_EXE_EXPORTS_${lang}_FLAG "-Wl,--export-all-symbols") # TODO: Is -Wl,--enable-auto-import now always default? - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,--enable-auto-import") + string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,--enable-auto-import") set(CMAKE_SHARED_MODULE_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS}") if(NOT CMAKE_RC_COMPILER_INIT) diff --git a/Modules/Platform/HP-UX-GNU.cmake b/Modules/Platform/HP-UX-GNU.cmake index 7ac804b..699c4aa 100644 --- a/Modules/Platform/HP-UX-GNU.cmake +++ b/Modules/Platform/HP-UX-GNU.cmake @@ -9,7 +9,7 @@ endif() set(__HPUX_COMPILER_GNU 1) macro(__hpux_compiler_gnu lang) - set(CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS "${CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS} -Wl,-E,-b,+nodefaultrpath") + string(APPEND CMAKE_SHARED_LIBRARY_CREATE_${lang}_FLAGS " -Wl,-E,-b,+nodefaultrpath") set(CMAKE_SHARED_LIBRARY_LINK_${lang}_FLAGS "-Wl,-E") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG "-Wl,+b") set(CMAKE_SHARED_LIBRARY_RUNTIME_${lang}_FLAG_SEP ":") diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index e4aca6e..cfe6e1c 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -152,9 +152,9 @@ if(WINCE) foreach(lang C CXX) if(_MSVC_${lang}_ARCHITECTURE_FAMILY STREQUAL "ARM") - set(_PLATFORM_DEFINES_${lang} "${_PLATFORM_DEFINES_${lang}} /D${MSVC_${lang}_ARCHITECTURE_ID}") + string(APPEND _PLATFORM_DEFINES_${lang} " /D${MSVC_${lang}_ARCHITECTURE_ID}") if(MSVC_${lang}_ARCHITECTURE_ID MATCHES "^ARMV([45])I$") - set(_FLAGS_${lang} "${_FLAGS_${lang}} /QRarch${CMAKE_MATCH_1}T") + string(APPEND _FLAGS_${lang} " /QRarch${CMAKE_MATCH_1}T") endif() endif() endforeach() diff --git a/Modules/UseJava.cmake b/Modules/UseJava.cmake index 8ae3720..1182875 100644 --- a/Modules/UseJava.cmake +++ b/Modules/UseJava.cmake @@ -417,7 +417,7 @@ endfunction () function(__java_lcat VAR) foreach(_line ${ARGN}) - set(${VAR} "${${VAR}}${_line}\n") + string(APPEND ${VAR} "${_line}\n") endforeach() set(${VAR} "${${VAR}}" PARENT_SCOPE) diff --git a/Modules/WriteCompilerDetectionHeader.cmake b/Modules/WriteCompilerDetectionHeader.cmake index 362099e..e7f9912 100644 --- a/Modules/WriteCompilerDetectionHeader.cmake +++ b/Modules/WriteCompilerDetectionHeader.cmake @@ -447,7 +447,7 @@ function(write_compiler_detection_header endif() if(NOT _WCD_ALLOW_UNKNOWN_COMPILER_VERSIONS) - set(${compiler_file_content} "${${compiler_file_content}} + string(APPEND ${compiler_file_content} " # if !(${_cmake_oldestSupported_${compiler}}) # error Unsupported compiler version # endif\n") @@ -462,7 +462,7 @@ function(write_compiler_detection_header set(MACRO_HEX) endif() string(CONFIGURE "${_compiler_id_version_compute_${compiler}}" VERSION_BLOCK @ONLY) - set(${compiler_file_content} "${${compiler_file_content}}${VERSION_BLOCK}\n") + string(APPEND ${compiler_file_content} "${VERSION_BLOCK}\n") set(PREFIX) set(MACRO_DEC) set(MACRO_HEX) @@ -478,7 +478,7 @@ function(write_compiler_detection_header set(_define_item "\n# define ${prefix_arg}_${feature_PP} 0\n") set(_define_item "\n# if ${_cmake_feature_test_${compiler}_${feature}}\n# define ${prefix_arg}_${feature_PP} 1\n# else${_define_item}# endif\n") endif() - set(${compiler_file_content} "${${compiler_file_content}}${_define_item}") + string(APPEND ${compiler_file_content} "${_define_item}") endforeach() endforeach() if(pp_if STREQUAL "elif") |