libtree/cmake/Modules/add_my_test.cmake

23 lines
576 B
CMake
Raw Normal View History

get_property(_ADD_MY_TEST GLOBAL PROPERTY _ADD_MY_TEST)
IF (NOT _ADD_MY_TEST)
# set that we have defined GENERATE_CCCC
set_property(GLOBAL PROPERTY _ADD_MY_TEST "YES")
FUNCTION(ADD_MY_TEST)
CMAKE_PARSE_ARGUMENTS(ARG "" "TEST" "SOURCES;LIBS" ${ARGN})
get_property(_mytests GLOBAL PROPERTY _mytests)
list(APPEND _mytests "${ARG_TEST}")
add_executable(${ARG_TEST} ${ARG_SOURCES})
target_link_libraries(${ARG_TEST} ${ARG_LIBS})
add_test(${ARG_TEST} ${ARG_TEST})
set_property(GLOBAL PROPERTY _mytests ${_mytests})
ENDFUNCTION()
ENDIF()