Conversation
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Installed helper modules and generated templates introduce GNUInstallDirs-dependent variables (and libdir-sensitive RPATH behavior) without consistently ensuring the correct GNUInstallDirs module usage for downstream consumers.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 4
Open (4)
What changed in this PR
This PR standardizes installation paths across the JANA2 CMake build by adopting CMake’s GNUInstallDirs variables, making it easier to override install destinations (e.g., for non-FHS layouts like WASM).
Changes:
- Adds
include(GNUInstallDirs)and replaces hardcodedbin/,lib/, andinclude/install destinations with${CMAKE_INSTALL_BINDIR},${CMAKE_INSTALL_LIBDIR}, and${CMAKE_INSTALL_INCLUDEDIR}. - Updates exported/install interface include paths to follow
${CMAKE_INSTALL_INCLUDEDIR}. - Aligns example/tutorial and helper-module installation destinations with the new scheme.
| File | Description |
|---|---|
CMakeLists.txt |
Includes GNUInstallDirs and updates install destinations for scripts and optional perfetto artifacts. |
cmake/MakeConfig.cmake |
Moves package config install destination under ${CMAKE_INSTALL_LIBDIR}. |
cmake/MakeJVersionH.cmake |
Installs generated JVersion.h under ${CMAKE_INSTALL_INCLUDEDIR}. |
cmake/MakeJanaThis.cmake |
Installs jana-* helper scripts under ${CMAKE_INSTALL_BINDIR}. |
cmake/AddJanaPlugin.cmake |
Updates plugin install/include destinations to use CMAKE_INSTALL_*DIR variables. |
cmake/AddJanaLibrary.cmake |
Updates library install/include destinations to use CMAKE_INSTALL_*DIR variables. |
cmake/AddJanaTest.cmake |
Updates test install destination to ${CMAKE_INSTALL_BINDIR}. |
scripts/jana-generate.py |
Updates generated CMake snippets to use install-dir variables for includes/bins (keeps plugin dir as plugins). |
src/libraries/JANA/CMakeLists.txt |
Updates core library/header installation and install-interface includes to use CMAKE_INSTALL_*DIR. |
src/programs/jana/CMakeLists.txt |
Installs jana binary into ${CMAKE_INSTALL_BINDIR}. |
src/plugins/janaview/CMakeLists.txt |
Installs ROOT PCM/rootmap artifacts under ${CMAKE_INSTALL_LIBDIR}/JANA/plugins. |
src/external/tomlplusplus/CMakeLists.txt |
Installs vendored headers under ${CMAKE_INSTALL_INCLUDEDIR} and updates install-interface include path. |
src/external/catch2/CMakeLists.txt |
Installs vendored headers under ${CMAKE_INSTALL_INCLUDEDIR} and updates install-interface include path. |
src/examples/tutorial_with_podio_datamodel/01_datamodel/CMakeLists.txt |
Updates tutorial library/header and ROOT dict artifact install destinations to CMAKE_INSTALL_*DIR. |
src/examples/tutorial_with_lightweight_datamodel/01_datamodel/CMakeLists.txt |
Updates tutorial datamodel header install destination and install-interface include path to ${CMAKE_INSTALL_INCLUDEDIR}. |
src/examples/tutorial_with_lightweight_datamodel/19_wrapper_program/CMakeLists.txt |
Installs wrapper binary into ${CMAKE_INSTALL_BINDIR}. |
src/examples/misc/SubeventExample/CMakeLists.txt |
Installs example binary into ${CMAKE_INSTALL_BINDIR}. |
src/examples/misc/SubeventCUDAExample/CMakeLists.txt |
Installs CUDA example binary into ${CMAKE_INSTALL_BINDIR}. |
src/examples/misc/RootDatamodelExample/CMakeLists.txt |
Installs ROOT PCM artifacts under ${CMAKE_INSTALL_LIBDIR}/JANA/plugins. |
src/examples/misc/PodioDatamodel/CMakeLists.txt |
Updates example library/header and ROOT dict artifact install destinations to CMAKE_INSTALL_*DIR. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
All three addressed by including GNUInstallDirs. Typo fixed as suggested. |
There was a problem hiding this comment.
This is not self-consistent now.
| INSTALL_RPATH "${CMAKE_INSTALL_LIBDIR}" |
And others
veprbl
left a comment
There was a problem hiding this comment.
Also need to update instances in
https://github.com/JeffersonLab/JANA2/blob/master/scripts/jana-config.in
|
|
||
| file(GLOB my_headers "*.h*") | ||
| install(FILES ${{my_headers}} DESTINATION include/{name}) | ||
| install(FILES ${{my_headers}} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/{name}) |
There was a problem hiding this comment.
What if is_standalone=False? Probably can slap an include GNUInstallDirs to every snippet that creates a target?

This PR adds
GNUInstallDirsfor installation destinations (https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html). This makes it easier to override the installation destinations in one place for certain platforms (e.g. WASM, which puts all libs alongside bins).The only thing that's not replaced by a
CMAKE_INSTALL_*DIRis the plainpluginsdirectory injana-generate.py. This is a gray area in the FHS, but more importantly it's probably not advisable to change this from the currentpluginsdirectory under the install prefix for user plugins (JANA2 plugins already end up inlib/JANA/plugins).