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?)
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 .
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.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With