Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Where should I put CMakeLists.txt files?

Tags:

c

build

cmake

We would like 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?)

like image 865
Cartesius00 Avatar asked Oct 02 '11 22:10

Cartesius00


People also ask

Where do I put CMake files?

static libraries - ``ARCHIVE`` This tells CMake that the RUNTIME file (. dll) should be installed to bin , the LIBRARY file (. so) should be installed to lib , and the ARCHIVE (. lib) file should be installed to lib/myproject .

What does CMakeLists TXT file in a ROS package contain?

The file CMakeLists. txt is the input to the CMake build system for building software packages. Any CMake-compliant package contains one or more CMakeLists. txt file that describe how to build the code and where to install it to.

How do I create a project using CMakeLists txt?

In Qt Creator, go to File → Open File or Project… and choose CMakeLists. txt from the source folder you want to build. Qt Creator will prompt you for the location of the binary folder, calling it the “build directory”. By default, it suggests a path adjacent to the source folder.


1 Answers

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.

like image 114
able Avatar answered Oct 09 '22 02:10

able