当前位置:网站首页>Cmake common command category notes
Cmake common command category notes
2022-06-22 02:11:00 【Leaves that go to bed early】
List of articles
1. Set the path of the header file
target_include_directories(Tutorial PUBLIC
"${PROJECT_BINARY_DIR}"
)
# Link header file path
target_include_directories(MathFunctions
INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}
)
2. Setup profile
configure_file(TutorialConfig.h.in TutorialConfig.h)
TutorialConfig.h.in :
// the configured options and settings for Tutorial
#define Tutorial_VERSION_MAJOR @[email protected]
#define Tutorial_VERSION_MINOR @[email protected]
Access profile :
if (argc < 2) {
// report version
std::cout << argv[0] << " Version " << Tutorial_VERSION_MAJOR << "."
<< Tutorial_VERSION_MINOR << std::endl;
std::cout << "Usage: " << argv[0] << " number" << std::endl;
return 1;
}
3. Set up c/c++ edition
# specify the C++ standard
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)
4. Compile instructions
cd Step1_build
cmake --build .
5. Link to third-party libraries
target_link_libraries(Tutorial PUBLIC MathFunctions)
add_library(hello::library ALIAS hello_library)
6. Macro control
# Set a variable
option(USE_MYMATH "Use tutorial provided math implementation" ON)
# Macro control
if(USE_MYMATH)
add_subdirectory(MathFunctions)
list(APPEND EXTRA_LIBS MathFunctions)
list(APPEND EXTRA_INCLUDES "${PROJECT_SOURCE_DIR}/MathFunctions")
endif()
# Set the number
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
7. Search for files
# Find all the source files in the directory
# And save the name to DIR_SRCS Variable
aux_source_directory(. DIR_SRCS)
aux_source_directory(<dir> <variable>)
8. Compile result type settings
# Specify generation MathFunctions Link library
add_library (MathFunctions ${DIR_LIB_SRCS})
9. Set a variable
set(SOURCES
src/Hello.cpp
src/main.cpp
)
# Add an executable with the above sources
add_executable(hello_headers ${SOURCES})
10. Print a message
# Print path to generated files
message ("PROTO_SRCS = ${PROTO_SRCS}")
message ("PROTO_HDRS = ${PROTO_HDRS}")
边栏推荐
- 带你区分几种并行
- acwing 837. Number of points in connected blocks (additional information maintained by querying sets - number of sets)
- Chapter 21 design of pavement crack detection and identification system -- matlab deep learning practice
- Qt程序怎么实现选中ListWidget中的某一行为默认选中
- Input system learning ----- inputfilter
- atguigu----列表渲染
- 说说你对接口测试的理解?
- Right alignment of MathType formula right number in word
- [phantom engine UE] package error appears! Solutions to findpin errors
- How to restore the IE browser auto jump edge
猜你喜欢

excel常用快捷键excel快捷键汇总

快速学会CAD绘制传输线路图纸

优秀的 Verilog/FPGA开源项目介绍(二十七)- 小型CPU

Pdf to word PDF to picture picture to PDF modifying PDF files is as convenient as operating word (Introduction to acrobat DC)

微信小程序影视评论交流平台系统毕业设计毕设(1)开发概要

1277_ Implementation analysis of vtaskdelay in FreeRTOS

Chapter 18 build a general video processing tool based on GUI matlab application GUI implementation

atguigu----列表渲染

pdf转word pdf转图片 图片转pdf 修改pdf文件就像操作Word一样方便(Acrobat DC使用介绍)
![[chapter 04 answer sheet recognition based on Hough change]](/img/2a/83ac4875ec7f61e28eb81175d35142.png)
[chapter 04 answer sheet recognition based on Hough change]
随机推荐
Ansible inventory host list
Appium面试题
Chapter 19 signal lamp image simulation control technology based on speech recognition
微信小程序影视评论交流平台系统毕业设计毕设(3)后台功能
微信小程序影视评论交流平台系统毕业设计毕设(7)中期检查报告
Minecraft 1.18.2 生化8 模组 1.3版本 物品3D化+更加复杂村庄
Intel history overview
软件测试工程师面试接口测试常见问题
LabVIEW开发发电厂合规性测试系统
Test APK exception control WiFi scan attacker development
Ansible Inventory 主机清单
New employees enter the company and learn about work information
latex关于&的报错问题及表格排版问题
【随笔】昨天研究了一天 RN 生态的 Expo 的确牛逼,从开发构建到部署一条龙,很好使。
Completion of graduation design of wechat small program film and television review and exchange platform system (5) assignment
微信小程序影视评论交流平台系统毕业设计毕设(8)毕业设计论文模板
Mba-day18 elimination method
Word document to markdown document?
Courses learned
光照相关 shader