Refactor: CMake Module now uses mostly hard-coded paths#5402
Refactor: CMake Module now uses mostly hard-coded paths#5402reneme merged 4 commits intorandombit:masterfrom
Conversation
These files are distributed to consumer machines and should therefore carry some license information.
There was a problem hiding this comment.
Pull request overview
Refactors the generated CMake package config modules to rely primarily on install-layout information computed at configure.py time (instead of runtime discovery in botan-config.cmake), adds licensing headers to the distributed CMake module files, and introduces a --cmakeconfigdir option for packagers.
Changes:
- Add
--cmakeconfigdirand plumb its resolved install directory throughbuild_config.jsonfor installation. - Rework
botan-config.cmake.into derive prefix via fixed upward traversal and then use precomputed relative install subpaths. - Add license headers to
botan-config.cmake.inandbotan-config-version.cmake.in.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.
| File | Description |
|---|---|
| src/scripts/install.py | Install CMake config files into cmake_install_dir from build_config.json instead of reconstructing the path. |
| src/build-data/botan-config.cmake.in | Replace runtime discovery logic with fixed prefix traversal + configure-time relative paths; adjust DLL path to use computed bin dir. |
| src/build-data/botan-config-version.cmake.in | Add license header to the distributed version file. |
| configure.py | Add --cmakeconfigdir option and generate CMake-install layout variables (cmake_install_dir, relpaths, traversal depth components). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
441448f to
623a830
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
971b2df to
18cef9d
Compare
randombit
left a comment
There was a problem hiding this comment.
Couple of super nit comments/suggestions
This allows package maintainers to configure where CMake modules should be placed during installation.
Instead of trying to figure out the locations of Botan's include and library files heuristically within the botan-cmake-config.cmake module, this now leverages the platform knowledge in configure.py. By hard- coding most of the relevant paths and just handling potential symlink issues on the target machine, we hopefully get a cleaner and more robust CMake module. Closes randombit#5030
18cef9d to
d473955
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This is inspired by the CMake modules generated by actual CMake-based projects. Essentially, most of the "discovery logic" is moved out of
botan-config.cmakeand intoconfigure.pywhere we have much more information about the target system's installation directory structure. The only thing that is still done within the CMake module itself is to snap onto the "real path" when users are discovering Botan via a symlink as outlined in the code comments. This approach is borrowed from generated CMake module files on my machine.Also, this adds license notes in the CMake module files (as they are distributed to consumer machines) and introduces a
--cmakeconfigdirswitch in./configure.pyto allow package maintainers to influence where the CMake module should be placed.Closes #5030