CMake: add install path option
@@ -9,6 +9,7 @@ option(CGLM_SHARED "Shared build" ON)
option(CGLM_STATIC "Static build" OFF)
option(CGLM_USE_C99 "" OFF)
option(CGLM_USE_TEST "Enable Tests" OFF)
+option(CGLM_INSTALL_PATH "")
if(NOT CGLM_STATIC AND CGLM_SHARED)
set(CGLM_BUILD SHARED)
@@ -149,11 +150,15 @@ if(LDFLAGS)
target_compile_options(cglm PRIVATE ${LDFLAGS})
endif()
+if(NOT CGLM_INSTALL_PATH)
+ set(CGLM_INSTALL_PATH "")
+endif()
+
install(
TARGETS cglm
EXPORT cglm
- ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib COMPONENT development
- LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib COMPONENT runtime NAMELINK_SKIP
+ ARCHIVE DESTINATION ${CGLM_INSTALL_PATH}lib COMPONENT development
+ LIBRARY DESTINATION ${CGLM_INSTALL_PATH}lib COMPONENT runtime NAMELINK_SKIP
RUNTIME DESTINATION ${CMAKE_INSTALL_NAME_DIR} COMPONENT runtime
)
@@ -161,11 +166,12 @@ if(CGLM_SHARED)
install(
TARGETS cglm
EXPORT cglm
- LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib COMPONENT development NAMELINK_ONLY
+ LIBRARY DESTINATION ${CGLM_INSTALL_PATH}/lib COMPONENT development NAMELINK_ONLY
)
endif()
-install(FILES ${HEADERS} DESTINATION ${CMAKE_INSTALL_PREFIX}/include/cglm COMPONENT development)
+
+install(FILES ${HEADERS} DESTINATION ${CGLM_INSTALL_PATH}include/cglm COMPONENT development)
# Test Configuration
if(CGLM_USE_TEST)
