summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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()
#=============================================================================