On Thu, Jun 2, 2016 at 2:43 PM, Chuck Atkins <chuck.atk...@kitware.com> wrote: > Could you just make the tests run in the post-build of the test? > > add_library(Foo Foo.cxx) > > add_executable(FooTest FooTest.cxx) > target_link_libraries(FooTest Foo) > > add_custom_command(TARGET FooTest POST_BUILD > COMMAND $<TARGET_FILE:FooTest> $<TARGET_FILE:Foo> > ) > > That way the the test is run as part of it's build. >
This is what we do for our Unit Test projects. We also register the test executable with CTest's add_test too. > > - Chuck > > On Wed, Jun 1, 2016 at 11:46 AM, Vladimir Chebotarev > <vladimir.chebota...@gmail.com> wrote: >> >> Hi there. >> >> At the moment one can add a command executing after a build of a target >> using: >> add_custom_command(... POST_BUILD...) >> >> However if the command have a dependencies which build after the target, >> there is practically no way to specify it. >> >> Simple case: we have a library and tests for it. E.g. I want them to run >> in POST_BUILD of a library. But, tests already depends on the library so I >> can't make them built before it. >> >> There are few possible solutions to that: >> 1) add possibility to set dependencies for add_custom_command in >> POST_BUILD mode; >> 2) add possibility to populate list of targets if we have specified ones >> in list. >> >> Or maybe correct me if I miss something. >> >> Kind regards, Vladimir. >> >> >> -- >> >> 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 > > > > -- > > 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 -- 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