Skip to content

Fixes cmake caching #7109

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

dimatcimbal
Copy link

@dimatcimbal dimatcimbal commented Jul 17, 2025

This PR fixes cmake caching by making sure that the placeholder file ${PROJECT_SOURCE_DIR}/include/git2/experimental.h is not copied to the install directory. Otherwise, on the next step the file would otherwise be overwritten by the generated version ${PROJECT_BINARY_DIR}/include/git2/experimental.h.

cmake --install build
...
-- Up-to-date: /Users/dimatcimbal/code/libgit2/installdir/include/git2/transaction.h
-- Up-to-date: /Users/dimatcimbal/code/libgit2/installdir/include/git2/stdint.h
-- Up-to-date: /Users/dimatcimbal/code/libgit2/installdir/include/git2/commit.h
-- Up-to-date: /Users/dimatcimbal/code/libgit2/installdir/include/git2/refdb.h
-- Up-to-date: /Users/dimatcimbal/code/libgit2/installdir/include/git2/experimental.h
-- Up-to-date: /Users/dimatcimbal/code/libgit2/installdir/include/git2.h
-- Up-to-date: /Users/dimatcimbal/code/libgit2/installdir/bin/git2

Fixes the issue #7110

@dimatcimbal dimatcimbal marked this pull request as ready for review July 17, 2025 02:49
@Copilot Copilot AI review requested due to automatic review settings July 17, 2025 02:49
@dimatcimbal dimatcimbal changed the title Fixes build hermeticity Fixes cmake caching Jul 17, 2025
Copy link

@Copilot Copilot AI left a comment

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 fixes the CMake install step so that the placeholder experimental.h in the source tree isn’t copied over and then immediately overwritten by the generated header from the build directory.

  • Excludes experimental.h from the source include directory in the install(DIRECTORY ...) call.
  • Continues to install the generated experimental.h from the build directory via a separate install(FILES ...) call.
Comments suppressed due to low confidence (1)

src/libgit2/CMakeLists.txt:137

  • [nitpick] This line mixes tabs and spaces for indentation. Please follow the project’s standard indentation style (either spaces or tabs) to keep CMakeLists.txt consistent.
		PATTERN "experimental.h" EXCLUDE)

@@ -133,7 +133,8 @@ install(TARGETS libgit2package
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/git2/
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}")
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${LIBGIT2_FILENAME}"
PATTERN "experimental.h" EXCLUDE)
Copy link
Preview

Copilot AI Jul 17, 2025

Choose a reason for hiding this comment

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

[nitpick] The closing parenthesis for the install(DIRECTORY ...) command has moved to the PATTERN line, making the DESTINATION line look unbalanced. Consider placing the closing parenthesis on its own line or aligning it consistently for readability.

Suggested change
PATTERN "experimental.h" EXCLUDE)
PATTERN "experimental.h" EXCLUDE
)

Copilot uses AI. Check for mistakes.

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

Successfully merging this pull request may close these issues.

1 participant