From 6c2542e54079c6d5cd00988bb90ce9e8d2a1d5f2 Mon Sep 17 00:00:00 2001 From: Tim453 <50015765+Tim453@users.noreply.github.com> Date: Sun, 17 Mar 2024 19:25:45 +0100 Subject: [PATCH] Allow changing the install path This commit allow changing the install path during CMake configure step using the CMAKE_INSTALL_PREFIX variable. If the variable is not set, it still defaults to {CMAKE_BINARY_DIR}/install. Signed-off-by: Tim453 <50015765+Tim453@users.noreply.github.com> --- gpt4all-chat/CMakeLists.txt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gpt4all-chat/CMakeLists.txt b/gpt4all-chat/CMakeLists.txt index 1ecf4b7c..d2576f4f 100644 --- a/gpt4all-chat/CMakeLists.txt +++ b/gpt4all-chat/CMakeLists.txt @@ -187,7 +187,10 @@ target_link_libraries(chat PRIVATE llmodel) set(COMPONENT_NAME_MAIN ${PROJECT_NAME}) -set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install) + +if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "..." FORCE) +endif() install(TARGETS chat DESTINATION bin COMPONENT ${COMPONENT_NAME_MAIN}) install(TARGETS llmodel DESTINATION lib COMPONENT ${COMPONENT_NAME_MAIN})