UI: Update python linkage for older compilers

Move the python linkage after the obs target is defined so that we can
also add linker flags to preserve the unused python linkage. This is
required before GCC 11.
This commit is contained in:
Kurt Kartaltepe 2021-11-13 14:51:12 -08:00 committed by Jim
parent 99a7d19d15
commit 293b7951ed

View File

@ -160,15 +160,6 @@ elseif(UNIX)
Qt5::Gui
Qt5::GuiPrivate)
# python symbols must be in the global symbol table
# so we link the main executable to python if we expect
# obs-scripting python support to be enabled.
# see: https://github.com/obsproject/obs-studio/issues/2222 and https://bugs.python.org/issue36721
if(NOT DISABLE_PYTHON AND PYTHONLIBS_FOUND)
set(obs_PLATFORM_LIBRARIES
${obs_PLATFORM_LIBRARIES}
${PYTHON_LIBRARIES})
endif()
if("${CMAKE_SYSTEM_NAME}" MATCHES "FreeBSD")
list(APPEND obs_PLATFORM_LIBRARIES
@ -489,6 +480,19 @@ if (UNIX AND UNIX_STRUCTURE AND NOT APPLE)
add_subdirectory(xdg-data)
endif()
if (UNIX AND NOT APPLE)
# python symbols must be in the global symbol table
# so we link the main executable to python if we expect
# obs-scripting python support to be enabled.
# see: https://github.com/obsproject/obs-studio/issues/2222 and https://bugs.python.org/issue36721
if(NOT DISABLE_PYTHON AND PYTHONLIBS_FOUND)
target_link_libraries(obs ${PYTHON_LIBRARIES})
set_target_properties(obs PROPERTIES LINK_FLAGS "-Wl,--no-as-needed")
# Use this after cmake 3.13 aka we drop ubuntu 18.04.
# target_link_options(obs PRIVATE "LINKER:-no-as-needed")
endif()
endif()
add_subdirectory(frontend-plugins)
if(WIN32)
add_subdirectory(win-update/updater)