diff --git a/CMakeLists.txt b/CMakeLists.txt index cee6717..d1a6dfa 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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. diff --git a/discregrid/CMakeLists.txt b/discregrid/CMakeLists.txt index 9cd13f9..964dfe3 100755 --- a/discregrid/CMakeLists.txt +++ b/discregrid/CMakeLists.txt @@ -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