Skip to content

cmake: CMAKE_SOURCE_DIR -> PROJECT_SOURCE_DIR #1121

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

Merged
merged 3 commits into from
Jul 14, 2023
Merged

Conversation

Tindarid
Copy link
Contributor

Fixes compiling as dependency with FetchContent

Fixes compiling as dependency with FetchContent
@vszakats

This comment was marked as outdated.

vszakats

This comment was marked as outdated.

@vszakats vszakats merged commit 0f396aa into libssh2:master Jul 14, 2023
@vszakats
Copy link
Member

Thanks @Tindarid! Merged now, with the extra two replacement in tests/CMakeLists.txt.

lampmanyao pushed a commit to lampmanyao/libssh2 that referenced this pull request Sep 3, 2023
Fixes compiling as dependency with FetchContent

Co-authored-by: Viktor Szakats
agreppin pushed a commit to agreppin/libssh2 that referenced this pull request Jul 14, 2024
Fixes compiling as dependency with FetchContent

Co-authored-by: Viktor Szakats
vszakats added a commit to vszakats/curl that referenced this pull request Oct 22, 2024
It's counterintuitive but `PROJECT_*_DIR` seems to be the preferred
variable to retrieve curl's root directory.

In libssh2 this was done for this reason:
"Fixes compiling as dependency with FetchContent"
libssh2/libssh2#1121

curl already used `PROJECT_*_DIR` everywhere, except one place.

Previous change:
curl@72646c2 curl#488 curl#498

That previous fix didn't address the remaining CMAKE_BINARY_DIR inside
the macro. Probably because the actual directory isn't relevant, just
a mandatory argument of `try_compile()`. Newer CMake version allow for
an improved argument list, where `BINARY_DIR` argument is optional.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants