# to the source codeconfigure_file("${PROJECT_SOURCE_DIR}/TutorialConfig.h.in""${PROJECT_BINARY_DIR}/TutorialConfig.h")# add the binary tree to the search pathforinclude files # so that we will find TutorialConfig.hinclude_directories("${PROJECT_BINARY_DIR}")# add the executableadd_exec...
Note that this example uses lower case commands in the CMakeLists.txt file.Upper, lower, and mixed case commands are supported by CMake.The source code for tutorial.cxx will compute the square root of a number and the first version of it is very simple, as follows: //A simple program ...
# The version number.set (Tutorial_VERSION_MAJOR 1) set (Tutorial_VERSION_MINOR 0)# configure a header file to pass some of the CMake settings # to the source code configure_file ( "${PROJECT_SOURCE_DIR}/config.h.in" "${PROJECT_BINARY_DIR}/config.h" ) # add the binary tree to ...
cmake_minimum_required (VERSION 2.6) project (Tutorial) add_executable(Tutorial tutorial.cxx) Note that this example uses lower case commands in the CMakeLists.txt file. Upper, lower, and mixed case commands are supported by CMake. The source code for tutorial.cxx will compute the square roo...
参考:https://cmake.org/cmake-tutorial/ 对应代码:02-TutorialThe first feature we will add is to provide our executable and project with a version number. While you can do this exclusively in the source code, doing it in the CMakeLists.txt file provides more flexibility. To add a version...
project(Tutorial VERSION 1.0) # specify the C++ standard set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_STANDARD_REQUIRED True) 构建和测试 跑过cmake可执行文件或cmake-gui配置项目,然后使用您选择的构建工具构建它。 例如,从命令行我们可以导航到Help/guide/tutorial「CMake」源代码树的目录并创建一个构建目录...
The source code is located under the src directory, with each project having its own sub-directory. There is also an include directory, on the same level with src. CMakeLists.txt scripts need to be created in each of the src subfolders, as well as in the root. cmakedemo/ ├── inc...
cmake_minimum_required(VERSION 3.5) project(demo11) # The version number set(demo11_VERSION_MAJOR 1) set(demo11_VERSION_MINOR 0) # configure a header file to pass some of the CMake settings to # source code(demo11Config.h.in), the file demoConfig.h does't exists configure_file( "...
The source code of the sample project shown below is available on GitHub. 1. Simple CMake project CMake is a meta build system that uses scripts called CMakeLists to generate build files for a specific environment (for example, makefiles on Unix machines). When you create a new CMake...
message(STATUS ${Tutorial_BINARY_DIR}) # The version number. set (Tutorial_VERSION_MAJOR 1) set (Tutorial_VERSION_MINOR 0) # configure a header file to pass some of the CMake settings to the source code configure_file ( "${PROJECT_SOURCE_DIR}/" ...