Imported Upstream version 3.25.0
[platform/upstream/cmake.git] / Help / guide / tutorial / Step2 / CMakeLists.txt
1 cmake_minimum_required(VERSION 3.10)
2
3 # set the project name and version
4 project(Tutorial VERSION 1.0)
5
6 # specify the C++ standard
7 set(CMAKE_CXX_STANDARD 11)
8 set(CMAKE_CXX_STANDARD_REQUIRED True)
9
10 # TODO 7: Create a variable USE_MYMATH using option and set default to ON
11
12 # configure a header file to pass some of the CMake settings
13 # to the source code
14 configure_file(TutorialConfig.h.in TutorialConfig.h)
15
16 # TODO 8: Use list() and APPEND to create a list of optional libraries
17 # called  EXTRA_LIBS and a list of optional include directories called
18 # EXTRA_INCLUDES. Add the MathFunctions library and source directory to
19 # the appropriate lists.
20 #
21 # Only call add_subdirectory and only add MathFunctions specific values
22 # to EXTRA_LIBS and EXTRA_INCLUDES if USE_MYMATH is true.
23
24 # TODO 2: Use add_subdirectory() to add MathFunctions to this project
25
26 # add the executable
27 add_executable(Tutorial tutorial.cxx)
28
29 # TODO 9: Use EXTRA_LIBS instead of the MathFunctions specific values
30 # in target_link_libraries.
31
32 # TODO 3: Use target_link_libraries to link the library to our executable
33
34 # TODO 4: Add MathFunctions to Tutorial's target_include_directories()
35 # Hint: ${PROJECT_SOURCE_DIR} is a path to the project source. AKA This folder!
36
37 # TODO 10: Use EXTRA_INCLUDES instead of the MathFunctions specific values
38 # in target_include_directories.
39
40 # add the binary tree to the search path for include files
41 # so that we will find TutorialConfig.h
42 target_include_directories(Tutorial PUBLIC
43                            "${PROJECT_BINARY_DIR}"
44                            )