Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Help/guide/tutorial/Step7/MathFunctions/CMakeLists.txt
5018 views
1
add_library(MathFunctions)
2
3
target_sources(MathFunctions
4
PRIVATE
5
MathFunctions.cxx
6
7
PUBLIC
8
FILE_SET HEADERS
9
FILES
10
MathFunctions.h
11
)
12
13
# TODO8: Add the interface library to MathFunctions
14
target_link_libraries(MathFunctions
15
PRIVATE
16
MathLogger
17
18
PUBLIC
19
OpAdd
20
OpMul
21
OpSub
22
)
23
24
target_compile_features(MathFunctions PRIVATE cxx_std_20)
25
26
if(TUTORIAL_USE_STD_SQRT)
27
target_compile_definitions(MathFunctions PRIVATE TUTORIAL_USE_STD_SQRT)
28
endif()
29
30
include(CheckIncludeFiles)
31
check_include_files(emmintrin.h HAS_EMMINTRIN LANGUAGE CXX)
32
33
if(HAS_EMMINTRIN)
34
target_compile_definitions(MathFunctions PRIVATE TUTORIAL_USE_SSE2)
35
endif()
36
37
include(CheckSourceCompiles)
38
check_source_compiles(CXX
39
[=[
40
typedef double v2df __attribute__((vector_size(16)));
41
int main() {
42
__builtin_ia32_sqrtsd(v2df{});
43
}
44
]=]
45
HAS_GNU_BUILTIN
46
)
47
48
if(HAS_GNU_BUILTIN)
49
target_compile_definitions(MathFunctions PRIVATE TUTORIAL_USE_GNU_BUILTIN)
50
endif()
51
52
add_subdirectory(MathLogger)
53
add_subdirectory(MathExtensions)
54
# TODO9: Add the MakeTable subdirectory to the project
55
56