On Dec 30, 2009, at 10:48 AM, Hicham Mouline wrote:

-----Original Message-----
From: John Drescher [mailto:dresche...@gmail.com]
Sent: 29 December 2009 23:16
To: Hicham Mouline
Cc: cmake@cmake.org
Subject: Re: [CMake] cmake file in build directory

On Tue, Dec 29, 2009 at 6:01 PM, Hicham Mouline <hic...@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,


Exactly how would that work? Exactly how is the "build specific cmake file" going to get into the build directory? So what happens if I try to build your project with a clean build directory? Does one have to hand create a file and place it in the build directory? Seems error prone.

You can always just set a cmake variable either through the CMake- GUI application or on the command line during the invocation of cmake:

cmake -DBOOST_ROOT=C:/boost/Boost-1_41 [path to source dir]

<opinion>NOT setting environment variables is just "fighting the system". I fought that for a while and since most Operating systems don't really have an agreed upon location to install 3rd party libraries, let alone consistent naming of those libraries you are just going to waste your own time having to constantly set the cmake variables. My solution on Windows was to setup my own ".bat" file that sets my own environment variables, then calls the vsvars32.bat to setup visual studio. That is linked to a "short cut" on the desktop to invoke the proper "Visual Studio Command Prompt" for either 32 or 64 bit compilations. The setup seems to work pretty good. </opinion>

--
Mike Jackson

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to