Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Help/guide/tutorial/Step8/CMakeLists.txt
5017 views
1
cmake_minimum_required(VERSION 3.23)
2
3
project(Tutorial)
4
5
option(TUTORIAL_BUILD_UTILITIES "Build the Tutorial executable" ON)
6
option(TUTORIAL_USE_STD_SQRT "Use std::sqrt" OFF)
7
option(TUTORIAL_ENABLE_IPO "Check for and use IPO support" ON)
8
9
# TODO6: Add a default-ON option named BUILD_TESTING with a doc string of:
10
# "Enable testing and build tests"
11
12
if(TUTORIAL_ENABLE_IPO)
13
include(CheckIPOSupported)
14
check_ipo_supported(RESULT result OUTPUT output)
15
if(result)
16
message("IPO is supported, enabling IPO")
17
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
18
else()
19
message(WARNING "IPO is not supported: ${output}")
20
endif()
21
endif()
22
23
if(TUTORIAL_BUILD_UTILITIES)
24
add_subdirectory(Tutorial)
25
endif()
26
27
# TODO7: Conditional on the value of BUILD_TESTING, enable testing and add the
28
# Tests subdirectory to the project
29
30
add_subdirectory(MathFunctions)
31
32