summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--modules/TDEMacros.cmake40
-rw-r--r--templates/tde_export_library.cmake1
2 files changed, 41 insertions, 0 deletions
diff --git a/modules/TDEMacros.cmake b/modules/TDEMacros.cmake
index 06a6b1b..ed6ca68 100644
--- a/modules/TDEMacros.cmake
+++ b/modules/TDEMacros.cmake
@@ -23,6 +23,10 @@ include( CheckCXXCompilerFlag )
##### initialization...
if( NOT TDE_CMAKE_ROOT )
+ if( "${CMAKE_VERSION}" VERSION_LESS "3.1" )
+ message( FATAL_ERROR "CMake >= 3.1.0 required" )
+ endif()
+
if( ${CMAKE_CURRENT_LIST_DIR} STREQUAL ${CMAKE_ROOT}/Modules )
# TDE CMake is installed in the system directory
@@ -792,6 +796,8 @@ macro( tde_add_library _arg_target )
unset( _version )
unset( _release )
unset( _sources )
+ unset( _cxx_features )
+ unset( _cxx_features_private )
unset( _destination )
unset( _embed )
unset( _link )
@@ -878,6 +884,18 @@ macro( tde_add_library _arg_target )
set( _storage "_sources" )
endif( "+${_arg}" STREQUAL "+SOURCES" )
+ # found directive "CXX_FEATURES"
+ if( "+${_arg}" STREQUAL "+CXX_FEATURES" )
+ set( _skip_store 1 )
+ set( _storage "_cxx_features" )
+ endif( "+${_arg}" STREQUAL "+CXX_FEATURES" )
+
+ # found directive "CXX_FEATURES_PRIVATE"
+ if( "+${_arg}" STREQUAL "+CXX_FEATURES_PRIVATE" )
+ set( _skip_store 1 )
+ set( _storage "_cxx_features_private" )
+ endif( "+${_arg}" STREQUAL "+CXX_FEATURES_PRIVATE" )
+
# found directive "EMBED"
if( "+${_arg}" STREQUAL "+EMBED" )
set( _skip_store 1 )
@@ -997,6 +1015,15 @@ macro( tde_add_library _arg_target )
# add target
add_library( ${_target} ${_type} ${_exclude_from_all} ${_sources} )
+ # set cxx features
+ if( _cxx_features )
+ target_compile_features( ${_target} PUBLIC ${_cxx_features} )
+ endif( )
+ if( TDE_CXX_FEATURES OR PROJECT_CXX_FEATURES OR _cxx_features_private )
+ target_compile_features( ${_target} PRIVATE
+ ${TDE_CXX_FEATURES} ${PROJECT_CXX_FEATURES} ${_cxx_features_private} )
+ endif( )
+
# we assume that modules have no prefix and no version
# also, should not link
if( ${_type} STREQUAL "MODULE" )
@@ -1235,6 +1262,7 @@ macro( tde_add_executable _arg_target )
unset( _meta_includes )
unset( _setuid )
unset( _sources )
+ unset( _cxx_features )
unset( _destination )
unset( _link )
unset( _dependencies )
@@ -1289,6 +1317,12 @@ macro( tde_add_executable _arg_target )
set( _storage "_sources" )
endif( "+${_arg}" STREQUAL "+SOURCES" )
+ # found directive "CXX_FEATURES"
+ if( "+${_arg}" STREQUAL "+CXX_FEATURES" )
+ set( _skip_store 1 )
+ set( _storage "_cxx_features" )
+ endif( "+${_arg}" STREQUAL "+CXX_FEATURES" )
+
# found directive "LINK"
if( "+${_arg}" STREQUAL "+LINK" )
set( _skip_store 1 )
@@ -1372,6 +1406,12 @@ macro( tde_add_executable _arg_target )
# add target
add_executable( ${_target} ${_sources} )
+ # set cxx features
+ if( TDE_CXX_FEATURES OR PROJECT_CXX_FEATURES OR _cxx_features )
+ target_compile_features( ${_target} PRIVATE
+ ${TDE_CXX_FEATURES} ${PROJECT_CXX_FEATURES} ${_cxx_features} )
+ endif( )
+
# set link libraries
if( _link )
target_link_libraries( ${_target} ${_link} )
diff --git a/templates/tde_export_library.cmake b/templates/tde_export_library.cmake
index 4d6cb3f..7e4ec26 100644
--- a/templates/tde_export_library.cmake
+++ b/templates/tde_export_library.cmake
@@ -1,6 +1,7 @@
add_library( @_target@ @_type@ IMPORTED )
set_target_properties( @_target@ PROPERTIES
+ INTERFACE_COMPILE_FEATURES "@_cxx_features@"
IMPORTED_LINK_INTERFACE_LIBRARIES "@_shared_libs@"
IMPORTED_LOCATION "@_location@"
IMPORTED_SONAME "@_soname@" )