-
Notifications
You must be signed in to change notification settings - Fork 863
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake: add missing SPIRV-Tools-opt dependency #3487
Conversation
I'm seeing this issue with both shared and static targets, so the patch is incomplete for this use case. |
Removing |
# Create imported target glslang::SPIRV
add_library(glslang::SPIRV SHARED IMPORTED)
set_target_properties(glslang::SPIRV PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"
)
|
The Typically, a shared library is needed at linking time; an external module which is |
It looks like you are right; however, in this case the Additionally, what happens in this case if SPIRV-Tools-opt is not available at runtime? |
If a shared library is missing at runtime, your program will not start. |
Makes sense... in that case, the Having
which causes CMake to place |
The reason for the public linking is explained here. According to this But after analyzing some repos (like those of KDE) I guess it should be used for all public/private dependencies when building a static library, but only for public dependencies when building a shared library. |
@INSTALL_CONFIG_UNIX@ | ||
include("@PACKAGE_PATH_EXPORT_TARGETS@") | ||
]=]) | ||
|
||
set(PATH_EXPORT_TARGETS "${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME}/glslang-targets.cmake") | ||
if(UNIX OR "${CMAKE_SYSTEM_NAME}" STREQUAL "Fuchsia") | ||
set(INSTALL_CONFIG_UNIX [=[ | ||
include(CMakeFindDependencyMacro) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it safe to remove this line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's not removed, it's moved to the top of the file.
The generated
glslang-targets.cmake
file (for static glslang targets) contains this:The
SPIRV-Tools-opt
here is as CMake target, but also the name of a real library file (libSPIRV-Tools-opt.so
orlibSPIRV-Tools-opt.a
) which will be linked with (missing its dependencySPIRV-Tools
) if the target is nonexistent. Thefind_dependency
will import the target automatically.REQUIRED
is not needed infind_dependency
, otherwisefind_package(glslang)
withoutREQUIRED
will produce a fatal error ifThreads
is not found.