@ -56,33 +56,37 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
LIST ( APPEND _FLAGS " -I\" ${ item } \"")
ENDFOREACH ( )
# N O T E : A s c m a k e files ( eg FindQT4 ) m a y n o w u s e g e n e r a t o r e x p r e s s i o n s a r o u n d t h e i r d e f i n e s t h a t e v a l u a t e
# t o a n e m p t y s t r i n g , w r a p a l l " i t e m s " i n a n e x p r e s s i o n t h a t o u t p u t s a - D I F F t h e g e n e r a t e d
# e x p r e s s i o n i s n o t e m p t y .
# R e q u i r e d f o r C M a k e 2 . 6
SET ( GLOBAL_DEFINITIONS )
GET_DIRECTORY_PROPERTY ( DEFINITIONS COMPILE_DEFINITIONS )
IF ( DEFINITIONS )
FOREACH ( item ${ DEFINITIONS } )
LIST ( APPEND GLOBAL_DEFINITIONS " -D${item} ")
LIST ( APPEND GLOBAL_DEFINITIONS " $<$<BOOL:${item}>:-D$<JOIN:${item},-D>> ")
ENDFOREACH ( )
ENDIF ( )
GET_DIRECTORY_PROPERTY ( DEFINITIONS COMPILE_DEFINITIONS_ ${ _UPPER_BUILD } )
IF ( DEFINITIONS )
FOREACH ( item ${ DEFINITIONS } )
LIST ( APPEND GLOBAL_DEFINITIONS " -D${item} ")
LIST ( APPEND GLOBAL_DEFINITIONS " $<$<BOOL:${item}>:-D$<JOIN:${item},-D>> ")
ENDFOREACH ( )
ENDIF ( )
GET_DIRECTORY_PROPERTY ( DEFINITIONS DIRECTORY ${ CMAKE_SOURCE_DIR } COMPILE_DEFINITIONS )
IF ( DEFINITIONS )
FOREACH ( item ${ DEFINITIONS } )
LIST ( APPEND GLOBAL_DEFINITIONS " -D${item} ")
LIST ( APPEND GLOBAL_DEFINITIONS " $<$<BOOL:${item}>:-D$<JOIN:${item},-D>> ")
ENDFOREACH ( )
ENDIF ( )
GET_DIRECTORY_PROPERTY ( DEFINITIONS DIRECTORY ${ CMAKE_SOURCE_DIR } COMPILE_DEFINITIONS_ ${ _UPPER_BUILD } )
IF ( DEFINITIONS )
FOREACH ( item ${ DEFINITIONS } )
LIST ( APPEND GLOBAL_DEFINITIONS " -D${item} ")
LIST ( APPEND GLOBAL_DEFINITIONS " $<$<BOOL:${item}>:-D$<JOIN:${item},-D>> ")
ENDFOREACH ( )
ENDIF ( )
@ -106,14 +110,14 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
GET_TARGET_PROPERTY ( DEFINITIONS ${ _target } COMPILE_DEFINITIONS )
IF ( DEFINITIONS )
FOREACH ( item ${ DEFINITIONS } )
LIST ( APPEND GLOBAL_DEFINITIONS " -D${item} ")
LIST ( APPEND GLOBAL_DEFINITIONS " $<$<BOOL:${item}>:-D$<JOIN:${item},-D>> ")
ENDFOREACH ( )
ENDIF ( )
GET_TARGET_PROPERTY ( DEFINITIONS ${ _target } COMPILE_DEFINITIONS_ ${ _UPPER_BUILD } )
IF ( DEFINITIONS )
FOREACH ( item ${ DEFINITIONS } )
LIST ( APPEND GLOBAL_DEFINITIONS " -D${item} ")
LIST ( APPEND GLOBAL_DEFINITIONS " $<$<BOOL:${item}>:-D$<JOIN:${item},-D>> ")
ENDFOREACH ( )
ENDIF ( )
@ -135,10 +139,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
IF ( _DEFINITIONS )
FOREACH ( item ${ _DEFINITIONS } )
# d o n ' t u s e d y n a m i c e x p r e s s i o n s
IF ( NOT item MATCHES "\\$<" )
LIST ( APPEND GLOBAL_DEFINITIONS " -D${item}" )
ENDIF ( )
LIST ( APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>" )
ENDFOREACH ( )
ENDIF ( )
ENDIF ( )
@ -149,7 +150,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
IF ( GLOBAL_DEFINITIONS MATCHES "QT_CORE_LIB" )
# H a c k t o d e f i n e m i s s i n g Q T _ N O _ D E B U G w i t h Q t 5 . 2
IF ( _UPPER_BUILD STREQUAL "RELEASE" )
LIST ( APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG")
LIST ( APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG")
ENDIF ( )
# Q t 5 _ P O S I T I O N _ I N D E P E N D E N T _ C O D E s h o u l d b e t r u e i f Q t w a s c o m p i l e d w i t h P I C
@ -162,8 +163,6 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
ENDIF ( )
ENDIF ( )
LIST ( APPEND _FLAGS " ${GLOBAL_DEFINITIONS}" )
IF ( CMAKE_VERSION VERSION_LESS "3.3.0" )
GET_DIRECTORY_PROPERTY ( _directory_flags DEFINITIONS )
GET_DIRECTORY_PROPERTY ( _directory_definitions DIRECTORY ${ CMAKE_SOURCE_DIR } DEFINITIONS )
@ -180,6 +179,9 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
SEPARATE_ARGUMENTS ( _FLAGS )
ENDIF ( )
# A l r e a d y i n l i s t f o r m a n d i t e m s m a y c o n t a i n n o n - l e a d i n g s p a c e s t h a t s h o u l d n o t b e s p l i t o n
LIST ( INSERT _FLAGS 0 "${GLOBAL_DEFINITIONS}" )
IF ( CLANG )
# D e t e r m i n i n g a l l a r c h i t e c t u r e s a n d g e t c o m m o n f l a g s
SET ( _ARCH_NEXT )