Cmake 实践
3,问题,难道就没有问题? 1,cmake 很简单,但绝对没有听起来或者想象中那么简单。 2,cmake 编写的过程实际上是编程的过程,跟以前使用 autotools 一样,不过你需要编 写的是 CMakeLists.txt(每个目录一个) ” ,使用的是 cmake ” 语言和语法 。 3,cmake 跟已有体系的配合并不是特别理想,比如 pkgconfig,您在实际使用中会有所 体会,虽然有一些扩展可以使用,但并不理想。 t1 在 t1 目录建立 main.c 和 CMakeLists.txt(注意文件名大小写): main.c 文件内容: //main.c #includeint main() { printf(“Hello World from t1 Main!\n”); return 0; } CmakeLists.txt 文件内容: PROJECT (HELLO) "${HELLO_SOURCE_DIR}) ADD_EXECUTABLE(hello SRC_LIST) 2,开始构建 所有的文件创建完成后,t1 目录中应该存在 main.c 和 CMakeLists.txt 两个文件 接下来我们来构建这个工程,在这个目录运行: cmake . (注意命令后面的点号,代表本目录)。 输出大概是这个样子: -- Check for working C compiler: 0 码力 | 47 页 | 264.27 KB | 1 年前3Conan 2.0 Documentation
CMakeDeps and CMakeToolchain that are fully transparent CMake integration (i.e. the consuming CMakeLists.txt doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE with this structure: 17 Conan Documentation, Release 2.0.17 . CMakeLists.txt src main.c This project contains a basic CMakeLists.txt including the zlib dependency and the source code for the string VERSION: %s\n", zlibVersion()); return EXIT_SUCCESS; } Also, the contents of CMakeLists.txt are: Listing 2: CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(compressor C) (continues on next0 码力 | 652 页 | 4.00 MB | 1 年前3Conan 2.1 Documentation
CMakeDeps and CMakeToolchain that are fully transparent CMake integration (i.e. the consuming CMakeLists.txt doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE with this structure: 19 Conan Documentation, Release 2.1.0 . CMakeLists.txt src main.c This project contains a basic CMakeLists.txt including the zlib dependency and the source code for the string VERSION: %s\n", zlibVersion()); return EXIT_SUCCESS; } Also, the contents of CMakeLists.txt are: Listing 2: CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(compressor C) (continues on next0 码力 | 694 页 | 4.13 MB | 1 年前3Conan 2.10 Documentation
CMakeDeps and CMakeToolchain that are fully transparent CMake integration (i.e. the consuming CMakeLists.txt doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE with this structure: 19 Conan Documentation, Release 2.10.1 . CMakeLists.txt src main.c This project contains a basic CMakeLists.txt including the zlib dependency and the source code for the string VERSION: %s\n", zlibVersion()); return EXIT_SUCCESS; } Also, the contents of CMakeLists.txt are: Listing 2: CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(compressor C) (continues on next0 码力 | 803 页 | 5.02 MB | 10 月前3Conan 2.9 Documentation
CMakeDeps and CMakeToolchain that are fully transparent CMake integration (i.e. the consuming CMakeLists.txt doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE with this structure: 19 Conan Documentation, Release 2.9.3 . CMakeLists.txt src main.c This project contains a basic CMakeLists.txt including the zlib dependency and the source code for the string VERSION: %s\n", zlibVersion()); return EXIT_SUCCESS; } Also, the contents of CMakeLists.txt are: Listing 2: CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(compressor C) (continues on next0 码力 | 795 页 | 4.99 MB | 10 月前3Conan 2.3 Documentation
CMakeDeps and CMakeToolchain that are fully transparent CMake integration (i.e. the consuming CMakeLists.txt doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE with this structure: 19 Conan Documentation, Release 2.3.2 . CMakeLists.txt src main.c This project contains a basic CMakeLists.txt including the zlib dependency and the source code for the string VERSION: %s\n", zlibVersion()); return EXIT_SUCCESS; } Also, the contents of CMakeLists.txt are: Listing 2: CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(compressor C) (continues on next0 码力 | 748 页 | 4.65 MB | 1 年前3Conan 2.5 Documentation
CMakeDeps and CMakeToolchain that are fully transparent CMake integration (i.e. the consuming CMakeLists.txt doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE with this structure: 19 Conan Documentation, Release 2.5.0 . CMakeLists.txt src main.c This project contains a basic CMakeLists.txt including the zlib dependency and the source code for the string VERSION: %s\n", zlibVersion()); return EXIT_SUCCESS; } Also, the contents of CMakeLists.txt are: Listing 2: CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(compressor C) (continues on next0 码力 | 769 页 | 4.70 MB | 1 年前3Conan 2.4 Documentation
CMakeDeps and CMakeToolchain that are fully transparent CMake integration (i.e. the consuming CMakeLists.txt doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE with this structure: 19 Conan Documentation, Release 2.4.1 . CMakeLists.txt src main.c This project contains a basic CMakeLists.txt including the zlib dependency and the source code for the string VERSION: %s\n", zlibVersion()); return EXIT_SUCCESS; } Also, the contents of CMakeLists.txt are: Listing 2: CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(compressor C) (continues on next0 码力 | 769 页 | 4.69 MB | 1 年前3Conan 2.2 Documentation
CMakeDeps and CMakeToolchain that are fully transparent CMake integration (i.e. the consuming CMakeLists.txt doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE with this structure: 19 Conan Documentation, Release 2.2.3 . CMakeLists.txt src main.c This project contains a basic CMakeLists.txt including the zlib dependency and the source code for the string VERSION: %s\n", zlibVersion()); return EXIT_SUCCESS; } Also, the contents of CMakeLists.txt are: Listing 2: CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(compressor C) (continues on next0 码力 | 718 页 | 4.46 MB | 1 年前3Conan 2.7 Documentation
CMakeDeps and CMakeToolchain that are fully transparent CMake integration (i.e. the consuming CMakeLists.txt doesn’t need to be aware at all about Conan). These integrations can also achieve a better IDE with this structure: 19 Conan Documentation, Release 2.7.1 . CMakeLists.txt src main.c This project contains a basic CMakeLists.txt including the zlib dependency and the source code for the string VERSION: %s\n", zlibVersion()); return EXIT_SUCCESS; } Also, the contents of CMakeLists.txt are: Listing 2: CMakeLists.txt cmake_minimum_required(VERSION 3.15) project(compressor C) (continues on next0 码力 | 779 页 | 4.93 MB | 10 月前3
共 114 条
- 1
- 2
- 3
- 4
- 5
- 6
- 12