fb1b20eab3
CMakeLists.txt and .cmake files of significant size (more than 2 lines according to our check in tst_license.pl) now have the copyright and license header. Existing copyright statements remain intact Task-number: QTBUG-88621 Change-Id: I3b98cdc55ead806ec81ce09af9271f9b95af97fa Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
26 lines
1017 B
CMake
26 lines
1017 B
CMake
# Copyright (C) 2022 The Qt Company Ltd.
|
|
# SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0
|
|
|
|
# The test represents the order-related issue that we have with the ld linker.
|
|
#
|
|
# CMake versions < 3.21.0 produce the following linker line:
|
|
# <binary_name> main.cpp -o static_link_order_test libstaticLib.a objlib.cpp.o
|
|
# Since 'static_link_order_test' doesn't have direct use of 'staticlib2.cpp.o' symbols
|
|
# the translation unit is not linked. When we link objlib.cpp.o it cannot resolve symbols from
|
|
# staticlib2.cpp.o.
|
|
#
|
|
# For now it's only applicable for ld-like linkers. 'lld' has no such issue.
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
project(static_link_order_test LANGUAGES CXX)
|
|
|
|
add_library(objLib OBJECT objlib.cpp)
|
|
add_library(staticLib STATIC staticlib1.cpp staticlib2.cpp)
|
|
|
|
target_link_libraries(staticLib
|
|
INTERFACE objLib "$<TARGET_OBJECTS:objLib>"
|
|
)
|
|
|
|
add_executable(static_link_order_test main.cpp)
|
|
target_link_libraries(static_link_order_test PRIVATE staticLib)
|