emacs-cmake-project
emacs-cmake-project copied to clipboard
Support building of single directories/files (flymake)
Hi, CMake does support building a single directory or file, at least when generating makefiles.
If you are building out of tree:
cd build/src make
this builds the current subtree
cd build/src make main.o
this builds the file main.c[c]
So it would be nice to have this supported.
Do you know how to pass the desired subdirectory to cmake --build
? Or even if it's possible? That command is mostly undocumented.
It may be that the behaviour you are seeing is a feature of make, not of CMake
With the makefile generator it is possible to run from the build-root directory:
cmake --build <subdirectory> --target <c/c++file>.o
(and the --target part is optional). However, with the ninja generator this is not possible. Here one would have to do
cmake --build . --target
This, however does not work with make.
From this behaviour it is my impression that cmake --build changes to the directory given with the --build command line parameter, and then invokes the build command with the given target. Since ninja.build is only created in the build-root directory it can not be run from a subdirectory.