From 2ff061daa023a3581d7d10fdfaee564f78e4eca0 Mon Sep 17 00:00:00 2001 From: nhatdongdang <144138246+nhatdongdang@users.noreply.github.com> Date: Mon, 9 Sep 2024 13:35:20 +1000 Subject: [PATCH] Add variable for install dirs --- CMakeLists.txt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ad0a65dc..df921988 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,17 +33,21 @@ file(GLOB_RECURSE MCPP_SOURCE_FILES ${MCPP_SRC_DIR}/*.cpp) # Library build add_library(${PROJECT_NAME} SHARED ${MCPP_INCLUDE_FILES} ${MCPP_SOURCE_FILES}) + +set(LIB_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/lib/${PROJECT_NAME}) +set(HEADER_INSTALL_DIR ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME}) + set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1 PUBLIC_HEADER "${MCPP_INCLUDE_FILES}" - INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib" + INSTALL_NAME_DIR ${LIB_INSTALL_DIR} ) install(TARGETS ${PROJECT_NAME} - LIBRARY DESTINATION lib - PUBLIC_HEADER DESTINATION include/${PROJECT_NAME} + LIBRARY DESTINATION ${LIB_INSTALL_DIR} + PUBLIC_HEADER DESTINATION ${HEADER_INSTALL_DIR} ) # CPack setup