[CMake] in source makefile / helper script that enables building out of source?

Ruslan Baratov ruslan_baratov at yahoo.com
Sat May 14 07:20:21 EDT 2016


On 11-May-16 16:58, Steve Lorimer wrote:
> I've recently changed over from using boost-build 
> (http://www.boost.org/build/) to cmake.
>
> Boost build builds in-source.
>
> I've become quite used to building and searching etc from the source root
>
>     ~/src $ b2 module
>     ~/src $ git grep foo
>
>
> This work flow has been broken because I'm not using out of source builds
>
>     ~/src/build $ make module
>     ~/src/build $ git grep... dang it! <ctrl-c>
>     ~/src/build $ cd ..
>     ~/src $ git grep foo
>     ~/src $ make modu... dang it! <ctrl-c>
>     ~/src $ cd build
>     ~/src/build $ make module
>
> I can't be the only one who wants to have the benefit of out of source 
> builds and be able to build from in-source.
Will `-C` help?

~/src $ make -C build module

or in cross-platform fashion:

~/src $ cmake --build build
~/src $ cmake --build build --target foo --config Debug

Ruslo
>
> I imagine it would be relatively simple to create a makefile which 
> navigates to a known build directory (eg: build or debug or...), 
> executes make there, and then changes directory back to where it was 
> called from.
>
> Before I do just this, I thought it better to try leverage the open 
> source community - hence asking the question.
>
> Does anyone have a script or makefile which does just this?
>
> TIA
> Steve
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20160514/8fe9c51e/attachment.html>


More information about the CMake mailing list