Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Kitware
GitHub Repository: Kitware/CMake
Path: blob/master/Help/guide/tutorial/Step9/CMakeLists.txt
5018 views
1
cmake_minimum_required(VERSION 3.23)
2
3
# TODO9: Add a VERSION parameter to the project() command for version 1.0.0
4
project(Tutorial)
5
6
option(TUTORIAL_BUILD_UTILITIES "Build the Tutorial executable" ON)
7
option(TUTORIAL_USE_STD_SQRT "Use std::sqrt" OFF)
8
option(TUTORIAL_ENABLE_IPO "Check for and use IPO support" ON)
9
option(BUILD_TESTING "Enable testing and build tests" ON)
10
11
if(TUTORIAL_ENABLE_IPO)
12
include(CheckIPOSupported)
13
check_ipo_supported(RESULT result OUTPUT output)
14
if(result)
15
message("IPO is supported, enabling IPO")
16
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
17
else()
18
message(WARNING "IPO is not supported: ${output}")
19
endif()
20
endif()
21
22
if(TUTORIAL_BUILD_UTILITIES)
23
add_subdirectory(Tutorial)
24
# TODO1: Install the Tutorial target
25
26
# TODO3: Add the Tutorial target to the TutorialTargets export
27
endif()
28
29
if(BUILD_TESTING)
30
enable_testing()
31
add_subdirectory(Tests)
32
endif()
33
34
add_subdirectory(MathFunctions)
35
36
# TODO4: Include the GNUInstallDirs module
37
38
# TODO2: Install the MathFunctions, OpAdd, OpMul, OpSub, SqrtTable, and
39
# MathLogger targets. Ensure you name their header file set so the
40
# headers will be installed.
41
42
# TODO5: Add the targets from TODO2 to the TutorialTargets export
43
44
# TODO6: Install the TutorialTargets export to:
45
# ${CMAKE_INSTALL_LIBDIR}/cmake/Tutorial
46
# And give them a namespace of "Tutorial::"
47
48
# TODO10: Include CMakePackageConfigHelpers
49
50
# TODO11: Use write_basic_package_version_file to write a
51
# TutorialConfigVersion.cmake file to the CMAKE_CURRENT_BINARY_DIR.
52
# The version compatibility should be ExactVersion.
53
54
# TODO12: Add the generated TutorialConfigVersion.cmake file to the file list
55
# of the TODO7 install() command.
56
57
# TODO7: Install the config file at cmake/TutorialConfig.cmake to the same
58
# destination as the TutorialTargets export.
59
60