We'll be taking GitLab down for maintenance around 22 in the evening on the 15th of September, so this Sunday. Let us know (tt.mpi-cbg.de) if you experience any issues with it after the maintenance period.

Commit a52bbaef authored by Peter Steinbach's avatar Peter Steinbach

added cmake boilerplate to better support inclusions of compass

parent 938378d1
......@@ -17,10 +17,17 @@ include(CheckCXXSourceCompiles)
SET (COMPASS_NAME "Compass - drop-in header-only C++ library to detect hardware capabilities at runtime and at compiletime")
SET (COMPASS_CODENAME "${PROJECT_NAME}")
SET (COMPASS_COPYRIGHT_YEARS "2017")
SET (COMPASS_VERSION_MAJOR 0)
SET (COMPASS_VERSION_MINOR 0)
SET (COMPASS_VERSION_PATCH 0)
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake )
include(git_utils)
git_describe(COMPASS_VERSION --tags --abbrev=0)
git_describe(COMPASS_VERSION_HEADREF --always)
string(REPLACE "." ";" COMPASS_VERSION_ASLIST ${COMPASS_VERSION})
list(GET COMPASS_VERSION_ASLIST 0 COMPASS_VERSION_MAJOR)
list(GET COMPASS_VERSION_ASLIST 1 COMPASS_VERSION_MINOR)
list(GET COMPASS_VERSION_ASLIST 2 COMPASS_VERSION_PATCH)
SET (COMPASS_VERSION "${COMPASS_VERSION_MAJOR}.${COMPASS_VERSION_MINOR}.${COMPASS_VERSION_PATCH}")
SET (COMPASS_VENDOR_ID "psteinb")
SET (COMPASS_ID "${COMPASS_VENDOR_ID}.${PROJECT_NAME}")
......@@ -149,21 +156,41 @@ if(WITH_TESTS)
endif()
################################ EXPORT/INSTALL ################################
export(
TARGETS ${COMPASS_TARGET_NAME}
NAMESPACE ${PROJECT_NAME}::
FILE ${COMPASS_CMAKE_PROJECT_TARGETS_FILE}
)
install(
TARGETS ${COMPASS_TARGET_NAME}
EXPORT ${PROJECT_NAME}Targets
EXPORT ${COMPASS_TARGETS_EXPORT_NAME}
INCLUDES DESTINATION ${COMPASS_INCLUDE_INSTALL_DIR}
LIBRARY DESTINATION lib
RUNTIME DESTINATION bin
ARCHIVE DESTINATION lib
)
install(
EXPORT ${COMPASS_TARGETS_EXPORT_NAME}
FILE ${COMPASS_TARGETS_EXPORT_NAME}.cmake
NAMESPACE ${PROJECT_NAME}::
DESTINATION ${COMPASS_CONFIG_INSTALL_DIR}
DESTINATION lib/cmake/${PROJECT_NAME}
)
# install(
# EXPORT ${COMPASS_TARGETS_EXPORT_NAME}
# NAMESPACE ${PROJECT_NAME}::
# DESTINATION ${COMPASS_CONFIG_INSTALL_DIR}
# )
include(CMakePackageConfigHelpers)
configure_package_config_file(
${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}Config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
INSTALL_DESTINATION ${LIB_INSTALL_DIR}/cmake/${PROJECT_NAME}
PATH_VARS COMPASS_INCLUDE_INSTALL_DIR)
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake
VERSION ${COMPASS_VERSION}
COMPATIBILITY SameMajorVersion
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}ConfigVersion.cmake ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}Config.cmake
DESTINATION lib/cmake/${PROJECT_NAME})
install(DIRECTORY "${COMPASS_INCLUDE_BUILD_DIR}"
DESTINATION include
FILES_MATCHING
......
set(COMPASS_VERSION @COMPASS_VERSION@)
...
@PACKAGE_INIT@
...
set_and_check(COMPASS_INCLUDE_DIR "@PACKAGE_INCLUDE_INSTALL_DIR@")
check_required_components(Compass)
Markdown is supported
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