Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add optional prefix to installation paths #235

Merged
merged 4 commits into from
Dec 22, 2023
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,12 +140,20 @@ set_target_properties(mscclpp_static PROPERTIES VERSION ${MSCCLPP_VERSION} SOVER
add_subdirectory(include)
add_subdirectory(src)

# Append "/" if INSTALL_PREFIX is not empty and does not end with "/"
if(NOT "${INSTALL_PREFIX}" STREQUAL "")
string(REGEX MATCH "[^/]$" INSTALL_PREFIX_HAS_SLASH "${INSTALL_PREFIX}")
if(INSTALL_PREFIX_HAS_SLASH)
set(INSTALL_PREFIX "${INSTALL_PREFIX}/")
endif()
endif()

install(TARGETS mscclpp_obj
FILE_SET HEADERS DESTINATION include)
FILE_SET HEADERS DESTINATION ${INSTALL_PREFIX}include)
install(TARGETS mscclpp
LIBRARY DESTINATION lib)
LIBRARY DESTINATION ${INSTALL_PREFIX}lib)
install(TARGETS mscclpp_static
ARCHIVE DESTINATION lib)
ARCHIVE DESTINATION ${INSTALL_PREFIX}lib)

# Tests
if(BUILD_TESTS)
Expand Down