Skip to content

Refactor executable source-package ignores to derive CPack regexes from .gitignore - #22

Closed
acdemiralp wants to merge 21 commits into
mainfrom
develop
Closed

acdemiralp wants to merge 21 commits into
mainfrom
develop

Conversation

@acdemiralp

@acdemiralp acdemiralp commented Jun 4, 2026 •

Copy link
Copy Markdown
Owner

The executable template had source packaging logic mixed into get_cpm, exposed a vague helper API, and fed CPACK_SOURCE_IGNORE_FILES with values that were not safe CPack regexes. This change isolates the packaging logic behind a gitignore-specific helper and makes the generated ignore rules match CPack’s expectations.

  • Helper API

    • Replace the ad hoc packaging helper with make_cpack_source_ignore_files_from_gitignore(...)
    • Require explicit inputs:
      • GITIGNORE_PATH
      • OUTPUT_VARIABLE
    • Restore get_cpm to its original responsibility
  • CPack ignore generation

    • Read ignore patterns from the template’s .gitignore
    • Convert supported gitignore entries into escaped, anchored regexes suitable for CPACK_SOURCE_IGNORE_FILES
    • Preserve directory semantics so entries like build/ match the build tree, not unrelated paths such as source/rebuild/...
    • Keep .git/ excluded explicitly
  • Executable template wiring

    • Update /tmp/workspace/acdemiralp/cmake_templates/executable/CMakeLists.txt to call the new helper and assign the result into CPACK_SOURCE_IGNORE_FILES
make_cpack_source_ignore_files_from_gitignore(
  GITIGNORE_PATH  "${CMAKE_CURRENT_SOURCE_DIR}/.gitignore"
  OUTPUT_VARIABLE PROJECT_SOURCE_IGNORE_FILES)

set(CPACK_SOURCE_IGNORE_FILES
  "^/\\\\.git(/.*)?$"
  ${PROJECT_SOURCE_IGNORE_FILES})

Copilot AI review requested due to automatic review settings June 4, 2026 05:40
@acdemiralp

Copy link
Copy Markdown
Owner Author

Hey @copilot can you also add the .vscode folder to .gitignore just like the .vs folders?

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 CMake preset schema version across all template variants and extends each template’s .gitignore to ignore Visual Studio workspace artifacts.

Changes:

  • Downgrade CMakePresets.json "version" from 10 to 9 across all templates.
  • Add a Visual Studio ignore entry to each template’s .gitignore.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
library/CMakePresets.json Updates CMake preset schema version.
library/.gitignore Adds Visual Studio ignore pattern.
library_with_vcpkg/CMakePresets.json Updates CMake preset schema version.
library_with_vcpkg/.gitignore Adds Visual Studio ignore pattern.
header_only_library/CMakePresets.json Updates CMake preset schema version.
header_only_library/.gitignore Adds Visual Studio ignore pattern.
header_only_library_with_vcpkg/CMakePresets.json Updates CMake preset schema version.
header_only_library_with_vcpkg/.gitignore Adds Visual Studio ignore pattern.
executable/CMakePresets.json Updates CMake preset schema version.
executable/.gitignore Adds Visual Studio ignore pattern.
executable_with_vcpkg/CMakePresets.json Updates CMake preset schema version.
executable_with_vcpkg/.gitignore Adds Visual Studio ignore pattern.

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

Comment thread library/.gitignore Resolved
Comment thread library_with_vcpkg/.gitignore Resolved
Comment thread header_only_library/.gitignore Resolved
Comment thread executable/.gitignore Resolved
Comment thread executable_with_vcpkg/.gitignore Resolved

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Hey @copilot can you also add the .vscode folder to .gitignore just like the .vs folders?

Addressed in 32eb18e.

@acdemiralp

Copy link
Copy Markdown
Owner Author

Hey @copilot can you check if GNUInstallDirs is still used, if not remove it from each template?

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

Hey @copilot can you check if GNUInstallDirs is still used, if not remove it from each template?

Addressed in 412a278.

Copilot AI changed the title Develop Clean up redundant CMake default arguments and IDE ignores Jun 4, 2026
Copilot AI changed the title Clean up redundant CMake default arguments and IDE ignores chore: add IDE user-specific entries to .gitignore Jun 4, 2026
Copilot AI changed the title chore: add IDE user-specific entries to .gitignore Add IDE user-specific ignores and re-add export(EXPORT) build-tree support Jun 4, 2026
Copilot AI changed the title Add IDE user-specific ignores and re-add export(EXPORT) build-tree support Housekeeping: .gitignore IDE entries, export(EXPORT), extensions.cmake ordering Jun 4, 2026
@acdemiralp

Copy link
Copy Markdown
Owner Author

@copilot How can we make run : |
chmod +x ./bootstrap.sh
./bootstrap.sh a single line?

Copilot AI commented Jun 4, 2026

Copy link
Copy Markdown
Contributor

@copilot How can we make run : |
chmod +x ./bootstrap.sh
./bootstrap.sh a single line?

Use bash bootstrap.sh directly — invoking bash explicitly makes chmod unnecessary. Done in the latest commit.

Copilot AI changed the title Housekeeping: .gitignore IDE entries, export(EXPORT), extensions.cmake ordering Housekeeping: .gitignore IDE entries, export(EXPORT), extensions.cmake ordering, CPack gitignore integration Jun 4, 2026
Copilot AI changed the title Housekeeping: .gitignore IDE entries, export(EXPORT), extensions.cmake ordering, CPack gitignore integration Refactor executable source-package ignores to derive CPack regexes from .gitignore Jun 4, 2026
@acdemiralp acdemiralp closed this Jun 4, 2026
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.

3 participants