CMAKELISTS.txt最简单的用法

Exercise 1 - Building a Basic Project

The most basic CMake project is an executable built from a single source code file. For simple projects like this, a CMakeLists.txt file with three commands is all that is required.

Any project's top most CMakeLists.txt must start by specifying a minimum CMake version using the cmake_minimum_required() command. This establishes policy settings and ensures that the following CMake functions are run with a compatible version of CMake.

To start a project, we use the project() command to set the project name. This call is required with every project and should be called soon after cmake_minimum_required(). As we will see later, this command can also be used to specify other project level information such as the language or version number.

Finally, the add_executable() command tells CMake to create an executable using the specified source code files.

综上所述,这个最简单的文件是这个样子的;

cmake_minimum_required(1.0)

project(${PROJECT_NAME})

add_executable(  编译后的exe文件名称  源文件完整地址)

你可能感兴趣的:(cmake,ros2,ubuntu)