zoukankan      html  css  js  c++  java
  • cmake语法学习

    Before diving into the code, here is the folders structure.

    ├── CMakeLists.txt [ Top most ]
    ├── subbinary
    │   ├── CMakeLists.txt [ subbinary ]
    │   └── main.cpp
    ├── sublibrary1
    │   ├── CMakeLists.txtsublibrary1 ]
    │   ├── include
    │   │   └── sublib1
    │   │   └── sublib1.h
    │   └── src
    │   └── sublib1.cpp
    └── sublibrary2
    ├── CMakeLists.txtsublibrary2 ]
    └── include
    └── sublib2
    └── sublib2.h

    *

    CMakeLists.txt [ subbinary ]

    To generate an execuatable. we have discussed before.

    *

    CMakeLists.txtsublibrary1 ]

    To generate an library. we have discussed before.

    *

    CMakeLists.txtsublibrary2 ]

    To generate an library. we have discussed before.

    ├── CMakeLists.txt [ Top most ]

    cmake_minimum_required (VERSION 3.5)
    
    project(subprojects)
    
    # Add sub directories
    add_subdirectory(sublibrary1)
    add_subdirectory(sublibrary2)
    add_subdirectory(subbinary)

    *

    add_subdirectory(sublibrary1)

    - sublibrary1 is the folder name. Even though we have a folder named "sublibrary1" here, there are totally 2 different things.

    - Question 1 :  Where to create the folder?

    Answer 1 : Most of us will "mkdir build", "cd build" and "cmake ..", so the absolute folder path will be "......./build/sublibrary1" .

    - Question 2 :What will the function do?

    Answer 2 : As far as I know,

    ------------- 1 Create a sub-folder in building folder;

    ------------- 2 Link the CMakelist.txt in "sublibrary1"; So you can not pass a arbitrary folder name here.

    That is all.

  • 相关阅读:
    转 sql 时间转换格式 convert(varchar(10),字段名,转换格式)
    C#页面添加提交数据后跳出小弹窗的功能
    解决粘包问题
    粘包问题
    模拟ssh远程执行命令
    基于TCP协议的socket套接字编程
    Linux和git使用
    osi七层协议
    TCP协议的三次握手和四次挥手
    C/S 和 B/S架构
  • 原文地址:https://www.cnblogs.com/alexYuin/p/12778536.html
Copyright © 2011-2022 走看看