Commit fc559a11 authored by Arnaud Le Meillour's avatar Arnaud Le Meillour
Browse files

add config cmake file

parent 76d66a74
Pipeline #53204 failed with stage
in 13 seconds
......@@ -2,6 +2,8 @@ set(BINARY_TARGET ${PROJECT_NAME}_binary)
add_executable(${BINARY_TARGET})
message(STATUS "${HOME_PREFIX}:: - built binary via target ${BINARY_TARGET}")
include(${CMAKE_SOURCE_DIR}/cmake/conf.cmake)
target_sources(${BINARY_TARGET}
PRIVATE
${_SOURCE_FILES}
......@@ -63,5 +65,6 @@ set_target_properties(${BINARY_TARGET}
)
install(TARGETS ${BINARY_TARGET} EXPORT ${BINARY_TARGET}_export
DESTINATION "${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME}"
DESTINATION "${INSTALL_BINDIR}"
PERMISSIONS ${DEFAULT_PERMISSIONS_BIN}
)
\ No newline at end of file
......@@ -2,6 +2,8 @@ set(SHARED_TARGET ${PROJECT_NAME}_shared)
add_library(${SHARED_TARGET} SHARED)
message(STATUS "${HOME_PREFIX}:: - built shared via target ${SHARED_TARGET}")
include(${CMAKE_SOURCE_DIR}/cmake/conf.cmake)
unset(PUBLIC_HEADER)
GET_HEADER_FILES(_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include)
foreach(_HEADER IN ITEMS ${_HEADERS})
......@@ -73,19 +75,11 @@ set_target_properties(${SHARED_TARGET}
VERSION ${PROJECT_VERSION}
)
set(FULL_MINOR_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
set(INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME})
set(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION})
set(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION}/include)
set(INSTALL_SOURCESDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION}/src)
set(INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION}/cmake)
install(TARGETS ${SHARED_TARGET} EXPORT ${SHARED_TARGET}_export
RUNTIME DESTINATION "${INSTALL_BINDIR}"
LIBRARY DESTINATION "${INSTALL_LIBDIR}"
PUBLIC_HEADER DESTINATION "${INSTALL_INCLUDEDIR}"
ARCHIVE DESTINATION "${INSTALL_LIBDIR}"
INCLUDES DESTINATION "${INSTALL_INCLUDEDIR}"
PERMISSIONS ${DEFAULT_PERMISSIONS_LIB}
)
configure_package_config_file(
......@@ -115,6 +109,8 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
${SOURCES}
DESTINATION
${INSTALL_SOURCESDIR}
PERMISSIONS
${DEFAULT_PERMISSIONS_LIB}
)
endif()
......@@ -125,9 +121,12 @@ install(
"${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake"
DESTINATION
${INSTALL_CMAKEDIR}
PERMISSIONS
${DEFAULT_PERMISSIONS_LIB}
)
install(EXPORT ${SHARED_TARGET}_export
FILE ${PROJECT_NAME}Targets.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${INSTALL_CMAKEDIR}
PERMISSIONS ${DEFAULT_PERMISSIONS_LIB}
)
\ No newline at end of file
......@@ -2,6 +2,8 @@ set(STATIC_TARGET ${PROJECT_NAME}_static)
add_library(${STATIC_TARGET} STATIC)
message(STATUS "${HOME_PREFIX}:: - built static via target ${STATIC_TARGET}")
include(${CMAKE_SOURCE_DIR}/cmake/conf.cmake)
target_sources(${STATIC_TARGET}
PRIVATE
${_SOURCE_FILES}
......@@ -60,14 +62,8 @@ set_target_properties(${STATIC_TARGET}
OUTPUT_NAME ${PROJECT_NAME}-${PROJECT_VERSION}
)
set(FULL_MINOR_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
set(INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME})
set(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION})
set(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION}/include)
set(INSTALL_SOURCESDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION}/src)
set(INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION}/cmake)
install(TARGETS ${STATIC_TARGET} EXPORT ${STATIC_TARGET}_export
ARCHIVE DESTINATION "${INSTALL_LIBDIR}"
PERMISSIONS ${DEFAULT_PERMISSIONS_LIB}
)
#######################################
# Set installation DESTINATION
set(FULL_MINOR_VERSION ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
set(INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR}/${PROJECT_NAME})
set(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION})
set(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION}/include)
set(INSTALL_SOURCESDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION}/src)
set(INSTALL_CMAKEDIR ${CMAKE_INSTALL_LIBDIR}/classes/${PROJECT_NAME}-${FULL_MINOR_VERSION}/cmake)
#######################################
# Set installation files PERMISSIONS
set(DEFAULT_PERMISSIONS_CONF
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ
)
set(DEFAULT_PERMISSIONS_LIB
OWNER_READ OWNER_WRITE
GROUP_READ GROUP_WRITE
WORLD_READ
)
set(DEFAULT_PERMISSIONS_BIN
OWNER_READ OWNER_WRITE OWNER_EXECUTE
GROUP_READ GROUP_WRITE GROUP_EXECUTE
WORLD_READ WORLD_EXECUTE
)
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment