cmake: replace CURL_*_DIR with {PROJECT,CMAKE_CURRENT}_*_DIR - #15331
Closed
vszakats wants to merge 7 commits into
Closed
cmake: replace CURL_*_DIR with {PROJECT,CMAKE_CURRENT}_*_DIR#15331vszakats wants to merge 7 commits into
CURL_*_DIR with {PROJECT,CMAKE_CURRENT}_*_DIR#15331vszakats wants to merge 7 commits into
Conversation
vszakats
marked this pull request as draft
October 18, 2024 08:40
CURL_*_DIR to CMAKE_CURRENT_*_DIRCURL_*_DIR to CMAKE_CURRENT_*_DIR
CURL_*_DIR to CMAKE_CURRENT_*_DIRCURL_*_DIR variables
CURL_*_DIR variablesCURL_*_DIR variables with generic ones
CURL_*_DIR variables with generic onesCURL_*_DIR variables with generic ones
vszakats
force-pushed
the
cm-tidy-project-root-var
branch
from
October 18, 2024 11:49
f98609a to
c6d4c54
Compare
CURL_*_DIR variables with generic onesCURL_*_DIR variables with {PROJECT,CMAKE_CURRENT}_*_DIR
CURL_*_DIR variables with {PROJECT,CMAKE_CURRENT}_*_DIRCURL_*_DIR with {PROJECT,CMAKE_CURRENT}_*_DIR
vszakats
marked this pull request as ready for review
October 18, 2024 12:33
vszakats
force-pushed
the
cm-tidy-project-root-var
branch
3 times, most recently
from
October 22, 2024 11:03
23ddb17 to
9babf14
Compare
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.
vszakats
force-pushed
the
cm-tidy-project-root-var
branch
from
October 22, 2024 13:18
9babf14 to
270df5f
Compare
pps83
pushed a commit
to pps83/curl
that referenced
this pull request
Apr 26, 2025
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). Closes curl#15331
vszakats
added a commit
that referenced
this pull request
Jun 26, 2026
Use `PROJECT_SOURCE_DIR` for these files, replacing `CMAKE_CURRENT_SOURCE_DIR`, to make it consistent with rest of CMake sources and to reflect that the locations of these files are fixed and do not depend on the CMake source location referencing them. Exception: keep as-is before calling `project()`, which is where `PROJECT_SOURCE_DIR` is initialized. Ref: https://cmake.org/cmake/help/v3.18/command/project.html Follow-up to #22187 Follow-up to 9126eb5 #15331 Closes #22188
vszakats
added a commit
that referenced
this pull request
Jun 26, 2026
- drop `generated` subdir, move these files to build root. To move them next to CPack and other config files, and to avoid a subdirectory for only 2 files. Follow-up to 6932849 #2849 - add 'Consumed variables' comment for `CMake/cmake_uninstall.in.cmake`. - move generated `cmake_uninstall.cmake` to the build root directory (from `CMake/`). To: - avoid creating a `CMake` subdirectory within the build directory with this single file in it. - move it next to its `cmake_install.cmake` counterpart. - move it next to `install_manifest.txt` which it relies on. Follow-up to 27e2a47 - Use `PROJECT_SOURCE_DIR` for these files, replacing `CMAKE_CURRENT_SOURCE_DIR`, to make it consistent with rest of CMake sources, and to reduce ambiguity in `CMake/cmake_uninstall.in.cmake` template. Follow-up to 8198e38 #22188 Follow-up to 4839029 #22187 Follow-up to 9126eb5 #15331 Closes #22192
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
It reduces the number of synonym variables in the code.
Makes it easier to grok and grep.
replace
CURL_SOURCE_DIRwith
PROJECT_SOURCE_DIR.replace
CURL_BINARY_DIRwith
PROJECT_BINARY_DIRorCMAKE_CURRENT_BINARY_DIR.replace a single use of
CMAKE_BINARY_DIRwith
PROJECT_BINARY_DIR.replace
CMAKE_CURRENT_*_DIRwith
PROJECT_*_DIRwhere it makes the code more uniform.quote an argument (formatting).
CMAKE_SOURCE_DIRandCMAKE_BINARY_DIRas an alternative forPROJECT_*.