-
Notifications
You must be signed in to change notification settings - Fork 31
/
CMakeLists.txt
60 lines (44 loc) · 2.27 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
cmake_minimum_required(VERSION 3.0...3.28)
project(fastmod
DESCRIPTION "A header file for fast 32-bit division and remainders on 64-bit hardware"
LANGUAGES CXX
VERSION 0.1.0
)
set (CMAKE_CXX_STANDARD 11)
if (NOT CMAKE_BUILD_TYPE)
message(STATUS "No build type selected, default to Release")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
endif()
add_library(fastmod INTERFACE)
enable_testing()
add_subdirectory(tests)
include(CMakePackageConfigHelpers)
include(GNUInstallDirs)
set(FASTMOD_VERSION_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/module/fastmodConfigVersion.cmake")
set(FASTMOD_PROJECT_CONFIG "${CMAKE_CURRENT_BINARY_DIR}/module/fastmodConfig.cmake")
set(FASTMOD_CONFIG_INSTALL_DIR "${CMAKE_INSTALL_DATAROOTDIR}/cmake/fastmod")
write_basic_package_version_file("${FASTMOD_VERSION_CONFIG}" VERSION ${PROJECT_VERSION} COMPATIBILITY AnyNewerVersion)
configure_package_config_file("cmake/config.cmake.in"
"${FASTMOD_PROJECT_CONFIG}"
INSTALL_DESTINATION "${FASTMOD_CONFIG_INSTALL_DIR}")
install(DIRECTORY "${PROJECT_SOURCE_DIR}/include/" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
install(FILES "${FASTMOD_PROJECT_CONFIG}" "${FASTMOD_VERSION_CONFIG}" DESTINATION "${FASTMOD_CONFIG_INSTALL_DIR}")
install(EXPORT ${PROJECT_NAME}-targets NAMESPACE fastmod:: DESTINATION "${FASTMOD_CONFIG_INSTALL_DIR}")
install(TARGETS fastmod
EXPORT ${PROJECT_NAME}-targets
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
target_include_directories(fastmod INTERFACE
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)
add_library(fastmod::fastmod ALIAS fastmod)
set(CPACK_PACKAGE_VENDOR "Daniel Lemire")
set(CPACK_PACKAGE_CONTACT "lemire@gmail.com")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "A header file for fast 32-bit division and remainders on 64-bit hardware.")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_RPM_PACKAGE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_SOURCE_GENERATOR "TGZ;ZIP")
include(CPack)