开发者

Where should I put CMakeLists.txt files?

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜