mirror of
https://port.numenaute.org/aleajactaest/khanat-opennel-code.git
synced 2024-11-10 01:09:50 +00:00
Ensure definitions from cmake files that make use of generator expressions
(such as UseQt4.cmake) are retained but do not cause a empty "-D" to be output when the generator evaluates to the empty string. Fixes debug build failure on Linux using Qt4/tools/WITH_PCH. --HG-- branch : develop
This commit is contained in:
parent
c2084480c8
commit
b193faa426
1 changed files with 15 additions and 13 deletions
|
@ -56,33 +56,37 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
|||
LIST(APPEND _FLAGS " -I\"${item}\"")
|
||||
ENDFOREACH()
|
||||
|
||||
# NOTE: As cmake files (eg FindQT4) may now use generator expressions around their defines that evaluate
|
||||
# to an empty string, wrap all "items" in an expression that outputs a -D IFF the generated
|
||||
# expression is not empty.
|
||||
|
||||
# Required for CMake 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})
|
||||
# don't use dynamic expressions
|
||||
IF(NOT item MATCHES "\\$<")
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDIF()
|
||||
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
@ -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()
|
||||
|
||||
# Already in list form and items may contain non-leading spaces that should not be split on
|
||||
LIST(INSERT _FLAGS 0 "${GLOBAL_DEFINITIONS}")
|
||||
|
||||
IF(CLANG)
|
||||
# Determining all architectures and get common flags
|
||||
SET(_ARCH_NEXT)
|
||||
|
|
Loading…
Reference in a new issue