[CMake] Select external projects build target at build time

Eric Huhtala eric.huhtala at gmail.com
Thu Nov 13 10:26:30 EST 2014


Hello,

I have an external project which I'd like to build a different way
depending on the main project's build target (normal case is not to build
"all").

e.g., I'd like
"make build-A" to invoke "cmake --build ${EXTERNAL} --target build-A"
"make build-B" to invoke "cmake --build ${EXTERNAL} --target build-B"

in general "make X" -> "build X" would be fine.

Is there a way I can do this directly?

Should I generate N different external projects, each with a different
source directory, but the same binary directory, and explicitly set the
build target in the external project build step?  Is that supposed to work?

Is there a better way to get what I want?

The reason I want to not build all is to save on build time, but build-A
and build-B share quite a bit of work, so in the semi-rare case I *do* want
to build all, I'd like that to need the least amount of time as well.

Thanks,
Eric
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20141113/c7b470fa/attachment.html>


More information about the CMake mailing list