Hardcode atomic_LIB as -latomic

find_library does not always work because libatomic.so may be in a path
like /usr/lib/gcc/x86_64-linux-gnu/11/libatomic.so, which CMake does not
consider by default.

Pick-to: 6.3
Change-Id: I73a657c470efa4f84f8629bd531edfcac3b3a352
Reviewed-by: Alexey Edelev <alexey.edelev@qt.io>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
Dmitry Shachnev 2022-05-07 20:51:25 +03:00
parent 0c0a784c6f
commit e2a8b0adbd

View File

@ -33,7 +33,7 @@ int main(int, char **)
check_cxx_source_compiles("${atomic_test_sources}" HAVE_STDATOMIC)
if(NOT HAVE_STDATOMIC)
set(_req_libraries "${CMAKE_REQUIRED_LIBRARIES}")
find_library(atomic_LIB atomic REQUIRED)
set(atomic_LIB "-latomic")
set(CMAKE_REQUIRED_LIBRARIES ${atomic_LIB})
check_cxx_source_compiles("${atomic_test_sources}" HAVE_STDATOMIC_WITH_LIB)
set(CMAKE_REQUIRED_LIBRARIES "${_req_libraries}")