[CMake] Avoiding error when using add_subdirectory twice on same path (CMake 2.6.4)

Floca Ralf Omar r.floca at dkfz-heidelberg.de
Tue Jun 16 13:41:20 EDT 2009


Hello,

 

using CMake 2.6.4 to build one of our projects an error occurred due to
the repeated usage of add_subdirectory on the same path.

In former versions of CMake the repeated usage was accepted and worked
fine.

 

The referenced project has the following scripting steps:

1. The source tree is traversed to gather information (+configure
snippet files) and compile it in a setup file. This information can be
contributed arbitrary by any sub part of the project.

2. The source tree is traversed a second time to generate the visual
studio project files. This is the "normal" cmake run that adds external
projects, libraries, executables etc.. This run needs the setup file
compiled by the first run to successfully create all VS projects.

 

Right now the scripts discriminate between both modi/runs by a CMake
variable. The gathering of information is needed because some VS
projects must be created by external tools (QMake, MeVis Toolrunner) and
CMake only triggers the creation and adds the targets afterwards.

 

Is there any possibility to access subdirectories and process
cmakelists.txt in the same manner like add_subdirectory without
provoking this error. Or is there a policy (planed) that controls this
special behavior? Looking in the documentation I have not found such a
policy.

 

Any suitable solution is appreciated because right now the dilemma seems
only to be solvable either by discarding a lot of generalization that
helps to keep this project easy to maintain and to extend or by sticking
to CMake 2.6.3, which is not preferable on the long run. Thanks.

 

Kind Regards,

 

Ralf

 

------------------------------------------------------------------

Ralf Floca

DKFZ

German Cancer Research Center (Deutsches Krebsforschungszentrum) 

Member of the Helmholtz Association

E071 Research Group

Software Development for Integrated Diagnostics and Therapy (SIDT)

 

Im Neuenheimer Feld 280

D-69120 Heidelberg

 

Telefon: +49 (6221) 42 3021

E-Mail: r.floca at dkfz-heidelberg.de

Web: www.dkfz.de

------------------------------------------------------------------

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090616/de8620f5/attachment.htm>


More information about the CMake mailing list