Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support building of single directories/files (flymake) #11

Open
Hextremist opened this issue Oct 1, 2015 · 3 comments
Open

Support building of single directories/files (flymake) #11

Hextremist opened this issue Oct 1, 2015 · 3 comments

Comments

@Hextremist
Copy link

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.

@alamaison
Copy link
Owner

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

@alamaison
Copy link
Owner

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

@gerddie
Copy link

gerddie commented Mar 31, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants