Fixed: Compatibility with CMake 2.8
This commit is contained in:
parent
9d39532d7d
commit
ab047793cf
1 changed files with 20 additions and 7 deletions
|
@ -27,6 +27,19 @@ ELSE()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
MACRO(APPEND_DEFINITION _NAME _VAL)
|
||||||
|
# value is not empty
|
||||||
|
IF(${_VAL})
|
||||||
|
IF(CMAKE_VERSION VERSION_LESS "2.8.12")
|
||||||
|
# don't support logical expressions, append definition
|
||||||
|
LIST(APPEND ${_NAME} "-D${_VAL}")
|
||||||
|
ELSE()
|
||||||
|
# support logical expressions, use them
|
||||||
|
LIST(APPEND ${_NAME} "$<$<BOOL:${_VAL}>:-D$<JOIN:${_VAL},-D>>")
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
ENDMACRO()
|
||||||
|
|
||||||
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
|
# Set PCH_FLAGS for common flags, PCH_ARCH_XXX_FLAGS for specific archs flags and PCH_ARCHS for archs
|
||||||
MACRO(PCH_SET_COMPILE_FLAGS _target)
|
MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
SET(PCH_FLAGS)
|
SET(PCH_FLAGS)
|
||||||
|
@ -77,28 +90,28 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
|
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS)
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
|
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -122,14 +135,14 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
|
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||||
IF(DEFINITIONS)
|
IF(DEFINITIONS)
|
||||||
FOREACH(item ${DEFINITIONS})
|
FOREACH(item ${DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -151,7 +164,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
|
|
||||||
IF(_DEFINITIONS)
|
IF(_DEFINITIONS)
|
||||||
FOREACH(item ${_DEFINITIONS})
|
FOREACH(item ${_DEFINITIONS})
|
||||||
LIST(APPEND GLOBAL_DEFINITIONS "$<$<BOOL:${item}>:-D$<JOIN:${item},-D>>")
|
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
Loading…
Reference in a new issue