build: Generate and install `etc/profile.d/mamba.sh` for mamba (#3723)

Signed-off-by: Julien Jerphanion <git@jjerphan.xyz>
Co-authored-by: Klaim <Klaim@users.noreply.github.com>
This commit is contained in:
Julien Jerphanion 2025-01-06 16:41:54 +01:00 committed by GitHub
parent 4f97739aed
commit d1786964f9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 20 additions and 11 deletions

View File

@ -38,16 +38,6 @@ target_link_libraries(mamba-package PRIVATE mamba::libmamba)
set_target_properties(mamba-package PROPERTIES CXX_STANDARD 17)
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/etc/profile.d/mamba.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh"
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh
DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/profile.d/
)
install(
TARGETS mamba-package
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}

View File

@ -105,4 +105,23 @@ endif()
# Installation
# ============
install(TARGETS ${mambaexe_targets})
# This profile script is only needed for mamba on Unix systems.
if(BUILD_SHARED AND UNIX)
message(STATUS "Generating profile script for mamba (i.e. `etc/profile.d/mamba.sh`)")
configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/etc/profile.d/mamba.sh.in"
"${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh"
)
install(
FILES ${CMAKE_CURRENT_BINARY_DIR}/etc/profile.d/mamba.sh
DESTINATION ${CMAKE_INSTALL_PREFIX}/etc/profile.d/
)
endif()
install(
TARGETS ${mambaexe_targets}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
)