Skip to content

Commit

Permalink
Fixed custom install prefix
Browse files Browse the repository at this point in the history
  • Loading branch information
FeatherAntennae committed Sep 27, 2023
1 parent 513a066 commit b0d12dd
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
15 changes: 11 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,17 @@ set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set(OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/out")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OUTPUT_DIRECTORY}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_DIRECTORY}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIRECTORY}")
if (DEFINED CUSTOM_INSTALL_PREFIX)
set(OUTPUT_DIRECTORY "${CUSTOM_INSTALL_PREFIX}/Discregrid")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CUSTOM_INSTALL_PREFIX}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CUSTOM_INSTALL_PREFIX}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CUSTOM_INSTALL_PREFIX}")
else()
set(OUTPUT_DIRECTORY "${PROJECT_SOURCE_DIR}/out")
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${OUTPUT_DIRECTORY}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${OUTPUT_DIRECTORY}/lib")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${OUTPUT_DIRECTORY}")
endif()


# Enable simultaneous compilation of source files.
Expand Down
10 changes: 5 additions & 5 deletions discregrid/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -101,14 +101,14 @@ endif()
# Set link libraries.
target_link_libraries(Discregrid)

if (DEFINED ${CMAKE_INSTALL_PREFIX})
if (DEFINED CUSTOM_INSTALL_PREFIX)
install(TARGETS Discregrid
RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/Discregrid/bin
LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/Discregrid/lib
ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/Discregrid/lib)
RUNTIME DESTINATION ${CUSTOM_INSTALL_PREFIX}/Discregrid/bin
LIBRARY DESTINATION ${CUSTOM_INSTALL_PREFIX}/Discregrid/lib
ARCHIVE DESTINATION ${CUSTOM_INSTALL_PREFIX}/Discregrid/lib)

install(DIRECTORY include
DESTINATION ${CMAKE_INSTALL_PREFIX}/Discregrid
DESTINATION ${CUSTOM_INSTALL_PREFIX}/Discregrid
PATTERN "*.hpp")
else()
install(TARGETS Discregrid
Expand Down

0 comments on commit b0d12dd

Please sign in to comment.