[Cmake] out-of-source build

Brad King brad . king at kitware . com
Fri, 5 Sep 2003 16:19:13 -0400 (EDT)


> I'm trying to use cmake to compile several applications and libraries.
>
> My question is what is the best way to work with out-of-source build
> to direct *.o files to other directories, preferably where the binary
> is created. To be specific, I want to build foo-a and foo-b with distinct
> compiler options and to avoid to having *.o files mixed with source files.
>
> foo-a/
> subdir1/
> subdir2/
> foo-b/
> subdir1/
> subdir2/

Just create an emptry directory for use as the build tree anywhere on your
disk, make it the current working directory, and run cmake with the path
to the source tree as an argument:

mkdir foo-a; cd foo-a
cmake ../foo
make

-Brad