[CMake] cmake file in build directory

Hicham Mouline hicham at mouline.org
Wed Dec 30 10:48:39 EST 2009


> -----Original Message-----
> From: John Drescher [mailto:drescherjm at gmail.com]
> Sent: 29 December 2009 23:16
> To: Hicham Mouline
> Cc: cmake at cmake.org
> Subject: Re: [CMake] cmake file in build directory
> 
> On Tue, Dec 29, 2009 at 6:01 PM, Hicham Mouline <hicham at mouline.org>
wrote:
> > Hello,
> >
> > I am writing software that uses boost and Qt and other 3rd party
libraries
> for win/mingw, win/msvc2008 and linux/gcc.
> > The location of the 3rd party header files is different on each of the
boxes
> I compile on.
> >
> > Is there a file to put in the build directory? Is such a file
automatically
> read by cmake, or does it need to be included explicitly by the source dir
> CMakeLists.txt?
> >
> > Does one call the find modules explicitly? or just define for e..g
BOOSTROOT
> ?
> >
> 
> I call finders in my master CMakeLists.txt file and do not put any
> files in any of the build trees for any of the compilers I use.
> 
> On windows (because there is no standard library install location) a
> lot of times this means I need to either manually find the
> dependencies when I run cmake-gui or define BOOST_ROOT, ITK_DIR ... in
> my environment variables.
> 
> John

Thanks,
But I lean towards keeping all the info required to build the software
outside of env variables, so I think I'll be able to include a
build-specific cmake file from the build directory and set the BOOST_ROOT
there instead.

That way, on boxes 1, 2 and 3, with BOOST_ROOT set appropriately on each
box, the source tree doesn't need to change.

My top level CMakeLists.txt looks like:

CMAKE_REQUIRED_MINIMUM...

PROJECT(...)

### here I would include the build dir's cmake file
### this would help the Findxxx to find where the libraries reside as they
don't reside in default directories

### set up platform/compiler specific flags by 
### including various cmake files in the source tree

ADD_SUBDIRECTORY.... #for each subdir

Rds,



More information about the CMake mailing list