Sitelet https://web.archive.org/web/20230317140527/https://github.com/facebook/zstd/issues/2377
Skip to content
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

Support using zstd as cmake subdirectory - proper include directory #2377

Open
mateuszzz88 opened this issue Oct 29, 2020 · 1 comment
Open

Comments

@mateuszzz88
Copy link

Is your feature request related to a problem? Please describe.
I use zstd as git submodule and cmake subdirectory. This introduces necessary cmake target libzstd_static. This target does not provide include directory. I need to do workaround:

add_subdirectory(zstd-submodule/build/cmake)
target_include_directories(libzstd_static PUBLIC zstd-submodule/lib/)  # this shouldn't be necessary

Describe the solution you'd like
Add following last line (or equivalent):

if (ZSTD_BUILD_STATIC)
    add_library(libzstd_static STATIC ${Sources} ${Headers})
    list(APPEND library_targets libzstd_static)
    target_include_directories(libzstd_static PUBLIC ../../../lib)

Ditto for shared

Bonus points for moving all includes to lib/includes/zstd and adding lib/includes as include directory. Then I would include as #include <zstd/zstd.h> as I do with most libraries that don't want to interfere with one another or don't pretend to be provided by system. As it is now, different library behaving just like zstd can have it's own common/cpu.h. If I use both libraries, includes will interfere. That is why it should be differentiated by #include<zstd/... and used inside zstd as well.
I realize this is quite big bonus, because first part is 2 lines change, bonus is basicly redoing #2103 again.

@senhuang42
Copy link
Contributor

Hi @mateuszzz88 - we'd be happy to accept a PR that fixes this issue!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants