[CMake] Common binary dir and failed local headers dependencies

Wojciech Migda wojtek.golf at interia.pl
Sat Mar 7 10:31:57 EST 2009


Hi all,

I have a build system with several subtargets residing in respective
subfolders. What is important - I'm using common binary directory for
all targets. The command I use is:

ADD_SUBDIRECTORY( nth_subfolder common_binary_dir )

The common binary folder was chosen to have all static libraries created
by respective subtargets stored in a single place. However, this leads
to a problem with dependencies derived from C/C++ source files to
headers which are located in local subdirectories and not in common
headers storages.

The build system has got few common include folders which are defined in
the topmost CMakeLists.txt file, and for each subtarget its own
CMakeLists.txt adds local directory to the include list. This works for
compilation, as all -I compiler switches are generated exactly as they
should. Unfortunately, when cmake determines target dependencies
(depend.make file) it looks for headers based on information stored in
the CMakeFiles/CMakeDirectoryInformation.cmake file stored in the binary
directory, which in my case is common for all targets. This means that
with each target the contents of CMakeDirectoryInformation.cmake is
overwritten with the information derived from the last processed target.
As a result during build time when dependencies are being checked
headers which are present only in local directories are not taken into
account and a large part of dependency information is being lost. Thus,
I'd like to ask for advice: should I change the organization of my build
system to get rid of the common binary directory, or should I file a
feature request for cmake to update and not overwrite contents of the
CMakeDirectoryInformation.cmake file.

With kind regards,

Wojtek Migda



----------------------------------------------------------------------
"Teraz gry" - program dla prawdziwych graczy! >>> http://link.interia.pl/f2080



More information about the CMake mailing list