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

cmake: replace CURL_*_DIR with {PROJECT,CMAKE_CURRENT}_*_DIR #15331

Closed
wants to merge 7 commits into from

Conversation

vszakats
Copy link
Member

@vszakats vszakats commented Oct 18, 2024

It reduces the number of synonym variables in the code.
Makes it easier to grok and grep.

  • replace CURL_SOURCE_DIR
    with PROJECT_SOURCE_DIR.

  • replace CURL_BINARY_DIR
    with PROJECT_BINARY_DIR or CMAKE_CURRENT_BINARY_DIR.

  • replace a single use of CMAKE_BINARY_DIR
    with PROJECT_BINARY_DIR.

  • replace CMAKE_CURRENT_*_DIR
    with PROJECT_*_DIR where it makes the code more uniform.

  • quote an argument (formatting).


  • check CMAKE_SOURCE_DIR and CMAKE_BINARY_DIR as an alternative for PROJECT_*.

@vszakats vszakats marked this pull request as draft October 18, 2024 08:40
@vszakats vszakats changed the title cmake: rename CURL_*_DIR to CMAKE_CURRENT_*_DIR [WIP] cmake: rename CURL_*_DIR to CMAKE_CURRENT_*_DIR Oct 18, 2024
@vszakats vszakats changed the title [WIP] cmake: rename CURL_*_DIR to CMAKE_CURRENT_*_DIR [WIP] cmake: replace CURL_*_DIR variables Oct 18, 2024
@vszakats vszakats changed the title [WIP] cmake: replace CURL_*_DIR variables [WIP] cmake: replace CURL_*_DIR variables with generic ones Oct 18, 2024
@vszakats vszakats changed the title [WIP] cmake: replace CURL_*_DIR variables with generic ones cmake: replace CURL_*_DIR variables with generic ones Oct 18, 2024
@vszakats vszakats changed the title cmake: replace CURL_*_DIR variables with generic ones cmake: replace CURL_*_DIR variables with {PROJECT,CMAKE_CURRENT}_*_DIR Oct 18, 2024
@vszakats vszakats changed the title cmake: replace CURL_*_DIR variables with {PROJECT,CMAKE_CURRENT}_*_DIR cmake: replace CURL_*_DIR with {PROJECT,CMAKE_CURRENT}_*_DIR Oct 18, 2024
@vszakats vszakats marked this pull request as ready for review October 18, 2024 12:33
@vszakats vszakats force-pushed the cm-tidy-project-root-var branch 3 times, most recently from 23ddb17 to 9babf14 Compare October 22, 2024 11:03
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
Development

Successfully merging this pull request may close these issues.

1 participant