Skip to content

cmake: robustify base path in local file reference#22187

Closed
vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:cm-dir
Closed

cmake: robustify base path in local file reference#22187
vszakats wants to merge 1 commit into
curl:masterfrom
vszakats:cm-dir

Conversation

@vszakats

@vszakats vszakats commented Jun 26, 2026

Copy link
Copy Markdown
Member

To make the macro find this file also when used elsewhere than the root
CMakeLists.txt. Current code only uses it from the root.

Follow-up to 88c17d5

To make the macro find this file also when used elsewhere than the root
`CMakeLists.txt`.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the curl_internal_test() CMake macro to reference CurlTests.c via the project’s top-level source directory, so the macro continues to work even when invoked from CMake files in subdirectories (not just the root CMakeLists.txt).

Changes:

  • Update the try_compile() source path in curl_internal_test() from CMAKE_CURRENT_SOURCE_DIR to PROJECT_SOURCE_DIR to make the CurlTests.c reference stable across call sites.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@vszakats vszakats closed this in 4839029 Jun 26, 2026
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
vszakats deleted the cm-dir branch June 26, 2026 13:47
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
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.

2 participants