Cmake 实践PROJECT(HELLO) ADD_SUBDIRECTORY(src bin) 然后建立 build 目录,进入 build 目录进行外部编译。 cmake .. make 构建完成后,你会发现生成的目标文件 hello 位于 build/bin 目录中。 语法解释: ADD_SUBDIRECTORY 指令 ADD_SUBDIRECTORY(source_dir [binary_dir] 并且,即使外部编译,子目录体系仍然会被保存。 如果我们在上面的例子中将 ADD_SUBDIRECTORY (src bin)修改为 SUBDIRS(src)。 那么在 build 目录中将出现一个 src 目录,生成的目标代码 hello 将存放在 src 目录中。 3,换个地方保存目标二进制 不论是 SUBDIRS 还是 ADD_SUBDIRECTORY 指令(不论是否指定编译输出目录),我们都可 以通过 SET sh DESTINATION bin) 3,安装 doc 中的 hello.txt,这里有两种方式:一是通过在 doc 目录建立 CMakeLists.txt 并将 doc 目录通过 ADD_SUBDIRECTORY 加入工程来完成。另一种方法 是直接在工程目录通过 INSTALL(DIRECTORY 来完成),前者比较简单,各位可以根据兴趣自己完成,我们来尝试 后者,顺便演示以下 DIRECTORY0 码力 | 47 页 | 264.27 KB | 1 年前3
C++20 Modules: The Packaging and Binary Redistribution Storymechanical issue compilation terminated.BMI compatibility (cont’d) add_subdirectory(flux) add_subdirectory(fmt) add_subdirectory(argparse) add_library(foo) target_sources(foo PUBLIC FILE_SET0 码力 | 76 页 | 2.09 MB | 6 月前3
Debian 维护者指南cmake_minimum_required(VERSION 2.8) project(debhello) set(PACKAGE_AUTHOR "Osamu Aoki") add_subdirectory(src) add_subdirectory(man) $ cat debhello-1.7/man/CMakeLists.txt install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/hello cmake_minimum_required(VERSION 2.8) project(debhello) set(PACKAGE_AUTHOR "Osamu Aoki") add_subdirectory(lib) add_subdirectory(src) add_subdirectory(man) $ cat debhello-2.1/man/CMakeLists.txt install( FILES ${CMAKE_0 码力 | 142 页 | 1.11 MB | 1 年前3
Conan 1.16 Documentationmacro(conan_workspace_subdirectories) add_subdirectory(${PACKAGE_say_SRC} ${PACKAGE_say_BUILD}) add_subdirectory(${PACKAGE_hello_SRC} ${PACKAGE_hello_BUILD}) add_subdirectory(${PACKAGE_chat_SRC} ${PACKAGE_chat_BUILD})0 码力 | 545 页 | 4.34 MB | 1 年前3
Conan 1.13 Documentationmacro(conan_workspace_subdirectories) add_subdirectory(${PACKAGE_say_SRC} ${PACKAGE_say_BUILD}) add_subdirectory(${PACKAGE_hello_SRC} ${PACKAGE_hello_BUILD}) add_subdirectory(${PACKAGE_chat_SRC} ${PACKAGE_chat_BUILD})0 码力 | 518 页 | 4.14 MB | 1 年前3
Conan 1.14 Documentationmacro(conan_workspace_subdirectories) add_subdirectory(${PACKAGE_say_SRC} ${PACKAGE_say_BUILD}) add_subdirectory(${PACKAGE_hello_SRC} ${PACKAGE_hello_BUILD}) add_subdirectory(${PACKAGE_chat_SRC} ${PACKAGE_chat_BUILD})0 码力 | 528 页 | 4.17 MB | 1 年前3
Conan 1.15 Documentationmacro(conan_workspace_subdirectories) add_subdirectory(${PACKAGE_say_SRC} ${PACKAGE_say_BUILD}) add_subdirectory(${PACKAGE_hello_SRC} ${PACKAGE_hello_BUILD}) add_subdirectory(${PACKAGE_chat_SRC} ${PACKAGE_chat_BUILD})0 码力 | 540 页 | 4.22 MB | 1 年前3
Conan 1.17 Documentationmacro(conan_workspace_subdirectories) add_subdirectory(${PACKAGE_say_SRC} ${PACKAGE_say_BUILD}) add_subdirectory(${PACKAGE_hello_SRC} ${PACKAGE_hello_BUILD}) add_subdirectory(${PACKAGE_chat_SRC} ${PACKAGE_chat_BUILD})0 码力 | 567 页 | 4.53 MB | 1 年前3
Conan 1.18 Documentationmacro(conan_workspace_subdirectories) add_subdirectory(${PACKAGE_say_SRC} ${PACKAGE_say_BUILD}) add_subdirectory(${PACKAGE_hello_SRC} ${PACKAGE_hello_BUILD}) add_subdirectory(${PACKAGE_chat_SRC} ${PACKAGE_chat_BUILD})0 码力 | 584 页 | 4.80 MB | 1 年前3
Conan 1.19 Documentationmacro(conan_workspace_subdirectories) add_subdirectory(${PACKAGE_say_SRC} ${PACKAGE_say_BUILD}) add_subdirectory(${PACKAGE_hello_SRC} ${PACKAGE_hello_BUILD}) add_subdirectory(${PACKAGE_chat_SRC} ${PACKAGE_chat_BUILD})0 码力 | 609 页 | 4.88 MB | 1 年前3
共 67 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7













