Skip to content

Commit 86bf0a6

Browse files
committed
Reduce unnecessary linking.
Signed-off-by: Ryan Pavlik <[email protected]>
1 parent 983b59f commit 86bf0a6

File tree

2 files changed

+17
-5
lines changed

2 files changed

+17
-5
lines changed

src/tests/list/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ endif()
4040

4141
if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
4242
target_compile_options(runtime_list PRIVATE -Wall)
43-
target_link_libraries(runtime_list openxr_loader m pthread GL ${XLIB_LIBRARIES} ${XCB_LIBRARIES} ${WAYLAND_LIBRARIES})
43+
target_link_libraries(runtime_list openxr_loader pthread)
4444
endif()
4545

4646
set_target_properties(runtime_list PROPERTIES FOLDER ${TESTS_FOLDER})

src/tests/loader_test/CMakeLists.txt

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ add_executable(loader_test
2020
loader_test.cpp
2121
${PROJECT_SOURCE_DIR}/src/common/gfxwrapper_opengl.c
2222
${PROJECT_SOURCE_DIR}/src/common/filesystem_utils.cpp
23-
${WAYLAND_PROTOCOL_SRC}
2423
)
2524
set_target_properties(loader_test PROPERTIES FOLDER ${TESTS_FOLDER})
2625

@@ -45,10 +44,23 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
4544
target_compile_options(loader_test PRIVATE /Zc:wchar_t /Zc:forScope /W4 /WX)
4645
target_link_libraries(loader_test openxr_loader opengl32 d3d11)
4746
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
48-
target_compile_options(loader_test PRIVATE -Wall -Wno-unused-function -Wno-format-truncation)
49-
target_link_libraries(loader_test -lstdc++fs openxr_loader m -lpthread GL ${XLIB_LIBRARIES} ${XCB_LIBRARIES} ${WAYLAND_LIBRARIES})
47+
target_compile_options(
48+
loader_test PRIVATE -Wall -Wno-unused-function -Wno-format-truncation
49+
)
50+
51+
if(PRESENTATION_BACKEND MATCHES "xlib")
52+
target_link_libraries(
53+
loader_test ${X11_Xxf86vm_LIB} ${X11_Xrandr_LIB} ${X11_LIBRARIES}
54+
)
55+
elseif(PRESENTATION_BACKEND MATCHES "xcb")
56+
target_link_libraries(loader_test ${XCB_LIBRARIES})
57+
elseif(PRESENTATION_BACKEND MATCHES "wayland")
58+
target_link_libraries(loader_test ${WAYLAND_LIBRARIES})
59+
target_sources(loader_test PRIVATE ${WAYLAND_PROTOCOL_SRC})
60+
endif()
61+
target_link_libraries(loader_test -lstdc++fs openxr_loader m -lpthread GL)
5062
else()
51-
MESSAGE(FATAL_ERROR "Unsupported Platform")
63+
message(FATAL_ERROR "Unsupported Platform")
5264
endif()
5365

5466
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/resources)

0 commit comments

Comments
 (0)