mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-12 20:24:47 +00:00
Fixed: Include directories with Qt 5 CMake modules in PCH
This commit is contained in:
parent
7d1b43af51
commit
8a59f88c4e
1 changed files with 61 additions and 1 deletions
|
@ -40,12 +40,15 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||||
|
|
||||||
|
SET(_USE_PIE OFF)
|
||||||
|
|
||||||
IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY")
|
IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY")
|
||||||
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
LIST(APPEND _FLAGS " ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}")
|
||||||
ELSE()
|
ELSE()
|
||||||
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
|
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
|
||||||
|
MESSAGE(STATUS "Target ${_target} is using PIE")
|
||||||
IF(_pic)
|
IF(_pic)
|
||||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
SET(_USE_PIE ON)
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
@ -70,6 +73,20 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS)
|
||||||
|
IF(DEFINITIONS)
|
||||||
|
FOREACH(item ${DEFINITIONS})
|
||||||
|
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||||
|
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}")
|
||||||
|
ENDFOREACH()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
|
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
|
||||||
IF(oldProps)
|
IF(oldProps)
|
||||||
LIST(APPEND _FLAGS " ${oldProps}")
|
LIST(APPEND _FLAGS " ${oldProps}")
|
||||||
|
@ -101,6 +118,49 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
ENDFOREACH()
|
ENDFOREACH()
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
|
GET_TARGET_PROPERTY(_LIBS ${_target} INTERFACE_LINK_LIBRARIES)
|
||||||
|
IF(_LIBS)
|
||||||
|
FOREACH(_LIB ${_LIBS})
|
||||||
|
IF(TARGET "${_LIB}")
|
||||||
|
# use same include directories
|
||||||
|
GET_TARGET_PROPERTY(_DIRS ${_LIB} INTERFACE_INCLUDE_DIRECTORIES)
|
||||||
|
|
||||||
|
IF(_DIRS)
|
||||||
|
FOREACH(item ${_DIRS})
|
||||||
|
LIST(APPEND GLOBAL_DEFINITIONS " -I\"${item}\"")
|
||||||
|
ENDFOREACH()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# use same compile definitions
|
||||||
|
GET_TARGET_PROPERTY(_DEFINITIONS ${_LIB} INTERFACE_COMPILE_DEFINITIONS)
|
||||||
|
|
||||||
|
IF(_DEFINITIONS)
|
||||||
|
FOREACH(item ${_DEFINITIONS})
|
||||||
|
# don't use dynamic expressions
|
||||||
|
IF(NOT item MATCHES "\\$<")
|
||||||
|
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||||
|
ENDIF()
|
||||||
|
ENDFOREACH()
|
||||||
|
ENDIF()
|
||||||
|
ENDIF()
|
||||||
|
ENDFOREACH()
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# Hack to define missing QT_NO_DEBUG with Qt 5.2
|
||||||
|
IF(USE_QT5 AND _UPPER_BUILD STREQUAL "RELEASE")
|
||||||
|
LIST(APPEND GLOBAL_DEFINITIONS " -DQT_NO_DEBUG")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
# Qt5_POSITION_INDEPENDENT_CODE should be true if Qt was compiled with PIE
|
||||||
|
IF(Qt5_POSITION_INDEPENDENT_CODE)
|
||||||
|
SET(_USE_PIE ON)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(_USE_PIE)
|
||||||
|
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
||||||
|
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIC}")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
||||||
|
|
||||||
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
|
IF(CMAKE_VERSION VERSION_LESS "3.3.0")
|
||||||
|
|
Loading…
Reference in a new issue