• cmake 示例1


    这个是自己写的一个测试用例:

    目录树:

    CMakeLists.txt

    build/

    include/

        |__say.h

    lib

       |__say.c 

       |__CMakeLists.txt

    src

       |__CMakeLists.txt

       |__hello.c

     具体代码:

    ./CMakeLists.txt

    project(h)
    add_subdirectory(src)
    add_subdirectory(lib)

    ./bin/CMakeList.txt
    include_directories(../include)
    add_library(sayhello say.c)
    ./src/CMakeList.txt
    include_directory(../include)
    add_executable(hello hello.c)
    target_link_libraries(hello sayhello)

    到build下,
    cmake ..
    make
    则生成bin和src
    src下有hello程序
    bin下有libsayhello.a


    每天早上叫醒你的不是闹钟,而是心中的梦~
  • 相关阅读:
    GIT相关学习网站
    【转】一些软件设计的原则
    c语言(14)
    c语言(13)
    c语言(12)
    c语言(11)
    c语言(十)
    c语言(九)
    c语言(八)
    c语言(七)
  • 原文地址:https://www.cnblogs.com/vintion/p/4117072.html
Copyright © 2020-2023  润新知