diff options
author | Brad King <brad.king@kitware.com> | 2017-04-27 13:05:00 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-04-27 13:05:03 (GMT) |
commit | f0ae821681a0a0b4f411a0feb4a6f6e458475999 (patch) | |
tree | 964d0aee92a535757626683b381d5226381ce49f /Modules | |
parent | 6887c1174f6a16d6d51189954cb3b0dbf49a971f (diff) | |
parent | 993ebdc72d5e7303008ecc2fc42b151b630a9ca2 (diff) | |
download | CMake-f0ae821681a0a0b4f411a0feb4a6f6e458475999.zip CMake-f0ae821681a0a0b4f411a0feb4a6f6e458475999.tar.gz CMake-f0ae821681a0a0b4f411a0feb4a6f6e458475999.tar.bz2 |
Merge topic 'cpackifw-framework-version'
993ebdc7 CPackIFW: Framework version
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !761
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CPackIFW.cmake | 63 |
1 files changed, 50 insertions, 13 deletions
diff --git a/Modules/CPackIFW.cmake b/Modules/CPackIFW.cmake index 099dd1c..b4a6dc6 100644 --- a/Modules/CPackIFW.cmake +++ b/Modules/CPackIFW.cmake @@ -717,21 +717,58 @@ set(CPackIFW_CMake_INCLUDED 1) # Framework version #============================================================================= -if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND CPACK_IFW_DEVTOOL_EXECUTABLE) - execute_process(COMMAND - "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}" --framework-version - OUTPUT_VARIABLE CPACK_IFW_FRAMEWORK_VERSION) - if(CPACK_IFW_FRAMEWORK_VERSION) - string(REPLACE " " "" - CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}") - string(REPLACE "\t" "" - CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}") - string(REPLACE "\n" "" - CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION}") - if(CPACK_IFW_VERBOSE) - message(STATUS "Found QtIFW ${CPACK_IFW_FRAMEWORK_VERSION} version") +set(CPACK_IFW_FRAMEWORK_VERSION_FORCED "" + CACHE STRING "The forced version of used QtIFW tools") +mark_as_advanced(CPACK_IFW_FRAMEWORK_VERSION_FORCED) +set(CPACK_IFW_FRAMEWORK_VERSION_TIMEOUT 1 + CACHE STRING "The timeout to return QtIFW framework version string from \"installerbase\" executable") +mark_as_advanced(CPACK_IFW_FRAMEWORK_VERSION_TIMEOUT) +if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND NOT CPACK_IFW_FRAMEWORK_VERSION_FORCED) + set(CPACK_IFW_FRAMEWORK_VERSION) + # Invoke version from "installerbase" executable + foreach(_ifw_version_argument --framework-version --version) + if(NOT CPACK_IFW_FRAMEWORK_VERSION) + execute_process(COMMAND + "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}" ${_ifw_version_argument} + TIMEOUT ${CPACK_IFW_FRAMEWORK_VERSION_TIMEOUT} + RESULT_VARIABLE CPACK_IFW_FRAMEWORK_VERSION_RESULT + OUTPUT_VARIABLE CPACK_IFW_FRAMEWORK_VERSION_OUTPUT + OUTPUT_STRIP_TRAILING_WHITESPACE + ENCODING UTF8) + if(NOT CPACK_IFW_FRAMEWORK_VERSION_RESULT AND CPACK_IFW_FRAMEWORK_VERSION_OUTPUT) + string(REGEX MATCH "[0-9]+(\\.[0-9]+)*" + CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_FRAMEWORK_VERSION_OUTPUT}") + if(CPACK_IFW_FRAMEWORK_VERSION) + if("${_ifw_version_argument}" STREQUAL "--framework-version") + set(CPACK_IFW_FRAMEWORK_VERSION_SOURCE "INSTALLERBASE_FRAMEWORK_VERSION") + elseif("${_ifw_version_argument}" STREQUAL "--version") + set(CPACK_IFW_FRAMEWORK_VERSION_SOURCE "INSTALLERBASE_FRAMEWORK_VERSION") + endif() + endif() + endif() + endif() + endforeach() + # Finaly try to get version from executable path + if(NOT CPACK_IFW_FRAMEWORK_VERSION) + string(REGEX MATCH "[0-9]+(\\.[0-9]+)*" + CPACK_IFW_FRAMEWORK_VERSION "${CPACK_IFW_INSTALLERBASE_EXECUTABLE}") + if(CPACK_IFW_FRAMEWORK_VERSION) + set(CPACK_IFW_FRAMEWORK_VERSION_SOURCE "INSTALLERBASE_PATH") endif() endif() +elseif(CPACK_IFW_FRAMEWORK_VERSION_FORCED) + set(CPACK_IFW_FRAMEWORK_VERSION ${CPACK_IFW_FRAMEWORK_VERSION_FORCED}) + set(CPACK_IFW_FRAMEWORK_VERSION_SOURCE "FORCED") +endif() +if(CPACK_IFW_VERBOSE) + if(CPACK_IFW_FRAMEWORK_VERSION AND CPACK_IFW_FRAMEWORK_VERSION_FORCED) + message(STATUS "Found QtIFW ${CPACK_IFW_FRAMEWORK_VERSION} (forced) version") + elseif(CPACK_IFW_FRAMEWORK_VERSION) + message(STATUS "Found QtIFW ${CPACK_IFW_FRAMEWORK_VERSION} version") + endif() +endif() +if(CPACK_IFW_INSTALLERBASE_EXECUTABLE AND NOT CPACK_IFW_FRAMEWORK_VERSION) + message(WARNING "Could not detect QtIFW tools version. Set used version to variable \"CPACK_IFW_FRAMEWORK_VERSION_FORCED\" manualy.") endif() #============================================================================= |