diff options
Diffstat (limited to 'Modules/Internal')
-rw-r--r-- | Modules/Internal/CPack/CPackDeb.cmake | 30 | ||||
-rw-r--r-- | Modules/Internal/CPack/CPackRPM.cmake | 6 | ||||
-rw-r--r-- | Modules/Internal/CheckSourceCompiles.cmake | 6 | ||||
-rw-r--r-- | Modules/Internal/CheckSourceRuns.cmake | 6 | ||||
-rw-r--r-- | Modules/Internal/FeatureTesting.cmake | 9 |
5 files changed, 27 insertions, 30 deletions
diff --git a/Modules/Internal/CPack/CPackDeb.cmake b/Modules/Internal/CPack/CPackDeb.cmake index 958a6db..38e32c2 100644 --- a/Modules/Internal/CPack/CPackDeb.cmake +++ b/Modules/Internal/CPack/CPackDeb.cmake @@ -37,8 +37,8 @@ endfunction() #extract library name and version for given shared object function(extract_so_info shared_object libname version) - if(READELF_EXECUTABLE) - execute_process(COMMAND "${READELF_EXECUTABLE}" -d "${shared_object}" + if(CPACK_READELF_EXECUTABLE) + execute_process(COMMAND "${CPACK_READELF_EXECUTABLE}" -d "${shared_object}" WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" RESULT_VARIABLE result OUTPUT_VARIABLE output @@ -197,15 +197,15 @@ function(cpack_deb_prepare_package_vars) endforeach() endif() - find_program(READELF_EXECUTABLE NAMES readelf) + find_program(CPACK_READELF_EXECUTABLE NAMES readelf) if(CPACK_DEBIAN_DEBUGINFO_PACKAGE AND CPACK_DEB_UNSTRIPPED_FILES) - find_program(OBJCOPY_EXECUTABLE NAMES objcopy) + find_program(CPACK_OBJCOPY_EXECUTABLE NAMES objcopy) - if(NOT OBJCOPY_EXECUTABLE) + if(NOT CPACK_OBJCOPY_EXECUTABLE) message(FATAL_ERROR "debuginfo packages require the objcopy tool") endif() - if(NOT READELF_EXECUTABLE) + if(NOT CPACK_READELF_EXECUTABLE) message(FATAL_ERROR "debuginfo packages require the readelf tool") endif() @@ -213,7 +213,7 @@ function(cpack_deb_prepare_package_vars) foreach(_FILE IN LISTS CPACK_DEB_UNSTRIPPED_FILES) # Get the file's Build ID - execute_process(COMMAND env LC_ALL=C ${READELF_EXECUTABLE} -n "${_FILE}" + execute_process(COMMAND env LC_ALL=C ${CPACK_READELF_EXECUTABLE} -n "${_FILE}" WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE READELF_OUTPUT RESULT_VARIABLE READELF_RESULT @@ -221,7 +221,7 @@ function(cpack_deb_prepare_package_vars) OUTPUT_STRIP_TRAILING_WHITESPACE ) if(NOT READELF_RESULT EQUAL 0) message(FATAL_ERROR "CPackDeb: readelf: '${READELF_ERROR}';\n" - "executed command: '${READELF_EXECUTABLE} -n ${_FILE}'") + "executed command: '${CPACK_READELF_EXECUTABLE} -n ${_FILE}'") endif() if(READELF_OUTPUT MATCHES "Build ID: ([0-9a-zA-Z][0-9a-zA-Z])([0-9a-zA-Z]*)") set(_BUILD_ID_START ${CMAKE_MATCH_1}) @@ -235,7 +235,7 @@ function(cpack_deb_prepare_package_vars) set(_FILE_DBGSYM ${_DBGSYM_ROOT}/usr/lib/debug/.build-id/${_BUILD_ID_START}/${_BUILD_ID_REMAINING}.debug) get_filename_component(_OUT_DIR "${_FILE_DBGSYM}" DIRECTORY) file(MAKE_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}/${_OUT_DIR}") - execute_process(COMMAND ${OBJCOPY_EXECUTABLE} --only-keep-debug "${_FILE}" "${_FILE_DBGSYM}" + execute_process(COMMAND ${CPACK_OBJCOPY_EXECUTABLE} --only-keep-debug "${_FILE}" "${_FILE_DBGSYM}" WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE OBJCOPY_OUTPUT RESULT_VARIABLE OBJCOPY_RESULT @@ -243,9 +243,9 @@ function(cpack_deb_prepare_package_vars) OUTPUT_STRIP_TRAILING_WHITESPACE ) if(NOT OBJCOPY_RESULT EQUAL 0) message(FATAL_ERROR "CPackDeb: objcopy: '${OBJCOPY_ERROR}';\n" - "executed command: '${OBJCOPY_EXECUTABLE} --only-keep-debug ${_FILE} ${_FILE_DBGSYM}'") + "executed command: '${CPACK_OBJCOPY_EXECUTABLE} --only-keep-debug ${_FILE} ${_FILE_DBGSYM}'") endif() - execute_process(COMMAND ${OBJCOPY_EXECUTABLE} --strip-unneeded ${_FILE} + execute_process(COMMAND ${CPACK_OBJCOPY_EXECUTABLE} --strip-unneeded ${_FILE} WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE OBJCOPY_OUTPUT RESULT_VARIABLE OBJCOPY_RESULT @@ -253,9 +253,9 @@ function(cpack_deb_prepare_package_vars) OUTPUT_STRIP_TRAILING_WHITESPACE ) if(NOT OBJCOPY_RESULT EQUAL 0) message(FATAL_ERROR "CPackDeb: objcopy: '${OBJCOPY_ERROR}';\n" - "executed command: '${OBJCOPY_EXECUTABLE} --strip-debug ${_FILE}'") + "executed command: '${CPACK_OBJCOPY_EXECUTABLE} --strip-debug ${_FILE}'") endif() - execute_process(COMMAND ${OBJCOPY_EXECUTABLE} --add-gnu-debuglink=${_FILE_DBGSYM} ${_FILE} + execute_process(COMMAND ${CPACK_OBJCOPY_EXECUTABLE} --add-gnu-debuglink=${_FILE_DBGSYM} ${_FILE} WORKING_DIRECTORY "${CPACK_TEMPORARY_DIRECTORY}" OUTPUT_VARIABLE OBJCOPY_OUTPUT RESULT_VARIABLE OBJCOPY_RESULT @@ -263,7 +263,7 @@ function(cpack_deb_prepare_package_vars) OUTPUT_STRIP_TRAILING_WHITESPACE ) if(NOT OBJCOPY_RESULT EQUAL 0) message(FATAL_ERROR "CPackDeb: objcopy: '${OBJCOPY_ERROR}';\n" - "executed command: '${OBJCOPY_EXECUTABLE} --add-gnu-debuglink=${_FILE_DBGSYM} ${_FILE}'") + "executed command: '${CPACK_OBJCOPY_EXECUTABLE} --add-gnu-debuglink=${_FILE_DBGSYM} ${_FILE}'") endif() endforeach() endif() @@ -652,7 +652,7 @@ function(cpack_deb_prepare_package_vars) unset(CPACK_DEBIAN_PACKAGE_SHLIBS_LIST) if(CPACK_DEBIAN_PACKAGE_GENERATE_SHLIBS) - if(READELF_EXECUTABLE) + if(CPACK_READELF_EXECUTABLE) foreach(_FILE IN LISTS CPACK_DEB_SHARED_OBJECT_FILES) extract_so_info("${_FILE}" libname soversion) if(libname AND DEFINED soversion) diff --git a/Modules/Internal/CPack/CPackRPM.cmake b/Modules/Internal/CPack/CPackRPM.cmake index cd631b8..7c10280 100644 --- a/Modules/Internal/CPack/CPackRPM.cmake +++ b/Modules/Internal/CPack/CPackRPM.cmake @@ -625,8 +625,8 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR) endif() # With objdump we should check the debug symbols - find_program(OBJDUMP_EXECUTABLE objdump) - if(NOT OBJDUMP_EXECUTABLE) + find_program(CPACK_OBJDUMP_EXECUTABLE objdump) + if(NOT CPACK_OBJDUMP_EXECUTABLE) message(FATAL_ERROR "CPackRPM: objdump binary could not be found!" " Required for debuginfo packaging. See documentation of" " CPACK_RPM_DEBUGINFO_PACKAGE variable for details.") @@ -649,7 +649,7 @@ function(cpack_rpm_debugsymbol_check INSTALL_FILES WORKING_DIR) continue() endif() - execute_process(COMMAND "${OBJDUMP_EXECUTABLE}" -h ${WORKING_DIR}/${F} + execute_process(COMMAND "${CPACK_OBJDUMP_EXECUTABLE}" -h ${WORKING_DIR}/${F} WORKING_DIRECTORY "${CPACK_TOPLEVEL_DIRECTORY}" RESULT_VARIABLE OBJDUMP_EXEC_RESULT OUTPUT_VARIABLE OBJDUMP_OUT diff --git a/Modules/Internal/CheckSourceCompiles.cmake b/Modules/Internal/CheckSourceCompiles.cmake index 27aa3e0..eadf3da 100644 --- a/Modules/Internal/CheckSourceCompiles.cmake +++ b/Modules/Internal/CheckSourceCompiles.cmake @@ -86,15 +86,13 @@ function(CMAKE_CHECK_SOURCE_COMPILES _lang _source _var) else() set(CHECK_${LANG}_SOURCE_COMPILES_ADD_INCLUDES) endif() - file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}" - "${_source}\n") if(NOT CMAKE_REQUIRED_QUIET) message(CHECK_START "Performing Test ${_var}") endif() + string(APPEND _source "\n") try_compile(${_var} - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT} + SOURCE_FROM_VAR "src.${_SRC_EXT}" _source COMPILE_DEFINITIONS -D${_var} ${CMAKE_REQUIRED_DEFINITIONS} ${CHECK_${LANG}_SOURCE_COMPILES_ADD_LINK_OPTIONS} ${CHECK_${LANG}_SOURCE_COMPILES_ADD_LIBRARIES} diff --git a/Modules/Internal/CheckSourceRuns.cmake b/Modules/Internal/CheckSourceRuns.cmake index 75e9896..09c85c5 100644 --- a/Modules/Internal/CheckSourceRuns.cmake +++ b/Modules/Internal/CheckSourceRuns.cmake @@ -85,15 +85,13 @@ function(CMAKE_CHECK_SOURCE_RUNS _lang _source _var) else() set(CHECK_${_lang}_SOURCE_COMPILES_ADD_INCLUDES) endif() - file(WRITE "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT}" - "${_source}\n") if(NOT CMAKE_REQUIRED_QUIET) message(CHECK_START "Performing Test ${_var}") endif() + string(APPEND _source "\n") try_run(${_var}_EXITCODE ${_var}_COMPILED - ${CMAKE_BINARY_DIR} - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.${_SRC_EXT} + SOURCE_FROM_VAR "src.${_SRC_EXT}" _source COMPILE_DEFINITIONS -D${_var} ${CMAKE_REQUIRED_DEFINITIONS} ${CHECK_${_lang}_SOURCE_COMPILES_ADD_LINK_OPTIONS} ${CHECK_${_lang}_SOURCE_COMPILES_ADD_LIBRARIES} diff --git a/Modules/Internal/FeatureTesting.cmake b/Modules/Internal/FeatureTesting.cmake index b6f3c09..5c144ec 100644 --- a/Modules/Internal/FeatureTesting.cmake +++ b/Modules/Internal/FeatureTesting.cmake @@ -4,7 +4,7 @@ macro(_record_compiler_features lang compile_flags feature_list) string(TOLOWER ${lang} lang_lc) file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.bin") - file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" " + set(_content " const char features[] = {\"\\n\"\n") get_property(known_features GLOBAL PROPERTY CMAKE_${lang}_KNOWN_FEATURES) @@ -16,10 +16,11 @@ macro(_record_compiler_features lang compile_flags feature_list) else() set(_feature_condition "#if ${_cmake_feature_test_${feature}}\n\"1\"\n#else\n\"0\"\n#endif\n") endif() - file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" "\"${lang}_FEATURE:\"\n${_feature_condition}\"${feature}\\n\"\n") + string(APPEND _content + "\"${lang}_FEATURE:\"\n${_feature_condition}\"${feature}\\n\"\n") endif() endforeach() - file(APPEND "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" + string(APPEND _content "\n};\n\nint main(int argc, char** argv) { (void)argv; return features[argc]; }\n") if(CMAKE_${lang}_LINK_WITH_STANDARD_COMPILE_OPTION) @@ -31,7 +32,7 @@ macro(_record_compiler_features lang compile_flags feature_list) endif() try_compile(CMAKE_${lang}_FEATURE_TEST - ${CMAKE_BINARY_DIR} "${CMAKE_BINARY_DIR}/CMakeFiles/feature_tests.${lang_lc}" + SOURCE_FROM_VAR "feature_tests.${lang_lc}" _content COMPILE_DEFINITIONS "${compile_flags}" LINK_LIBRARIES "${compile_flags_for_link}" OUTPUT_VARIABLE _output |