Skip to content

Commit

Permalink
cmake: Fix dependencies of newly-stubbed libraries
Browse files Browse the repository at this point in the history
Some downstream projects may only link to e.g. the glslang::SPIRV
library and rely on transitive dependencies to pull in everything else.
To keep this working, the SPIRV and MachineIndependent library stubs are
now linked against the glslang library.
  • Loading branch information
arcady-lunarg committed Aug 29, 2024
1 parent 5073d93 commit b45d21b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
4 changes: 2 additions & 2 deletions SPIRV/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,11 @@ if(WIN32 AND BUILD_SHARED_LIBS)
endif()

if(ENABLE_OPT)
target_link_libraries(SPIRV PRIVATE MachineIndependent PUBLIC SPIRV-Tools-opt)
target_link_libraries(SPIRV PRIVATE glslang PUBLIC SPIRV-Tools-opt)
target_include_directories(SPIRV PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../External>)
else()
target_link_libraries(SPIRV PRIVATE MachineIndependent)
target_link_libraries(SPIRV PRIVATE glslang)
endif()

if(WIN32)
Expand Down
1 change: 1 addition & 0 deletions glslang/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ endif()
add_library(MachineIndependent STATIC stub.cpp)
set_property(TARGET MachineIndependent PROPERTY POSITION_INDEPENDENT_CODE ON)
set_property(TARGET MachineIndependent PROPERTY FOLDER glslang)
target_link_libraries(MachineIndependent PRIVATE glslang)

if (NOT MSVC)
# -Wunused-but-set-variable is triggered in code generated by bison that we do not control. Turn this warning off, but only for the generated.
Expand Down

0 comments on commit b45d21b

Please sign in to comment.