Don't run version script test when its result won't be used

Task-number: QTBUG-111514
Change-Id: Ibcac8cd591125f173e906e256d08593764a1cf66
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
(cherry picked from commit bc85390dccd08ec99682106b835b97928b61894f)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Alexey Rochev 2023-05-20 22:57:02 +03:00 committed by Qt Cherry-pick Bot
parent 22fbdd9765
commit c31edaaff3

View File

@ -108,6 +108,11 @@ endfunction()
function(qt_run_linker_version_script_support)
# For some reason the linker command line written by the XCode generator, which is
# subsequently executed by xcodebuild, ignores the linker flag, and thus the test
# seemingly succeeds. Explicitly disable the version script test on darwin platforms.
# Also makes no sense with MSVC-style command-line
if(NOT APPLE AND NOT MSVC)
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/version_flag.map" "VERS_1 { global: sym; };
VERS_2 { global: sym; }
VERS_1;
@ -130,15 +135,7 @@ VERS_1;
set(CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS_SAVE})
endif()
file(REMOVE "${CMAKE_CURRENT_BINARY_DIR}/conftest.map")
# For some reason the linker command line written by the XCode generator, which is
# subsequently executed by xcodebuild, ignores the linker flag, and thus the test
# seemingly succeeds. Explicitly disable the version script test on darwin platforms.
if(APPLE)
set(HAVE_LD_VERSION_SCRIPT OFF)
endif()
# Also makes no sense with MSVC-style command-line
if(MSVC)
else()
set(HAVE_LD_VERSION_SCRIPT OFF)
endif()