Dependencies are between targets, not projects or CMakeLists.txt.  You
would need to have a target in one project depend on a target defined
in another.

Some of these dependencies are managed automatically, as when you
build one or more libraries, and then reference them when you build a
program. For example:

add_library(lib1 a.cxx b.cxx c.cxx)

add_executable(exec1 exec1.cxx)
target_link_libraries(exec1 lib1)

In this case, CMake would generate build recipes (Makefile, Visual
Studio, etc) such that a.cxx,b.cxx, and c.xx would be compiled, and
lib1 generated from the object files, before exec1 was linked.

In the case where you want a depency that wasn't straightforward (like
a library depends on it's objects, or an executable on it's objects
and libraries)  you can add explicit dependencies, with
add_dependency.

Also, if you have tests depend on other tests. This is important if
one test generates a file, and a second test checks the generated
file:

add_test(NAME GenerateFile COMMAND generate_file)

add_test(NAME TestFileContents COMMAND test_generated_file)

add_property(TEST test_generated_file APPEND PROPERTY DEPENDS generate_file)

On Wed, Apr 25, 2012 at 7:31 AM, Vyacheslav Karamov
<ubuntul...@yandex.ru> wrote:
> Hi All!
>
> My project's (named Compare) structure is similar to this:
>
> Root
>   |
>  SphinX
>       |
>       sphinxbase (autotools project)
>  Sound
>       |
>       |-DoScoring (my Cmake-based project)
>       |-Compare (my Cmake-based project)
>            |-CMakeLists.txt
>            |-src (source files for project Compare)
>            |-ATLAS (autotools project)
>
> How add dependencies on other projects to CMakeLists.txt of my project
> Compare?
>
>
> Thank you in advance,
> Vyacheslav.
>
> --
>
> 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
--

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

Reply via email to