How can I build AND run my tests with make test?
Currently, make builds all of my tests, and make test runs them. I'd like for make to only build the project without the tests, and make test to build and run the tests.
Top level CMakeLists.txt:
# Build tests
mark_as_advanced( BUILD_TESTS )
set( BUILD_TESTS true CACHE BOOL "Tests build target available if true" )
if( BUILD_TESTS )
enable_testing()
add_subdirectory( tests )
endif()
tests/CMakeLists.txt
foreach( APP ${TESTAPPS} )
add_executable( "${APP}" "${APP}.c" ${src_files})
add_test( NAME "${APP}_test" COMMAND "${APP}" )
endforeach( APP ${TESTAPPS} )