@ -1,4 +1,5 @@
function ( myx_cmake_common_target_properties target )
function ( myx_cmake_compile_target_properties target )
if ( NOT TARGET ${ target } )
myx_cmake_message_error ( "MyxCMake: Target ${target} does not exists." )
endif ( )
@ -11,8 +12,7 @@ function(myx_cmake_common_target_properties target)
#
if ( TARGET Qt5::Core )
if ( _target_type STREQUAL EXECUTABLE )
target_compile_options ( ${ target }
P U B L I C $ { Q t 5 C o r e _ E X E C U T A B L E _ C O M P I L E _ F L A G S } )
target_compile_options ( ${ target } PUBLIC ${ Qt5Core_EXECUTABLE_COMPILE_FLAGS } )
endif ( )
if ( NOT MYX_CMAKE_DEBUG_OUTPUT )
target_compile_definitions ( ${ target } PUBLIC QT_NO_DEBUG_OUTPUT )
@ -49,10 +49,7 @@ function(myx_cmake_common_target_properties target)
$ < B U I L D _ I N T E R F A C E : $ { C M A K E _ C U R R E N T _ B I N A R Y _ D I R } >
$ < B U I L D _ I N T E R F A C E : $ { C M A K E _ B I N A R Y _ D I R } / i n c l u d e > )
endif ( )
target_compile_features ( ${ target } ${ __visibility } cxx_alias_templates
c x x _ n u l l p t r c x x _ o v e r r i d e )
target_compile_features ( ${ target } ${ __visibility } cxx_alias_templates cxx_nullptr cxx_override )
if ( _target_type STREQUAL EXECUTABLE )
set_target_properties ( ${ target } PROPERTIES
P O S I T I O N _ I N D E P E N D E N T _ C O D E O N
@ -71,11 +68,6 @@ function(myx_cmake_common_target_properties target)
set_target_properties ( ${ target } PROPERTIES POSITION_INDEPENDENT_CODE ON )
endif ( )
if ( _target_type MATCHES "_LIBRARY$" AND NOT ${ target } -install-headers )
# Ц е л ь , и с п о л ь з у е м а я т о л ь к о д л я у с т а н о в к и з а г о л о в о ч н ы х ф а й л о в б е з к о м п и л я ц и и п р о е к т а
add_custom_target ( ${ target } -install-headers
C O M M A N D " $ { C M A K E _ C O M M A N D } " - D C M A K E _ I N S T A L L _ C O M P O N E N T = d e v
- P " $ { C M A K E _ B I N A R Y _ D I R } / c m a k e _ i n s t a l l . c m a k e " )
endif ( )
# L T O o n l y f o r executables ( not libraries ) i n R e l e a s e b u i l d t y p e
@ -113,6 +105,12 @@ function(myx_cmake_common_target_properties target)
target_compile_definitions (
$ { t a r g e t } $ { _ _ v i s i b i l i t y }
" M Y X _ C M A K E _ L S B _ C O D E N A M E _ $ { M Y X _ C M A K E _ L S B _ C O D E N A M E } " )
endfunction ( )
function ( myx_cmake_common_target_properties target )
myx_cmake_compile_target_properties ( ${ target } )
myx_cmake_analyze_clang_tidy ( ${ target } )
myx_cmake_analyze_clang_check ( ${ target } )
@ -120,6 +118,13 @@ function(myx_cmake_common_target_properties target)
myx_cmake_analyze_pvs_studio ( ${ target } )
myx_cmake_format_sources ( ${ target } )
if ( _target_type MATCHES "_LIBRARY$" AND NOT ${ target } -install-headers )
# Ц е л ь , и с п о л ь з у е м а я т о л ь к о д л я у с т а н о в к и з а г о л о в о ч н ы х ф а й л о в б е з к о м п и л я ц и и п р о е к т а
add_custom_target ( ${ target } -install-headers
C O M M A N D " $ { C M A K E _ C O M M A N D } " - D C M A K E _ I N S T A L L _ C O M P O N E N T = d e v
- P " $ { C M A K E _ B I N A R Y _ D I R } / c m a k e _ i n s t a l l . c m a k e " )
endif ( )
# С о з д а н и е в к а т а л о г е $ { C M A K E _ B I N A R Y _ D I R } с т а н д а р т н ы х к а т а л о г о в b i n , i n c l u d e , l i b
if ( NOT TARGET ${ target } -default-directories )
add_custom_target (
@ -152,6 +157,35 @@ function(myx_cmake_common_target_properties target)
endif ( )
endfunction ( )
function ( myx_cmake_qt_autogen_target_properties target )
myx_cmake_compile_target_properties ( ${ target } )
get_target_property ( _target_type ${ target } TYPE )
if ( NOT _target_type STREQUAL OBJECT_LIBRARY )
myx_cmake_message_error ( "MyxCMake: Target ${target} must have type OBJECT ${_target_type}." )
endif ( )
get_target_property ( __sources ${ target } SOURCES )
foreach ( src IN LISTS __sources )
string ( REGEX MATCH ".*/ui_.*\\.h$" __ui ${ src } )
if ( __ui )
target_include_directories ( ${ target } SYSTEM PUBLIC ${ Qt5Widgets_INCLUDE_DIRS } )
endif ( )
endforeach ( )
foreach ( src IN LISTS __sources )
string ( REGEX MATCH ".*/moc_.*\\.cpp$" __moc ${ src } )
if ( __moc )
target_include_directories ( ${ target } SYSTEM PUBLIC ${ Qt5Core_INCLUDE_DIRS } )
endif ( )
endforeach ( )
set_target_properties ( ${ target } PROPERTIES CXX_CLANG_TIDY "" )
endfunction ( )
function ( myx_cmake_common_target_properties_post_link target )
if ( NOT TARGET ${ target } )
myx_cmake_message_error ( "MyxCMake: Target ${target} does not exists." )