From c8c5a73b8274185f0b6bf510df1add1d364899ee Mon Sep 17 00:00:00 2001 From: Peter Doak <11856692+PDoakORNL@users.noreply.github.com> Date: Thu, 21 May 2026 14:06:47 +0000 Subject: [PATCH] Fix CMake install step: add install targets and preserve RPATH - Add install(TARGETS ...) for main_dca, main_analysis, chi_q_omega, and cluster_solver_check application binaries - Set CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE so installed binaries can find shared libraries (OpenBLAS, HDF5, FFTW) without LD_LIBRARY_PATH at runtime Tested with Ninja generator + spack environment. --- CMakeLists.txt | 4 ++++ applications/analysis/CMakeLists.txt | 3 +++ applications/cluster_solver_check/CMakeLists.txt | 2 ++ applications/dca/CMakeLists.txt | 2 ++ 4 files changed, 11 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index abea4d695..635ecb571 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -34,6 +34,10 @@ endif() set(SANE_DEV_BUILD true) +################################################################################ +# Preserve RPATH in installed binaries so they can find shared libraries. +set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + ################################################################################ # Include CMake scripts from cmake directory. list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) diff --git a/applications/analysis/CMakeLists.txt b/applications/analysis/CMakeLists.txt index aef6ba13d..a53a4bfbd 100644 --- a/applications/analysis/CMakeLists.txt +++ b/applications/analysis/CMakeLists.txt @@ -10,6 +10,8 @@ if (DCA_BUILD_ANALYSIS) target_link_libraries(main_analysis PUBLIC signals ${DCA_LIBS} simplex_gm_rule) + install(TARGETS main_analysis RUNTIME DESTINATION bin) + message("DCA_MODEL_IS_MATERIAL_LATTICE ${DCA_MODEL_IS_MATERIAL_LATTICE}") if (DCA_LATTICE STREQUAL "square") #new development of exanded q chi_q_omega @@ -23,6 +25,7 @@ if (DCA_BUILD_ANALYSIS) target_link_libraries(chi_q_omega PUBLIC signals ${DCA_LIBS} simplex_gm_rule) + install(TARGETS chi_q_omega RUNTIME DESTINATION bin) endif() endif() diff --git a/applications/cluster_solver_check/CMakeLists.txt b/applications/cluster_solver_check/CMakeLists.txt index 5e1be7e4f..f4e3f2a45 100644 --- a/applications/cluster_solver_check/CMakeLists.txt +++ b/applications/cluster_solver_check/CMakeLists.txt @@ -9,4 +9,6 @@ if (DCA_BUILD_CLUSTER_SOLVER_CHECK) dca_gpu_runtime_link(cluster_solver_check) dca_gpu_blas_link(cluster_solver_check) endif() + + install(TARGETS cluster_solver_check RUNTIME DESTINATION bin) endif() diff --git a/applications/dca/CMakeLists.txt b/applications/dca/CMakeLists.txt index aac9a9cf6..f7a9c3762 100644 --- a/applications/dca/CMakeLists.txt +++ b/applications/dca/CMakeLists.txt @@ -9,4 +9,6 @@ if (DCA_BUILD_DCA) endif() target_link_libraries(main_dca PUBLIC FFTW::Double signals ${DCA_LIBS} dca_io) + + install(TARGETS main_dca RUNTIME DESTINATION bin) endif()