Please refer to this structure in the description below.

 

project_root

       CMakeLists.txt

       build

              Debug

              Release

       src

              CMakeLists.txt

              COTS   <- Third party packages used by various components

                     COTS_Package_A

                     ...

              Marshalling

                     CMakeLists.txt

                     intf   <- contains pure virtual class representing
interface

                               implemented by Marshaller A, B and C

                     Utility       <- used only by Marshaller A and B

                                     requires COTS_Package_A (include
paths/libraries)

                           CMakeLists.txt

                           Utility source files, etc.

                     Marshaller A

                           CMakeLists.txt

                           Marshaller_A source files, etc.

                     Marshaller B

                           CMakeLists.txt

                           ...

                     Marshaller C

                           CMakeLists.txt

                           ...

              ... (other plug-ins)

                                

Description

                                

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.

 

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).

 

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.

 

Problem

 

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.

 

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.

 

Thank you,

Joe Gagnon

 

Engineer II

Group 53 - Secure Resilient Systems and Technology

MIT Lincoln Laboratory

Lexington, MA

 

Attachment: smime.p7s
Description: S/MIME cryptographic signature

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake

Reply via email to