A CMake-based buildsystem is organized as a set of high-level logical targets. Each target corresponds to an executable or library, or is a custom target containing custom commands.
Run the cmake executable or the cmake-gui to configure the project and then build it with your chosen build tool. Run the install step by using the install option of the cmake command (introduced in 3.15, older versions of CMake must use make install ) from the command line, or build the INSTALL target from an IDE.
So, what is the real difference? CMake is much more high-level. It's tailored to compile C++, for which you write much less build code, but can be also used for general purpose build. make has some built-in C/C++ rules as well, but they are useless at best.
CMake is a meta build system that uses scripts called CMakeLists to generate build files for a specific environment (for example, makefiles on Unix machines). When you create a new CMake project in CLion, a CMakeLists. txt file is automatically generated under the project root.
I have a CMake build with a bunch of different targets A
, B
, C
, etc.
An external application is tasked with building, and currently does so by calling
cmake --build .
However, this builds all targets, and sometimes I only want to build a subset, like A
and B
but not C
.
The --target
flag can only be given once, and only accepts a single target.
I guess I could let CMake generate the appropriate Makefile, and then call make A B
explicitly, but that takes away the nice thing about cmake --build
being build system agnostic.
Is there a nice way to solve this?
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