[CMake] how to set current source directory relative to external project

hex hex7c3 at gmail.com
Tue Jul 9 17:53:47 EDT 2019


I don't know what sorts of files those are; they don't exist but they 
get created, they're not tracked, and not installed...

They sounds like a build product, which is a target, (even it it's just 
part of a product, it's still a target)

Exactly, these are mostly BYPRODUCTS, but also OUTPUT of build commands, 
i.e. targets.



>     Another thing I noticed is that my CMAKE_GENERATOR are now buried
>     in subfolders. To change that I set PREFIX
>     "${CMAKE_BINARY_DIR}/workspaces". Now all external projects are
>     using the same prefix and are therefore generated into the same
>     directory 'workspaces'.
>
> right ?

Except for my generators, and I think I wasn't clear enough about this 
part. I am using -G"Eclipse 2 - Unix Makefiles" for each external 
project. Note that this leaves me with a Makefile for the "super build" 
containing *all* targets of all projects. It *additionally* creates a 
Makefile for each external project individually. So I can do stuff like:

/*cd build/ && make* # /to build the entire project or

*/cd build/workspaces/src/ext1-build/ && make/* # to build a specific 
external project, /ext1./


This is what I am after -> a multi-workspace super build. By workspace 
here I mean an eclipse workspace, the terminology does not exist in 
CMake. Note that each project has its own root binary path, meaning that

${CMAKE_BINARY_DIR} = build # for super build

and

${CMAKE_BINARY_DIR} = build/workspaces/src/ext1-build # for external 
project ext1


${CMAKE_CURRENT_BINARY_DIR} is then relative to any of either 
${CMAKE_BINARY_DIR}'s.



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20190709/81d4701f/attachment.html>


More information about the CMake mailing list