[CMake] using source files in build directory

Srinath Vadlamani srinath.vadlamani at gmail.com
Thu Oct 22 17:13:08 EDT 2015


Hello All,
  I am aware of out-of-source builds.  I want to add modified source files
to the out of source build directory and have CMake use these modified
files.

Below is my example:
$pwd
<source_dir>
$ls
CmakeLists.txt CMake README src tests doc ...
$mkdir build1
$cd build1
$cp ../src/file1.cpp .
$ <edit file1.ccp to make it so much better>
$ccmake <list of options> <source_dir>
$make -j N
$ <run executable and learn it does what I want but slowly>

Now I want to make another build directory that houses a few other modified
files:

$cd <source_dir>
$mkdir build2
$cd build2
$cp ../src/file1.cpp . && cp ../src/file2.cpp .
$<edit file1 and file2 to make them awesome and hopefully code runs fast>
$ccmake <list of options> <soruce_dir>
$make -j N
$<run executable and learn that build1 modification was better for file1
but file2 mods helped>


..... and so on.  The point is that the build directory allowing for
modified source files helps preserve executables and the dependent source
files for code management.  Some may now chime in with opinions on version
control usage, but I'm trying to understand if it is possible to do what I
described and is possible with Autotools.

Thank you for your time,
<>Srinath

=================================
Srinath Vadlamani
=================================

On Thu, Oct 22, 2015 at 3:02 PM, Gonzalo <ggarra13 at gmail.com> wrote:

> El 21/10/15 a las 17:45, Srinath Vadlamani escribió:
>
> Hello All,
>   Is it possible to have CMake use source files in some particular order
> that are placed in the out-of-source build directory?  This is allows for
> the convenience of having multiple builds in different build directories
> due to a few file changes while preserving the files themselves?
>
> You are aware that you can do out of source builds, right?
>
> $ mkdir build-linux64
> $ cd build-linux64
> $ cmake .. # plus any options you want
> $ make
>
> --
> Gonzalo Garramuñoggarra13 at gmail.com
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20151022/ce57e433/attachment.html>


More information about the CMake mailing list