mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-17 15:32:10 +08:00

* Update minimum required version to 3.10 * Use VERSION argument to project command rather than separate variables * Replace `endif(USE_MYMATH)` with more modern `endif()` * Simplify the call to 'configure_file()' * Add comments to tutorial.cxx to use as anchors in documentation * Remove CMakeLists and TutorialConfig.h.in files that users should create. Consequently, remove Step1 from CMake tests.
22 lines
615 B
CMake
22 lines
615 B
CMake
cmake_minimum_required(VERSION 3.10)
|
|
|
|
# set the project name and version
|
|
project(Tutorial VERSION 1.0)
|
|
|
|
# specify the C++ standard
|
|
set(CMAKE_CXX_STANDARD 11)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED True)
|
|
|
|
# configure a header file to pass some of the CMake settings
|
|
# to the source code
|
|
configure_file(TutorialConfig.h.in TutorialConfig.h)
|
|
|
|
# add the executable
|
|
add_executable(Tutorial tutorial.cxx)
|
|
|
|
# add the binary tree to the search path for include files
|
|
# so that we will find TutorialConfig.h
|
|
target_include_directories(Tutorial PUBLIC
|
|
"${PROJECT_BINARY_DIR}"
|
|
)
|