facebook/zstd
GitHub で見るBuilding libzstd as part of larger cmake project using add_directory(zstd/build/cmake) does not work
Open
#3,758 opened on 2023年9月15日
buildhelp wanted
説明
Describe the bug The cmake file under build/cmake/ is missing these under static and shared library creation which prevent the inclusion libzstd_static or libzstd_shared targets into another project that uses libzstd. By adding these lines (marked with +):
if (ZSTD_BUILD_STATIC)
add_library(libzstd_static STATIC ${Sources} ${Headers})
+ target_include_directories(libzstd_static
+ PUBLIC $<BUILD_INTERFACE:${LIBRARY_DIR}>
+ INTERFACE $<BUILD_INTERFACE:${LIBRARY_DIR}/common>
)
the project using libzstd_static can find header files when the new project linked with zstdlib using in target_link_libraries(${TEST_APP} PRIVATE libzstd_static)
Same fix is also required for ZSTD_BUILD_SHARED. Without this fix, during the build, the project depending on libzstd will not compile because it cannot find libzstd headers.
Found out when cross compiling mcap library for custom linux and mcap is using zstdlib 1.4.7 and cmake 3.22.1 in Ubuntu 22.04