summaryrefslogtreecommitdiffstats
path: root/cmake
diff options
context:
space:
mode:
authorAlexandru Croitor <alexandru.croitor@qt.io>2021-12-16 13:25:43 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-01-20 10:39:12 +0000
commit2fbc66500f308a38977f4b0e6ef59f54e2bdd795 (patch)
treed777b2f660e1389ce632a542d12cac9590b4cc36 /cmake
parent37eefbacb81d26263f2f5602ac0cfd60b1e35e37 (diff)
CMake: Fix qt_run_linker_version_script_support to use active linker
The version script compile test did not use the linker that the build system determined to use to link Qt, but rather the system linker. Run qt_run_linker_version_script_support only after the global qtbase features have been evaluated and make sure to include the active linker flags. Change-Id: I0ff82406828daaf0dc5ec25a55f53ac7d98e3347 Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Alexey Edelev <alexey.edelev@qt.io> (cherry picked from commit 9198a9b8cc8df04ad130410a9c9f32de2b7b2335) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'cmake')
-rw-r--r--cmake/QtBaseConfigureTests.cmake8
-rw-r--r--cmake/QtBaseGlobalTargets.cmake5
2 files changed, 12 insertions, 1 deletions
diff --git a/cmake/QtBaseConfigureTests.cmake b/cmake/QtBaseConfigureTests.cmake
index ae16e8e53b..618554e16c 100644
--- a/cmake/QtBaseConfigureTests.cmake
+++ b/cmake/QtBaseConfigureTests.cmake
@@ -118,6 +118,13 @@ VERS_1;
set(CMAKE_REQUIRED_FLAGS "")
endif()
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS} "-Wl,--version-script=\"${CMAKE_CURRENT_BINARY_DIR}/version_flag.map\"")
+
+ # Pass the linker that the main project uses to the version script compile test.
+ qt_internal_get_active_linker_flags(linker_flags)
+ if(linker_flags)
+ set(CMAKE_REQUIRED_LINK_OPTIONS ${linker_flags})
+ endif()
+
check_cxx_source_compiles("int main(void){return 0;}" HAVE_LD_VERSION_SCRIPT)
if(DEFINED CMAKE_REQUIRED_FLAGS_SAVE)
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
@@ -164,7 +171,6 @@ endfunction()
function(qt_run_qtbase_config_tests)
qt_run_config_test_architecture()
- qt_run_linker_version_script_support()
qt_internal_ensure_latest_win_nt_api()
endfunction()
diff --git a/cmake/QtBaseGlobalTargets.cmake b/cmake/QtBaseGlobalTargets.cmake
index bddc597bdb..cf67442516 100644
--- a/cmake/QtBaseGlobalTargets.cmake
+++ b/cmake/QtBaseGlobalTargets.cmake
@@ -107,6 +107,11 @@ endif()
qt_feature_module_end(GlobalConfig OUT_VAR_PREFIX "__GlobalConfig_")
+# The version script support check has to happen after we determined which linker is going
+# to be used. The linker decision happens in the qtbase/configure.cmake file that is processed
+# above.
+qt_run_linker_version_script_support()
+
qt_generate_global_config_pri_file()
qt_generate_global_module_pri_file()
qt_generate_global_device_pri_file()