On Fri, Sep 7, 2012 at 12:31 PM, Brad King <[email protected]> wrote:
> On 09/07/2012 01:12 PM, Robert Dailey wrote:
>> The behavior I'd like here is that all unit tests for all targets
>> specified as a dependency to C (indirectly and directly) are loaded as
>> well. Currently there is no mechanism in CMake to allow for this
>> AFAIK, but for now I'd like to find a reasonable workaround.
>
> Add a test collection target in each directory and then add
> dependencies among them:
>
> $ grep all_test */CMakeLists.txt
> A/CMakeLists.txt:  add_custom_target(A_tests)
> A/CMakeLists.txt:  add_dependencies(A_tests Atest1 Atest2)
> B/CMakeLists.txt:  add_custom_target(B_tests)
> B/CMakeLists.txt:  add_dependencies(B_tests Btest1 Btest2)
> C/CMakeLists.txt:  add_custom_target(C_tests)
> C/CMakeLists.txt:  add_dependencies(C_tests Ctest1 Ctest2)
> C/CMakeLists.txt:  add_dependencies(C_tests A_tests B_tests)
>
> -Brad

This is actually a really great idea, but kind of complex (which is
OK, since I already have code to recursively determine target
dependencies). My only concern is that these custom targets will
appear in the solution, when they are really just a stop-gap. I
wouldn't want them to be visible. Any way to hide those custom targets
from appearing in the solution and make sure they are excluded from
the build? If not, I can use a global property to store each target's
tests, and then only make executable targets depend on those tests.
--

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://public.kitware.com/cgi-bin/mailman/listinfo/cmake-developers

Reply via email to