-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
71 lines (55 loc) · 2.01 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
61
62
63
64
65
66
67
68
69
70
71
cmake_minimum_required(VERSION 3.12...3.27)
project(fastprimes
DESCRIPTION "Fast small primes generator"
LANGUAGES CXX
)
include(AICxxProject)
#==============================================================================
# OPTIONS
# Set a default value for OptionFastPrimesCompression.
set(OptionFastPrimesCompression "6" CACHE STRING "Compession level of Primes (3 - 6). Default: 6")
message(DEBUG "OptionFastPrimesCompression is ${OptionFastPrimesCompression}")
set(CW_FASTPRIMES_COMPRESSION ${OptionFastPrimesCompression})
#==============================================================================
# PLATFORM SPECIFIC CHECKS
#
# Specify fastprimes specific configure file.
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in
${CMAKE_CURRENT_BINARY_DIR}/config.h
@ONLY)
#==============================================================================
# BUILD OBJECT LIBRARY
#
# This project is an OBJECT-library, used by other git submodules and the main project.
add_library(fastprimes_ObjLib OBJECT)
# Tell cwds/sys.h that we have a config.h.
target_compile_definitions(fastprimes_ObjLib
PUBLIC
HAVE_FASTPRIMES_CONFIG_H
)
# The list of source files.
target_sources(fastprimes_ObjLib
PRIVATE
"Primes.cxx"
"Primes.h"
)
# Required include search-paths.
get_target_property(CWDS_INTERFACE_INCLUDE_DIRECTORIES AICxx::cwds INTERFACE_INCLUDE_DIRECTORIES)
target_include_directories(fastprimes_ObjLib
PUBLIC
"${CWDS_INTERFACE_INCLUDE_DIRECTORIES}" # For sys.h and debug.h.
"${top_objdir}" # For fastprimes/config.h.
)
# Require support for C++20.
target_compile_features(fastprimes_ObjLib
PUBLIC cxx_std_20
)
# Set link dependencies.
target_link_libraries(fastprimes_ObjLib
PUBLIC
AICxx::utils
)
# Create an ALIAS target.
add_library(AICxx::fastprimes ALIAS fastprimes_ObjLib)
# Prepend this object library to the list.
set(AICXX_OBJECTS_LIST AICxx::fastprimes ${AICXX_OBJECTS_LIST} CACHE INTERNAL "List of OBJECT libaries that this project uses.")