Marcel Loose schrieb: > On Wed, 2009-03-25 at 17:40 +0100, Hendrik Sattler wrote: >> Marcel Loose schrieb: >>> On Wed, 2009-03-25 at 15:16 +0100, Eric Noulard wrote: >>>> 2009/3/25 Marcel Loose <[email protected]>: >>>> >>> OK, it's done. >>> >>> I've added http://www.cmake.org/Wiki/CMakeEmulateMakeCheck to "Specific >>> Topics". >> Wouldn't a macro for >> add_executable(<testprog> EXCLUDE_FROM_ALL ...) >> add_test(<testprog> <testprog>) >> add_dependencies(check <testprog>) >> >> be better than complaining about having to retype that all (untested): >> macro ( add_check prog ) >> if ( NOT TARGET check ) >> add_custom_target(check COMMAND ${CMAKE_TEST_COMMAND}) >> endif ( NOT TARGET check ) >> add_executable(${prog} EXCLUDE_FROM_ALL ${ARGN}) >> add_test(${prog}) >> add_dependencies(check ${prog}) >> endmacro ( add_check ) >> >> then use add_check() like add_executable(). >> >> HS > > Hi Hendrik, > > Your idea sounds good, but usually you will also need to use a > target_link_libraries() command. How would you fit that into your macro? > So the sequence of commands would be something like: > add_executable(<prog> <prog-srcs>) > add_test(<prog> <prog>) > add_dependencies(check <prog>) > target_link_libraries(prog <dep-libs>) > > How do I pass both <prog-srcs> and <dep-libs> as arguments to the > add_check macro?
You don't: add_check(<prog> <prog-srcs>) target_link_libraries(<prog> <dep-libs>) HS _______________________________________________ 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
