Skip to content

Commit 5916836

Browse files
ilya-fedinjohn-preston
authored andcommitted
Use X11 via pkg-config
This ensures the right link order with static link
1 parent 232ec41 commit 5916836

File tree

1 file changed

+4
-24
lines changed

1 file changed

+4
-24
lines changed

cmake/external.cmake

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -230,30 +230,10 @@ endfunction()
230230
# x11
231231
function(link_x11 target_name)
232232
if (TG_OWT_PACKAGED_BUILD)
233-
find_package(X11 REQUIRED COMPONENTS Xcomposite Xdamage Xext Xfixes Xrender Xrandr Xtst)
234-
target_include_directories(${target_name} SYSTEM
235-
PRIVATE
236-
${X11_X11_INCLUDE_PATH}
237-
${X11_Xlib_INCLUDE_PATH}
238-
${X11_Xcomposite_INCLUDE_PATH}
239-
${X11_Xdamage_INCLUDE_PATH}
240-
${X11_Xext_INCLUDE_PATH}
241-
${X11_Xfixes_INCLUDE_PATH}
242-
${X11_Xrender_INCLUDE_PATH}
243-
${X11_Xrandr_INCLUDE_PATH}
244-
${X11_Xtst_INCLUDE_PATH}
245-
)
246-
target_link_libraries(${target_name}
247-
PRIVATE
248-
${X11_X11_LIB}
249-
${X11_Xcomposite_LIB}
250-
${X11_Xdamage_LIB}
251-
${X11_Xext_LIB}
252-
${X11_Xfixes_LIB}
253-
${X11_Xrender_LIB}
254-
${X11_Xrandr_LIB}
255-
${X11_Xtst_LIB}
256-
)
233+
find_package(PkgConfig REQUIRED)
234+
pkg_check_modules(X11 REQUIRED x11 xcomposite xdamage xext xfixes xrandr xrender xtst)
235+
target_include_directories(${target_name} SYSTEM PRIVATE ${X11_INCLUDE_DIRS})
236+
target_link_libraries(${target_name} PRIVATE ${X11_LINK_LIBRARIES})
257237
endif()
258238
endfunction()
259239

0 commit comments

Comments
 (0)