mirror of
https://gitee.com/openharmony/third_party_spirv-tools
synced 2024-11-23 15:30:36 +00:00
Fix CMake for librt (#4773)
In the installed file /usr/lib64/cmake/SPIRV-Tools/SPIRV-ToolsTarget.cmake, occurences of librt in the INTERFACE_LINK_LIBRARIES property are incorrect. The property contains the absolute path to librt. In most situations, this produces no problem. But when building in a sysroot, which is commonly done when cross-compiling, the absolute path breaks dependent projects. For example, when building spirv-tools using the Chrome OS SDK, and targeting the board 'volteer', where the build sysroot is '/build/volteer', the file includes this line INTERFACE_LINK_LIBRARIES "/build/volteer/usr/lib64/librt.so" when it should instead say INTERFACE_LINK_LIBRARIES "rt" The CMake documentation agrees [1]: Note that it is not advisable to populate the INTERFACE_LINK_LIBRARIES of a target with absolute paths to dependencies. That would hard-code into installed packages the library file paths for dependencies as found on the machine the package was made on. [1] https://cmake.org/cmake/help/latest/prop_tgt/INTERFACE_LINK_LIBRARIES.html
This commit is contained in:
parent
898ba64d24
commit
cb96abbf7a
@ -407,7 +407,7 @@ if("${CMAKE_SYSTEM_NAME}" STREQUAL "Linux")
|
||||
find_library(LIBRT rt)
|
||||
if(LIBRT)
|
||||
foreach(target ${SPIRV_TOOLS_TARGETS})
|
||||
target_link_libraries(${target} ${LIBRT})
|
||||
target_link_libraries(${target} rt)
|
||||
endforeach()
|
||||
endif()
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user