mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-11 20:04:46 +00:00
Fixed: RETURN() doesn't exit from macro but from current file (thanks Nimetu!)
This commit is contained in:
parent
963d07e008
commit
e83b412c9c
1 changed files with 43 additions and 44 deletions
|
@ -102,7 +102,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
||||||
ENDIF()
|
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")
|
||||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||||
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
||||||
|
@ -307,7 +307,7 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
||||||
IF(APPLE)
|
IF(APPLE)
|
||||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
IF(WITH_PCH_DEBUG)
|
IF(WITH_PCH_DEBUG)
|
||||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
@ -380,53 +380,52 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
||||||
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||||
IF(NOT PCHSupport_FOUND)
|
IF(PCHSupport_FOUND)
|
||||||
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
|
# 0 => creating a new target for PCH, works for all makefiles
|
||||||
RETURN()
|
# 1 => setting PCH for VC++ project, works for VC++ projects
|
||||||
ENDIF()
|
# 2 => setting PCH for XCode project, works for XCode projects
|
||||||
|
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||||
# 0 => creating a new target for PCH, works for all makefiles
|
SET(PCH_METHOD 1)
|
||||||
# 1 => setting PCH for VC++ project, works for VC++ projects
|
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||||
# 2 => setting PCH for XCode project, works for XCode projects
|
SET(PCH_METHOD 2)
|
||||||
IF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
ELSE()
|
||||||
SET(PCH_METHOD 1)
|
SET(PCH_METHOD 0)
|
||||||
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
|
|
||||||
SET(PCH_METHOD 2)
|
|
||||||
ELSE()
|
|
||||||
SET(PCH_METHOD 0)
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(PCH_METHOD EQUAL 1)
|
|
||||||
# Auto include the precompile (useful for moc processing, since the use of
|
|
||||||
# precompiled is specified at the target level
|
|
||||||
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
|
|
||||||
|
|
||||||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
|
||||||
IF(${oldProps} MATCHES NOTFOUND)
|
|
||||||
SET(oldProps "")
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
|
|
||||||
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
|
IF(PCH_METHOD EQUAL 1)
|
||||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
# Auto include the precompile (useful for moc processing, since the use of
|
||||||
|
# precompiled is specified at the target level
|
||||||
|
# and I don't want to specifiy /F- for each moc/res/ui generated files (using Qt)
|
||||||
|
|
||||||
#also inlude ${oldProps} to have the same compile options
|
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||||
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"")
|
IF(${oldProps} MATCHES NOTFOUND)
|
||||||
ELSEIF(PCH_METHOD EQUAL 2)
|
SET(oldProps "")
|
||||||
# For Xcode, cmake needs my patch to process
|
ENDIF()
|
||||||
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
|
|
||||||
|
|
||||||
# When buiding out of the tree, precompiled may not be located
|
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
|
||||||
# Use full path instead.
|
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
||||||
GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE)
|
|
||||||
|
|
||||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
#also inlude ${oldProps} to have the same compile options
|
||||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES COMPILE_FLAGS "${oldProps} /Yc\"${_inputh}\"")
|
||||||
|
ELSEIF(PCH_METHOD EQUAL 2)
|
||||||
|
# For Xcode, cmake needs my patch to process
|
||||||
|
# GCC_PREFIX_HEADER and GCC_PRECOMPILE_PREFIX_HEADER as target properties
|
||||||
|
|
||||||
|
# When buiding out of the tree, precompiled may not be located
|
||||||
|
# Use full path instead.
|
||||||
|
GET_FILENAME_COMPONENT(fullPath ${_inputh} ABSOLUTE)
|
||||||
|
|
||||||
|
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
||||||
|
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
||||||
|
ELSE()
|
||||||
|
#Fallback to the "old" precompiled suppport
|
||||||
|
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
IF(TARGET ${_targetName}_static)
|
||||||
|
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
|
||||||
|
ENDIF()
|
||||||
ELSE()
|
ELSE()
|
||||||
#Fallback to the "old" precompiled suppport
|
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
|
||||||
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
|
|
||||||
ENDIF()
|
|
||||||
|
|
||||||
IF(TARGET ${_targetName}_static)
|
|
||||||
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
|
|
||||||
ENDIF()
|
ENDIF()
|
||||||
ENDMACRO()
|
ENDMACRO()
|
||||||
|
|
Loading…
Reference in a new issue