aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--cmake/QtDeclarativeSetup.cmake28
-rw-r--r--src/qml/CMakeLists.txt16
-rw-r--r--src/qml/jsruntime/qv4executablecompilationunit.cpp4
3 files changed, 23 insertions, 25 deletions
diff --git a/cmake/QtDeclarativeSetup.cmake b/cmake/QtDeclarativeSetup.cmake
index cd5ae32e14..5f7de2c2ee 100644
--- a/cmake/QtDeclarativeSetup.cmake
+++ b/cmake/QtDeclarativeSetup.cmake
@@ -4,18 +4,32 @@ function(qt_declarative_write_tag_header target_name)
set(tag_contents "")
if(EXISTS "${tag_file}")
file(READ "${tag_file}" tag_contents)
+ string(STRIP "${tag_contents}" tag_contents)
endif()
- if(NOT tag_file STREQUAL "$Format:%H$")
+ if(NOT tag_contents STREQUAL "$Format:%H$")
set(QML_COMPILE_HASH "${tag_contents}")
- string(STRIP "${QML_COMPILE_HASH}" QML_COMPILE_HASH)
elseif(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/../../.git")
- execute_process(
- COMMAND git rev-parse HEAD
- OUTPUT_VARIABLE QML_COMPILE_HASH
- OUTPUT_STRIP_TRAILING_WHITESPACE)
+ find_program(git_path git)
+ if(git_path)
+ execute_process(
+ COMMAND ${git_path} rev-parse HEAD
+ OUTPUT_VARIABLE QML_COMPILE_HASH
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
+ else()
+ message(FATAL_ERROR "Cannot find a 'git' binary to retrieve QML compile hash in PATH!")
+ endif()
+ else()
+ message(FATAL_ERROR "Cannot find a source for the QML compile hash! "
+ "You need either a valid git repository or a non-empty .tag file.")
endif()
string(LENGTH "${QML_COMPILE_HASH}" QML_COMPILE_HASH_LENGTH)
- configure_file("qml_compile_hash_p.h.in" "${CMAKE_CURRENT_BINARY_DIR}/qml_compile_hash_p.h")
+ if(QML_COMPILE_HASH_LENGTH GREATER 0)
+ configure_file("qml_compile_hash_p.h.in" "${CMAKE_CURRENT_BINARY_DIR}/qml_compile_hash_p.h")
+ else()
+ message(FATAL_ERROR "QML compile hash is empty! "
+ "You need either a valid git repository or a non-empty .tag file.")
+ endif()
endfunction()
find_package(PythonInterp REQUIRED)
diff --git a/src/qml/CMakeLists.txt b/src/qml/CMakeLists.txt
index 046e29fdcd..4d460286ff 100644
--- a/src/qml/CMakeLists.txt
+++ b/src/qml/CMakeLists.txt
@@ -509,22 +509,6 @@ qt_internal_extend_target(Qml CONDITION QT_FEATURE_qml_animation
animations
)
-#### Keys ignored in scope 18:.:common:common/common.pri:NOT build_pass:
-# compile_hash_contents = "// Generated file, DO NOT EDIT" "$${LITERAL_HASH}define QML_COMPILE_HASH "$$QML_COMPILE_HASH"" "$${LITERAL_HASH}define QML_COMPILE_HASH_LENGTH $$str_size($$QML_COMPILE_HASH)"
-# tag = <EMPTY>
-# tagFile = "$$PWD/../../.tag"
-
-#### Keys ignored in scope 19:.:common:common/common.pri:EXISTS _ss_tagFile:
-# QMAKE_INTERNAL_INCLUDED_FILES = "$$tagFile"
-# tag = "$$cat($$tagFile, singleline)"
-
-#### Keys ignored in scope 20:.:common:common/common.pri:NOT tag___equals____ss_{LITERAL_DOLLAR}Format AND %H_ss_{LITERAL_DOLLAR}:
-# QML_COMPILE_HASH = "$$tag"
-
-#### Keys ignored in scope 22:.:common:common/common.pri:EXISTS _ss_PWD/../../.git:
-# QML_COMPILE_HASH = "$$commit"
-# commit = "$$system(git rev-parse HEAD)"
-
qt_internal_extend_target(Qml CONDITION GCC AND QT_COMPILER_VERSION_MAJOR STREQUAL 5
COMPILE_OPTIONS
-fno-strict-aliasing
diff --git a/src/qml/jsruntime/qv4executablecompilationunit.cpp b/src/qml/jsruntime/qv4executablecompilationunit.cpp
index a8f8061528..f1253aa6f8 100644
--- a/src/qml/jsruntime/qv4executablecompilationunit.cpp
+++ b/src/qml/jsruntime/qv4executablecompilationunit.cpp
@@ -69,7 +69,7 @@
#include <QtCore/qcryptographichash.h>
#include <QtCore/QScopedValueRollback>
-#if defined(QML_COMPILE_HASH)
+#if defined(QML_COMPILE_HASH) && defined(QML_COMPILE_HASH_LENGTH) && QML_COMPILE_HASH_LENGTH > 0
# ifdef Q_OS_LINUX
// Place on a separate section on Linux so it's easier to check from outside
// what the hash version is.
@@ -940,7 +940,7 @@ bool ExecutableCompilationUnit::verifyHeader(
}
}
-#if defined(QML_COMPILE_HASH)
+#if defined(QML_COMPILE_HASH) && defined(QML_COMPILE_HASH_LENGTH) && QML_COMPILE_HASH_LENGTH > 0
if (qstrcmp(qml_compile_hash, unit->libraryVersionHash) != 0) {
*errorString = QStringLiteral("QML library version mismatch. Expected compile hash does not match");
return false;