开发者

Where should I put CMakeLists.txt files?

开发者 https://www.devze.com 2023-04-10 18:16 出处:网络
We would lik开发者_JAVA技巧e to develop a few dynamically-linked libraries in C, each for both Linux and Windows. We would like to use CMake.

We would lik开发者_JAVA技巧e to develop a few dynamically-linked libraries in C, each for both Linux and Windows. We would like to use CMake.

How do we organize directories and where do we put those CMakeLists.txt files? (Or should we have just one?)


There is no single way that it must be done, but here is one possible way:

CMakeLists.txt
src/
    CMakeLists.txt
    lib1/
        CMakeLists.txt
        lib1.c
    lib2/
        CMakeLists.txt
        lib2.c
    app/
        CMakeLists.txt
        app.c
include/
    lib1.h
    lib2.h

While you can do everything in the top-level CMakeLists.txt file, it will get large and messy very quickly if your project is complex.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号