cmake语法 CMake学习笔记(二)——CMake语法_琦小虾的代码世界-优快云博客_cmake语法
项目举例 CMake学习笔记(三)——以笔者的Robosub竞赛为例_琦小虾的代码世界-优快云博客

① add_library 将指定的cpp源文件生成库文件(.a, .so),然后添加到工程中去。

② link_directories 指定要链接的库文件(.a, .so)的路径,该指令有时候不一定需要。

③ target_link_libraries 将目标文件与库文件(.a, .so)进行链接。

从根目录向下逐层讲解:
1. 根目录/CMakeLists.txt
此处根目录为IPCSocket。该目录下的CMakeLists.txt如下:

下面按照ADD_SUBDIRECTORY的顺序进行说明。
2. /CustomizeFunctions/CMakeLists.txt


即进入./GeneralImageProcess, ./SupportFunctions继续寻找CMakeLists.txt。
(1) /CustomizeFunctions/GeneralImageProcess/CMakeLists.txt

(2) /CustomizeFunctions/SupportFunctions/CMakeLists.txt


3. /NCFunctions/CMakeLists.txt


进入./NCServer ./NCClient ./NCStage继续寻找CMakeLists.txt文件。
(1) /NCFunctions/NCStage/CMakeLists.txt


(2) /NCFunctions/NCClient/CMakeLists.txt


(3) /NCFunctions/NCServer/CMakeLists.txt


4. /IPCClients/CMakeLists.txt


5. /IPCServer/CMakeLists.txt



726

被折叠的 条评论
为什么被折叠?



