[CMake] Working with Multiple Projects

Petr Kmoch petr.kmoch at gmail.com
Tue Mar 20 03:54:26 EDT 2012


As far as I know, you can't have two CMake projects in the same
directory. Move one of the CMakeLists.txt files to a different one -
either create a sudirectory for the subproject, or create a separate
directory for the "top-level" CMakeLists.txt.

Note that there is no need for directories added via ADD_SUBDIRECTORY
to be actually subdirectories of the source dir. I.e.
ADD_SUBDIRECTORY("../../SomeDir") is perfectly valid.

Petr

On Mon, Mar 19, 2012 at 4:44 PM, Hashim Mir <hmir at rim.com> wrote:
> Hi there,
>
>
> I am currently working on transitioning over a project (that has multiple
> subprojects inside of it) over to Cmake.
>
>
>
> There is one thing that I am not sure about – basically, to include the
> subprojects from the top level CMakeLists.txt file, I just utilize the
> add_subdirectory command, and reference to the directories that these
> various subprojects are stored under.
>
>
>
> However, I have one project that is in the same directory as my top level
> CMakeLists.txt file, and so I am wondering if it is possible to still
> include this file somehow? CMake does not allow me to call add_subdirectory
> on the existing PROJECT_BINARY_DIR, and I cannot think of another way for me
> to include this subproject into my Cmake build.
>
>
> Thanks in advance,
> Hashim
>
> ---------------------------------------------------------------------
> This transmission (including any attachments) may contain confidential
> information, privileged material (including material protected by the
> solicitor-client or other applicable privileges), or constitute non-public
> information. Any use of this information by anyone other than the intended
> recipient is prohibited. If you have received this transmission in error,
> please immediately reply to the sender and delete this information from your
> system. Use, dissemination, distribution, or reproduction of this
> transmission by unintended recipients is not authorized and may be unlawful.
>
> --
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake


More information about the CMake mailing list