diff --git a/CMakeLists.txt b/CMakeLists.txt index d17ede50a..c2daf8273 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -132,11 +132,6 @@ endif() include(TdSetUpCompiler) td_set_up_compiler() -find_package(Atomics REQUIRED) -if (ATOMICS_LIBRARIES) - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${ATOMICS_LIBRARIES}") -endif() - if (MSVC) option(TD_ENABLE_MULTI_PROCESSOR_COMPILATION "Use \"ON\" to enable multi-processor compilation.") diff --git a/tdutils/CMakeLists.txt b/tdutils/CMakeLists.txt index 790db368e..1240682fc 100644 --- a/tdutils/CMakeLists.txt +++ b/tdutils/CMakeLists.txt @@ -403,6 +403,11 @@ if (ANDROID) target_link_libraries(tdutils PRIVATE log) endif() +find_package(Atomics REQUIRED) +if (ATOMICS_LIBRARIES) + target_link_libraries(tdutils PUBLIC "${ATOMICS_LIBRARIES}") +endif() + install(TARGETS tdutils EXPORT TdStaticTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"