Re: [CMake] adding dependencies on all targets to force CMake to rerun itself

2007-10-10 Thread Alan W. Irwin

On 2007-10-10 12:40-0400 Philip Lowman wrote:


Hi,

I have a text file that is read in via a CMake macro that dynamically
adjusts the include paths, preprocessor definitions, and link
directives.  CMake automatically rebuilds the code as needed which is
wonderful.

One issue I haven't solved yet is modification of this text file doesn't
force CMake to run itself again.  I was wondering if anyone would have
any ideas how to do this.

Basically I have something like this but I want all targets in the build
to depend on changes to foo.txt so that CMake runs itself again.

MACRO(Foo)
FILE(READ ${PROJECT_SOURCE_DIR}/foo.txt contents)
... define variables for include path, directory recursion,
   etc., that get used later
ENDMACRO(Foo)


It appears you are
reading the file to define variables for include path, directory recursion,
etc., that get used later.  Why not simply do that task using CMake
instructions that are INCLUDEd from a file?

For example,

SET (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
INCLUDE (plplot)

That second command looks for
${PROJECT_SOURCE_DIR}/cmake/modules/plplot.cmake and includes the lines in
that file just like those lines were part of the current (usually top-level)
CMakeLists.txt file.  The INCLUDE command can be nested so we have something
like 60 *.cmake files in our cmake/modules directory.  That keeps everything
well organized and also keeps our top-level CMakeLists.txt file relatively
small. A change to any of these files which are INCLUDEd (either directly or
through nesting) in our top-level CMakeLists.txt file means that cmake is
automatically rerun which I believe is exactly what you want.

Alan
__
Alan W. Irwin

Astronomical research affiliation with Department of Physics and Astronomy,
University of Victoria (astrowww.phys.uvic.ca).

Programming affiliations with the FreeEOS equation-of-state implementation
for stellar interiors (freeeos.sf.net); PLplot scientific plotting software
package (plplot.org); the libLASi project (unifont.org/lasi); the Loads of
Linux Links project (loll.sf.net); and the Linux Brochure Project
(lbproject.sf.net).
__

Linux-powered Science
__
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake


Re: [CMake] adding dependencies on all targets to force CMake to rerun itself

2007-10-10 Thread Philip Lowman
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Alan W. Irwin wrote:
 On 2007-10-10 12:40-0400 Philip Lowman wrote:
 Basically I have something like this but I want all targets in the build
 to depend on changes to foo.txt so that CMake runs itself again.

 MACRO(Foo)
 FILE(READ ${PROJECT_SOURCE_DIR}/foo.txt contents)
 ... define variables for include path, directory recursion,
etc., that get used later
 ENDMACRO(Foo)
 
 It appears you are
 reading the file to define variables for include path, directory
 recursion,
 etc., that get used later.  Why not simply do that task using CMake
 instructions that are INCLUDEd from a file?
 
 For example,
 
 SET (CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/modules)
 INCLUDE (plplot)

Actually that's probably not a bad idea now.  Originally I had devised
the CMake macro to read a custom file because that's how developers were
used to defining all of the libraries and their allowable include paths
and I didn't want to change existing behavior.  Now that everyone's
bought into CMake perhaps this is a moot point now. :)

- --
Philip Lowman
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFHDYhUe0tOktX6RKkRAiDZAJ9l9opBgL/E+R0FP8iktEh1m0UPkQCfbRF6
fCVhSIApMCrB7OoTTkKuuxI=
=ahoA
-END PGP SIGNATURE-
___
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake