emacs-cmake-project icon indicating copy to clipboard operation
emacs-cmake-project copied to clipboard

Support building of single directories/files (flymake)

Open Hextremist opened this issue 8 years ago • 3 comments

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.

Hextremist avatar Oct 01 '15 04:10 Hextremist

Do you know how to pass the desired subdirectory to cmake --build? Or even if it's possible? That command is mostly undocumented.

alamaison avatar Dec 26 '15 19:12 alamaison

It may be that the behaviour you are seeing is a feature of make, not of CMake

alamaison avatar Dec 26 '15 19:12 alamaison

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 CMakeFiles/???>.dir/<c/c++file>.o

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.

gerddie avatar Mar 31 '17 10:03 gerddie