summaryrefslogtreecommitdiffstats
path: root/Modules/CPackIFW.cmake
diff options
context:
space:
mode:
authorKonstantin Podsvirov <konstantin@podsvirov.pro>2017-04-22 00:20:43 (GMT)
committerKonstantin Podsvirov <konstantin@podsvirov.pro>2017-04-25 18:43:21 (GMT)
commit993ebdc72d5e7303008ecc2fc42b151b630a9ca2 (patch)
tree17460070befe04fbb34a596b39141566720745fb /Modules/CPackIFW.cmake
parent3cb7048b521395fdc863dacacb85c6f7f28a1bc7 (diff)
downloadCMake-993ebdc72d5e7303008ecc2fc42b151b630a9ca2.zip
CMake-993ebdc72d5e7303008ecc2fc42b151b630a9ca2.tar.gz
CMake-993ebdc72d5e7303008ecc2fc42b151b630a9ca2.tar.bz2
CPackIFW: Framework version
Improved algorithm for finding the version of QtIFW tools.
Diffstat (limited to 'Modules/CPackIFW.cmake')
-rw-r--r--Modules/CPackIFW.cmake63
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()
#=============================================================================