diff options
author | Alexander Golubev <fatzer2@gmail.com> | 2016-12-18 16:26:21 +0300 |
---|---|---|
committer | Slávek Banko <slavek.banko@axis.cz> | 2017-01-26 00:30:18 +0100 |
commit | 9150bd170f31408d6b4f02a2de8627a338ad6276 (patch) | |
tree | 2f0c94f20321e760ed22993841495b7817b6a43b | |
parent | 6679a58c97a1d28fcb3f8930b914864b2888d1f0 (diff) | |
download | tde-cmake-9150bd170f31408d6b4f02a2de8627a338ad6276.tar.gz tde-cmake-9150bd170f31408d6b4f02a2de8627a338ad6276.zip |
tde_add_check_executable: add TEST argument
Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
-rw-r--r-- | modules/TDEMacros.cmake | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake index e3d1641..481ae7d 100644 --- a/modules/TDEMacros.cmake +++ b/modules/TDEMacros.cmake @@ -1075,6 +1075,7 @@ macro( tde_add_check_executable _arg_target ) unset( _target ) unset( _automoc ) + unset( _test ) unset( _meta_includes ) unset( _sources ) unset( _destination ) @@ -1094,6 +1095,12 @@ macro( tde_add_check_executable _arg_target ) set( _automoc 1 ) endif( "+${_arg}" STREQUAL "+AUTOMOC" ) + # found directive "TEST" + if( "+${_arg}" STREQUAL "+TEST" ) + set( _skip_store 1 ) + set( _test 1 ) + endif( "+${_arg}" STREQUAL "+TEST" ) + # found directive "META_INCLUDES" if( "+${_arg}" STREQUAL "+META_INCLUDES" ) set( _skip_store 1 ) @@ -1164,6 +1171,17 @@ macro( tde_add_check_executable _arg_target ) add_dependencies( check ${_target} ) + # add test target + if( _test ) + # get relative path to current directory and strip end tests dir + file( RELATIVE_PATH _test_prefix ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ) + string( REGEX REPLACE "(^\\.+/?|(^|/)tests?$|/$)" "" _test_prefix "${_test_prefix}" ) + if( _test_prefix ) + set( _test_prefix "${_test_prefix}/" ) + endif( _test_prefix ) + add_test( NAME "${_test_prefix}${_target}" COMMAND "${_target}" ) + endif( _test ) + endmacro( tde_add_check_executable ) |