[CMake] Custom targets that traverse subdirectories

Łukasz Tasz lukasz at tasz.eu
Wed Nov 9 17:52:03 EST 2011


Hi

As far as I understood your problem correctly:

in main cmakelists create target that will agregate subtargets:
main_cmake:

add_custom_target(aggr_target)
add_subdirectory(a)
add_subdirectory(b)

a/CMakeLists.txt
add_custom_target(a_special_test COMMAND specialtest)
add_dependencies(aggr_target a_special_test)

b/CMakeLists.txt
add_custom_target(b_special_test COMMAND specialtest)
add_dependencies(aggr_target b_special_test)


after generation when you will call:
make aggr_target

both special tests for a and b dir will be executed.

br
L.

2011/11/9 EXT-York, Gantry <gantry.york at boeing.com>:
> How do I define a custom target and have it traverse the source tree?
>
>
>
> I’m using
>
>
>
> add_custom_target(
>
>     specialtest
>
>     COMMAND rel/path/to/test_script
>
> )
>
>
>
> However, I need to add other commands to this target that come from scripts
> in subdirectories.
>
>
>
>
>
>
>
> Gantry York
>
> Chandler, Arizona
>
>
>
> --
>
> 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
>



-- 
Lukasz Tasz


More information about the CMake mailing list