<br><font size=2 face="sans-serif">That solution works pretty good Mike.
Not quite what I thought I was looking for, but it works.</font>
<br><font size=2 face="sans-serif">---------------------------------------------------------<br>
Aaron Wright<br>
Software Engineer - DCS Group<br>
Schweitzer Engineering Laboratories, Inc.<br>
Pullman, WA 99163<br>
509-334-8087</font>
<br>
<br>
<br>
<table width=100%>
<tr valign=top>
<td width=40%><font size=1 face="sans-serif"><b>Mike Jackson <mike.jackson@bluequartz.net></b>
</font>
<br><font size=1 face="sans-serif">Sent by: cmake-bounces@cmake.org</font>
<p><font size=1 face="sans-serif">10/24/2009 04:50 AM</font>
<td width=59%>
<table width=100%>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">To</font></div>
<td><font size=1 face="sans-serif">Aaron_Wright@selinc.com</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">cc</font></div>
<td><font size=1 face="sans-serif">cmake@cmake.org</font>
<tr valign=top>
<td>
<div align=right><font size=1 face="sans-serif">Subject</font></div>
<td><font size=1 face="sans-serif">Re: [CMake] Include Guard to Stop Duplicate
Targets?</font></table>
<br>
<table>
<tr valign=top>
<td>
<td></table>
<br></table>
<br>
<br>
<br><tt><font size=2>Few possibilities:<br>
Are Components a and b just libraries that do NOT really
depend on<br>
Executable A, B, or C? If so, then in the top level CMakeLists.txt<br>
file add those subdirectories FIRST, then add the Executable's<br>
directories with dependencies on components a and b.<br>
<br>
If components a and b are something like plugins and they need
the<br>
executables A, B or C built first then you may have to add some logic<br>
to the components a and b to avoid adding them again.<br>
<br>
_________________________________________________________<br>
Mike Jackson mike.jackson@bluequartz.net<br>
BlueQuartz Software
www.bluequartz.net<br>
Principal Software Engineer
Dayton, Ohio<br>
<br>
<br>
<br>
<br>
On Fri, Oct 23, 2009 at 6:09 PM, <Aaron_Wright@selinc.com>
wrote:<br>
><br>
> I have a small project with several different parts that I would like
to<br>
> build with CMake, but I'm having some trouble pulling it all together.<br>
><br>
> For example purposes, there's an overall project with three
executables<br>
> that use two static libraries. The executables and static libraries
are<br>
> produced as part of the build. The directory structure looks like
this:<br>
><br>
> /<br>
> projects/<br>
> 00-0000/<br>
> CMakeLists.txt<br>
> products/<br>
> executable_a/<br>
> src/<br>
> include/<br>
> CMakeLists.txt<br>
> executable_b/<br>
> src/<br>
> include/<br>
> CMakeLists.txt<br>
> executable_c/<br>
> src/<br>
> include/<br>
> CMakeLists.txt<br>
> components/<br>
> a/<br>
> src/<br>
> include/<br>
> CMakeLists.txt<br>
> b/<br>
> src/<br>
> include/<br>
> CMakeLists.txt<br>
><br>
> I would like /projects/00-0000/CMakeLists.txt to be the top level<br>
> CMakeLists.txt file and to contain:<br>
><br>
> PROJECT(00-0000)<br>
><br>
> ADD_SUBDIRECTORY(../../products/executable_a executable_a)<br>
> ADD_SUBDIRECTORY(../../products/executable_b executable_b)<br>
> ADD_SUBDIRECTORY(../../products/executable_c executable_c)<br>
><br>
> And /products/executable_a/CMakeLists.txt to contain:<br>
><br>
> PROJECT(executable_a)<br>
><br>
> ADD_SUBDIRECTORY(../../components/a a)<br>
><br>
> And /products/executable_b/CMakeLists.txt to contain:<br>
><br>
> PROJECT(executable_b)<br>
><br>
> ADD_SUBDIRECTORY(../../components/b b)<br>
><br>
> And /products/executable_c/CMakeLists.txt to contain:<br>
><br>
> PROJECT(executable_c)<br>
><br>
> ADD_SUBDIRECTORY(../../components/a a)<br>
> ADD_SUBDIRECTORY(../../components/b b)<br>
><br>
> So I have each executable using ADD_SUBDIRECTORY to get the components
it<br>
> needs. The problem obviously is that the CMakeLists.txt for components
a and<br>
> b are included twice, producing duplicate targets that CMake doesn't
like. I<br>
> was thinking that this was similar to header files in C/C++, and in
that<br>
> world every header files uses an include guard to prevent duplication.
So is<br>
> there a way in CMake to implement include guards, or rather ADD_SUBDIRECTORY<br>
> guards?<br>
><br>
> Or, am I headed down the wrong path entirely?<br>
><br>
> ---------------------------------------------------------<br>
> Aaron Wright<br>
> _______________________________________________<br>
> Powered by www.kitware.com<br>
><br>
> Visit other Kitware open-source projects at<br>
> </font></tt><a href=http://www.kitware.com/opensource/opensource.html><tt><font size=2>http://www.kitware.com/opensource/opensource.html<br>
><br>
> Please keep messages on-topic and check the CMake FAQ at:<br>
> </font></tt><a href=http://www.cmake.org/Wiki/CMake_FAQ><tt><font size=2>http://www.cmake.org/Wiki/CMake_FAQ<br>
><br>
> Follow this link to subscribe/unsubscribe:<br>
> </font></tt><a href=http://www.cmake.org/mailman/listinfo/cmake><tt><font size=2>http://www.cmake.org/mailman/listinfo/cmake<br>
><br>
_______________________________________________<br>
Powered by www.kitware.com<br>
<br>
Visit other Kitware open-source projects at </font></tt><a href=http://www.kitware.com/opensource/opensource.html><tt><font size=2>http://www.kitware.com/opensource/opensource.html<br>
<br>
Please keep messages on-topic and check the CMake FAQ at: </font></tt><a href=http://www.cmake.org/Wiki/CMake_FAQ><tt><font size=2>http://www.cmake.org/Wiki/CMake_FAQ<br>
<br>
Follow this link to subscribe/unsubscribe:<br>
</font></tt><a href=http://www.cmake.org/mailman/listinfo/cmake><tt><font size=2>http://www.cmake.org/mailman/listinfo/cmake<br>
</font></tt></a></a></a></a></a></a>
<br>