summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Golubev <fatzer2@gmail.com>2016-06-28 05:03:23 +0300
committerSlávek Banko <slavek.banko@axis.cz>2017-01-26 00:30:18 +0100
commit6679a58c97a1d28fcb3f8930b914864b2888d1f0 (patch)
treefb84fc3cd28550ea2a2d32cef66a7b9aa7f85f12
parent0e0f4e9be4ce481304f4a9e7b0069af157425d74 (diff)
downloadtde-cmake-6679a58c.tar.gz
tde-cmake-6679a58c.zip
add tde_add_check_executable macro
- also add EXCLUDE_FROM_ALL arg for tde_add_library Signed-off-by: Alexander Golubev <fatzer2@gmail.com>
-rw-r--r--modules/TDEMacros.cmake109
1 files changed, 108 insertions, 1 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index b362dd1..e3d1641 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -550,6 +550,7 @@ macro( tde_add_library _arg_target )
unset( _link )
unset( _dependencies )
unset( _storage )
+ unset( _exclude_from_all )
set( _shouldnotlink no )
@@ -648,6 +649,12 @@ macro( tde_add_library _arg_target )
unset( ${_storage} )
endif( "+${_arg}" STREQUAL "+DESTINATION" )
+ # found directive "EXCLUDE_FROM_ALL"
+ if( "+${_arg}" STREQUAL "+EXCLUDE_FROM_ALL" )
+ set( _skip_store 1 )
+ set( _exclude_from_all "EXCLUDE_FROM_ALL" )
+ endif( "+${_arg}" STREQUAL "+EXCLUDE_FROM_ALL" )
+
# metadata
if( "+${_arg}" STREQUAL "+DESCRIPTION" )
set( _skip_store 1 )
@@ -728,7 +735,7 @@ macro( tde_add_library _arg_target )
endif( _automoc )
# add target
- add_library( ${_target} ${_type} ${_sources} )
+ add_library( ${_target} ${_type} ${_exclude_from_all} ${_sources} )
# we assume that modules have no prefix and no version
# also, should not link
@@ -1062,6 +1069,106 @@ endmacro( tde_add_executable )
#################################################
#####
+##### tde_add_check_executable
+
+macro( tde_add_check_executable _arg_target )
+
+ unset( _target )
+ unset( _automoc )
+ unset( _meta_includes )
+ unset( _sources )
+ unset( _destination )
+ unset( _link )
+ unset( _dependencies )
+ unset( _storage )
+
+ foreach( _arg ${ARGV} )
+
+ # this variable help us to skip
+ # storing unapropriate values (i.e. directives)
+ unset( _skip_store )
+
+ # found directive "AUTOMOC"
+ if( "+${_arg}" STREQUAL "+AUTOMOC" )
+ set( _skip_store 1 )
+ set( _automoc 1 )
+ endif( "+${_arg}" STREQUAL "+AUTOMOC" )
+
+ # found directive "META_INCLUDES"
+ if( "+${_arg}" STREQUAL "+META_INCLUDES" )
+ set( _skip_store 1 )
+ set( _storage "_meta_includes" )
+ endif( )
+
+ # found directive "SOURCES"
+ if( "+${_arg}" STREQUAL "+SOURCES" )
+ set( _skip_store 1 )
+ set( _storage "_sources" )
+ endif( "+${_arg}" STREQUAL "+SOURCES" )
+
+ # found directive "LINK"
+ if( "+${_arg}" STREQUAL "+LINK" )
+ set( _skip_store 1 )
+ set( _storage "_link" )
+ endif( "+${_arg}" STREQUAL "+LINK" )
+
+ # found directive "DEPENDENCIES"
+ if( "+${_arg}" STREQUAL "+DEPENDENCIES" )
+ set( _skip_store 1 )
+ set( _storage "_dependencies" )
+ endif( "+${_arg}" STREQUAL "+DEPENDENCIES" )
+
+ # storing value
+ if( _storage AND NOT _skip_store )
+ #set( ${_storage} "${${_storage}} ${_arg}" )
+ list( APPEND ${_storage} ${_arg} )
+ endif( _storage AND NOT _skip_store )
+
+ endforeach( _arg )
+
+ set( _target "${_arg_target}" )
+
+ # try to autodetect sources
+ if( NOT _sources )
+ file( GLOB _sources "${_target}.cpp" "${_target}.cxx" "${_target}.c" )
+ if( NOT _sources )
+ message( FATAL_ERROR "\nNo sources found for test executable \"${_target}\"." )
+ endif( )
+ endif( NOT _sources )
+
+ # processing different types of sources
+ __tde_internal_process_sources( _sources ${_sources} )
+
+ # set automoc
+ if( _automoc )
+ tde_automoc( ${_sources} )
+ endif( _automoc )
+
+ # add target
+ add_executable( ${_target} EXCLUDE_FROM_ALL ${_sources} )
+
+ # set link libraries
+ if( _link )
+ target_link_libraries( ${_target} ${_link} )
+ endif( _link )
+
+ # set dependencies
+ if( _dependencies )
+ add_dependencies( ${_target} ${_dependencies} )
+ endif( _dependencies )
+
+ # create make check target
+ if(NOT TARGET check)
+ add_custom_target(check)
+ endif(NOT TARGET check)
+
+ add_dependencies( check ${_target} )
+
+endmacro( tde_add_check_executable )
+
+
+#################################################
+#####
##### tde_add_tdeinit_executable
macro( tde_add_tdeinit_executable _target )