<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 12 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal>Please refer to this structure in the description below.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>project_root<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>       CMakeLists.txt<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>       build<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>              Debug<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>              Release<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>       src<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>              CMakeLists.txt<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>              COTS   <- Third party packages used by various components<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                     COTS_Package_A<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                     ...<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>              Marshalling<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                     CMakeLists.txt<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                     intf   <- contains pure virtual class representing interface<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                               implemented by Marshaller A, B and C<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                     Utility       <- used only by Marshaller A and B<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                                     requires COTS_Package_A (include paths/libraries)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                           CMakeLists.txt<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                           Utility source files, etc.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                     Marshaller A<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                           CMakeLists.txt<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                           Marshaller_A source files, etc.<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                     Marshaller B<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                           CMakeLists.txt<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                           ...<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                     Marshaller C<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                           CMakeLists.txt<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>                           ...<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:9.0pt;font-family:Consolas'>              ... (other plug-ins)<o:p></o:p></span></p><p class=MsoNormal>                                <o:p></o:p></p><p class=MsoNormal>Description<o:p></o:p></p><p class=MsoNormal>                                <o:p></o:p></p><p class=MsoNormal>The project depicted above is intended to build various "plug-ins" (e.g. marshallers) that will be used by another larger application. Using the marshaller example, for a given installation of the application, only one of the marshaller implementations will be used. The plan is that only the selected implementation is built and provided as a shared library, along with other components it depends on (e.g. COTS_Package_A) to the larger application being installed. For the other implementations that were not chosen, nothing related to them (code, required 3rd party packages, etc.) should be included.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>For a scenario, let's assume that Marshaller A is chosen. It requires the Utility package, which in itself requires COTS_Package_A (Marshaller C doesn't have these requirements, but Marshaller B does). So, when Marshaller A is built, I also need to build Utility (along with its dependency on COTS A).<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I am assuming that each implementation should be built as EXCLUDE_FROM_ALL so that they aren't all automatically built when make is run and instead must be explicitly built (manually or by some other means) by running make with the specific target.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Problem<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>I have not been able to figure out how to make this kind of behavior occur using CMake. I have tried add_custom_target and add_dependencies to build the Utility package when Marshaller A (or B) is being built, but have had no luck. At first I thought I had it because when I ran make, the make build messages seemed to indicate success. However, I knew it was not actually doing the build because I deliberately left out the include_directories call (for COTS A) in the Utility CMakeLists.txt to force compilation errors and no errors were reported when the target build was performed. Obviously something is not right.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>If anyone has run into this type of scenario and has figured out a way to do this with CMake, I would really appreciate any information you could provide. I'm still new at using CMake and have not used, not do I understand (yet) many of its functions and more advanced techniques.<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Thank you,<o:p></o:p></p><p class=MsoNormal>Joe Gagnon<o:p></o:p></p><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal><span style='font-size:8.0pt'>Engineer II<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:8.0pt'>Group 53 - Secure Resilient Systems and Technology<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:8.0pt'>MIT Lincoln Laboratory<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:8.0pt'>Lexington, MA<o:p></o:p></span></p><p class=MsoNormal><o:p> </o:p></p></div></body></html>