1
0
Fork 0

Use Threads in packaged mode as more universal approach

This commit is contained in:
Ilya Fedin 2022-01-21 15:09:41 +04:00 committed by John Preston
parent 8e0b1aa26c
commit ab4553e6ee

View file

@ -29,7 +29,6 @@ INTERFACE
target_link_options(common_options target_link_options(common_options
INTERFACE INTERFACE
-Wl,--as-needed -Wl,--as-needed
-pthread
) )
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
@ -92,7 +91,14 @@ if (DESKTOP_APP_USE_ALLOCATION_TRACER)
) )
endif() endif()
if (NOT DESKTOP_APP_USE_PACKAGED) if (DESKTOP_APP_USE_PACKAGED)
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)
target_link_libraries(common_options
INTERFACE
Threads::Threads
)
else()
if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU") if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_link_options(common_options target_link_options(common_options
INTERFACE INTERFACE
@ -112,6 +118,7 @@ if (NOT DESKTOP_APP_USE_PACKAGED)
endif() endif()
target_link_options(common_options target_link_options(common_options
INTERFACE INTERFACE
-pthread
-rdynamic -rdynamic
-fwhole-program -fwhole-program
-Wl,-z,relro -Wl,-z,relro