mirror of
https://port.numenaute.org/aleajactaest/khanat-code-old.git
synced 2024-12-28 03:10:54 +00:00
Merge with develop
This commit is contained in:
parent
fd70ff06fa
commit
8514e93ff9
1 changed files with 86 additions and 83 deletions
|
@ -10,7 +10,7 @@
|
|||
|
||||
IF(MSVC)
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ELSE(MSVC)
|
||||
ELSE()
|
||||
IF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
EXEC_PROGRAM(${CMAKE_CXX_COMPILER}
|
||||
ARGS ${CMAKE_CXX_COMPILER_ARG1} -dumpversion
|
||||
|
@ -20,12 +20,12 @@ ELSE(MSVC)
|
|||
SET(PCHSupport_FOUND FALSE)
|
||||
ELSEIF(gcc_compiler_version MATCHES "^4\\.[0-9]+(\\.[0-9]+)?")
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF(gcc_compiler_version MATCHES "^4\\.1(\\.[0-9]+)?")
|
||||
ELSE(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
# TODO: make tests for other compilers than GCC
|
||||
SET(PCHSupport_FOUND TRUE)
|
||||
ENDIF(CMAKE_COMPILER_IS_GNUCXX)
|
||||
ENDIF(MSVC)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
# 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)
|
||||
|
@ -40,19 +40,19 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
|||
|
||||
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
|
||||
|
||||
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}")
|
||||
ELSE(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
ELSE()
|
||||
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
|
||||
IF(_pic)
|
||||
LIST(APPEND _FLAGS " ${CMAKE_CXX_COMPILE_OPTIONS_PIE}")
|
||||
ENDIF(_pic)
|
||||
ENDIF(${_targetType} STREQUAL SHARED_LIBRARY OR ${_targetType} STREQUAL MODULE_LIBRARY)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
|
||||
FOREACH(item ${DIRINC})
|
||||
LIST(APPEND _FLAGS " -I\"${item}\"")
|
||||
ENDFOREACH(item)
|
||||
ENDFOREACH()
|
||||
|
||||
# Required for CMake 2.6
|
||||
SET(GLOBAL_DEFINITIONS)
|
||||
|
@ -60,61 +60,64 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
|||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(DEFINITIONS)
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(DEFINITIONS COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(DEFINITIONS)
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
|
||||
IF(oldProps)
|
||||
LIST(APPEND _FLAGS " ${oldProps}")
|
||||
ENDIF(oldProps)
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
|
||||
IF(oldPropsBuild)
|
||||
LIST(APPEND _FLAGS " ${oldPropsBuild}")
|
||||
ENDIF(oldPropsBuild)
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
|
||||
IF(DIRINC)
|
||||
FOREACH(item ${DIRINC})
|
||||
LIST(APPEND _FLAGS " -I\"${item}\"")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(DIRINC)
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS)
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(DEFINITIONS)
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_TARGET_PROPERTY(DEFINITIONS ${_target} COMPILE_DEFINITIONS_${_UPPER_BUILD})
|
||||
IF(DEFINITIONS)
|
||||
FOREACH(item ${DEFINITIONS})
|
||||
LIST(APPEND GLOBAL_DEFINITIONS " -D${item}")
|
||||
ENDFOREACH(item)
|
||||
ENDIF(DEFINITIONS)
|
||||
ENDFOREACH()
|
||||
ENDIF()
|
||||
|
||||
GET_DIRECTORY_PROPERTY(_directory_flags DEFINITIONS)
|
||||
GET_DIRECTORY_PROPERTY(_directory_definitions DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS)
|
||||
LIST(APPEND _FLAGS " ${GLOBAL_DEFINITIONS}")
|
||||
LIST(APPEND _FLAGS " ${_directory_flags}")
|
||||
LIST(APPEND _FLAGS " ${_directory_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)
|
||||
LIST(APPEND _FLAGS " ${_directory_flags}")
|
||||
LIST(APPEND _FLAGS " ${_directory_definitions}")
|
||||
ENDIF()
|
||||
|
||||
# Format definitions
|
||||
IF(MSVC)
|
||||
# Fix path with space
|
||||
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
|
||||
ELSE(MSVC)
|
||||
ELSE()
|
||||
STRING(REGEX REPLACE " +" " " _FLAGS ${_FLAGS})
|
||||
SEPARATE_ARGUMENTS(_FLAGS)
|
||||
ENDIF(MSVC)
|
||||
ENDIF()
|
||||
|
||||
IF(CLANG)
|
||||
# Determining all architectures and get common flags
|
||||
|
@ -127,11 +130,11 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
|||
LIST(APPEND PCH_ARCHS ${item})
|
||||
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
||||
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
||||
ENDIF(ITEM_FOUND EQUAL -1)
|
||||
ENDIF()
|
||||
SET(_ARCH_NEXT OFF)
|
||||
ELSEIF(_XARCH_NEXT)
|
||||
SET(_XARCH_NEXT OFF)
|
||||
ELSE(_ARCH_NEXT)
|
||||
ELSE()
|
||||
IF(item MATCHES "^-arch")
|
||||
SET(_ARCH_NEXT ON)
|
||||
ELSEIF(item MATCHES "^-Xarch_")
|
||||
|
@ -141,13 +144,13 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
|||
LIST(APPEND PCH_ARCHS ${item})
|
||||
STRING(TOUPPER "${item}" _UPPER_ARCH)
|
||||
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
|
||||
ENDIF(ITEM_FOUND EQUAL -1)
|
||||
ENDIF()
|
||||
SET(_XARCH_NEXT ON)
|
||||
ELSE(item MATCHES "^-arch")
|
||||
ELSE()
|
||||
LIST(APPEND PCH_FLAGS ${item})
|
||||
ENDIF(item MATCHES "^-arch")
|
||||
ENDIF(_ARCH_NEXT)
|
||||
ENDFOREACH(item)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
# Get architcture specific flags
|
||||
SET(_XARCH_NEXT)
|
||||
|
@ -156,25 +159,25 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
|
|||
STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH)
|
||||
LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item})
|
||||
SET(_XARCH_NEXT OFF)
|
||||
ELSE(_XARCH_NEXT)
|
||||
ELSE()
|
||||
IF(item MATCHES "^-Xarch_")
|
||||
STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT)
|
||||
ENDIF(item MATCHES "^-Xarch_")
|
||||
ENDIF(_XARCH_NEXT)
|
||||
ENDFOREACH(item)
|
||||
ENDIF()
|
||||
ENDIF()
|
||||
ENDFOREACH()
|
||||
|
||||
# Remove duplicated architectures
|
||||
IF(_ARCHS AND PCH_ARCHS)
|
||||
LIST(REMOVE_DUPLICATES PCH_ARCHS)
|
||||
ENDIF(_ARCHS AND PCH_ARCHS)
|
||||
ELSE(CLANG)
|
||||
ENDIF()
|
||||
ELSE()
|
||||
SET(PCH_FLAGS ${_FLAGS})
|
||||
ENDIF(CLANG)
|
||||
ENDIF()
|
||||
|
||||
IF(PCH_FLAGS)
|
||||
LIST(REMOVE_DUPLICATES PCH_FLAGS)
|
||||
ENDIF(PCH_FLAGS)
|
||||
ENDMACRO(PCH_SET_COMPILE_FLAGS)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(GET_PDB_FILENAME _out_filename _target)
|
||||
# determine output directory based on target type
|
||||
|
@ -201,9 +204,9 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
|
|||
IF(CMAKE_CXX_COMPILER_ARG1)
|
||||
# remove leading space in compiler argument
|
||||
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
|
||||
ELSE(CMAKE_CXX_COMPILER_ARG1)
|
||||
ELSE()
|
||||
SET(pchsupport_compiler_cxx_arg1 "")
|
||||
ENDIF(CMAKE_CXX_COMPILER_ARG1)
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC)
|
||||
GET_PDB_FILENAME(PDB_FILE ${_PCH_current_target})
|
||||
|
@ -211,16 +214,16 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
|
|||
# Ninja PCH Support
|
||||
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
|
||||
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")
|
||||
ELSE(MSVC)
|
||||
ELSE()
|
||||
SET(HEADER_FORMAT "c++-header")
|
||||
SET(_FLAGS "")
|
||||
IF(APPLE)
|
||||
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
|
||||
SET(_FLAGS -fobjc-abi-version=2 -fobjc-legacy-dispatch)
|
||||
ENDIF(APPLE)
|
||||
ENDIF()
|
||||
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT})
|
||||
ENDIF(MSVC)
|
||||
ENDMACRO(PCH_SET_COMPILE_COMMAND)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
||||
SET(_OUTPUT_DIR "${CMAKE_CURRENT_BINARY_DIR}/${_targetName}_pch")
|
||||
|
@ -230,14 +233,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
|||
GET_FILENAME_COMPONENT(_name ${_input} NAME_WE)
|
||||
SET(PCH_INPUT ${_input})
|
||||
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.pch")
|
||||
ELSE(MSVC)
|
||||
ELSE()
|
||||
IF(NOT "${_arch}" STREQUAL "")
|
||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_arch}")
|
||||
ENDIF(NOT "${_arch}" STREQUAL "")
|
||||
ENDIF()
|
||||
|
||||
IF(NOT "${_language}" STREQUAL "")
|
||||
SET(_OUTPUT_DIR "${_OUTPUT_DIR}_${_language}")
|
||||
ENDIF(NOT "${_language}" STREQUAL "")
|
||||
ENDIF()
|
||||
|
||||
GET_FILENAME_COMPONENT(_name ${_input} NAME)
|
||||
|
||||
|
@ -251,14 +254,14 @@ MACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT _targetName _input _arch _language)
|
|||
|
||||
IF(CLANG)
|
||||
SET(PCH_EXT "pth")
|
||||
ELSE(CLANG)
|
||||
ELSE()
|
||||
SET(PCH_EXT "gch")
|
||||
ENDIF(CLANG)
|
||||
ENDIF()
|
||||
|
||||
# For GCC and Clang, PCH needs to be in the same directory as .h
|
||||
SET(PCH_OUTPUT "${_OUTPUT_DIR}/${_name}.${PCH_EXT}")
|
||||
ENDIF(MSVC)
|
||||
ENDMACRO(PCH_SET_PRECOMPILED_HEADER_OUTPUT)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
# Add common flags
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
||||
|
@ -266,7 +269,7 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
|||
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
ENDIF()
|
||||
|
||||
IF(MSVC)
|
||||
SET(_target_cflags "${oldProps} /Yu\"${PCH_INPUT}\" /FI\"${PCH_INPUT}\" /Fp\"${PCH_OUTPUT}\"")
|
||||
|
@ -279,17 +282,17 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
|||
GET_TARGET_PROPERTY(_STATIC_LIBRARY_FLAGS ${_targetName} STATIC_LIBRARY_FLAGS)
|
||||
IF(NOT _STATIC_LIBRARY_FLAGS)
|
||||
SET(_STATIC_LIBRARY_FLAGS)
|
||||
ENDIF(NOT _STATIC_LIBRARY_FLAGS)
|
||||
ENDIF()
|
||||
SET(_STATIC_LIBRARY_FLAGS "${PCH_OUTPUT}.obj ${_STATIC_LIBRARY_FLAGS}")
|
||||
|
||||
GET_TARGET_PROPERTY(_LINK_FLAGS ${_targetName} LINK_FLAGS)
|
||||
IF(NOT _LINK_FLAGS)
|
||||
SET(_LINK_FLAGS)
|
||||
ENDIF(NOT _LINK_FLAGS)
|
||||
ENDIF()
|
||||
SET(_LINK_FLAGS "${PCH_OUTPUT}.obj ${_LINK_FLAGS}")
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES STATIC_LIBRARY_FLAGS ${_STATIC_LIBRARY_FLAGS} LINK_FLAGS ${_LINK_FLAGS})
|
||||
ELSE(MSVC)
|
||||
ELSE()
|
||||
# for use with distcc and gcc >4.0.1 if preprocessed files are accessible
|
||||
# on all remote machines set
|
||||
# PCH_ADDITIONAL_COMPILER_FLAGS to -fpch-preprocess
|
||||
|
@ -299,21 +302,21 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName)
|
|||
# If no arch is specified, create common flags
|
||||
IF(PCH_ARCHS_COUNT LESS 2)
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-include ${PCH_INPUT} ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||
ENDIF(PCH_ARCHS_COUNT LESS 2)
|
||||
ENDIF()
|
||||
|
||||
IF(APPLE)
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-fobjc-abi-version=2 -fobjc-legacy-dispatch -x objective-c++ ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||
ENDIF(APPLE)
|
||||
ENDIF()
|
||||
|
||||
IF(WITH_PCH_DEBUG)
|
||||
SET(PCH_ADDITIONAL_COMPILER_FLAGS "-H ${PCH_ADDITIONAL_COMPILER_FLAGS}")
|
||||
ENDIF(WITH_PCH_DEBUG)
|
||||
ENDIF()
|
||||
|
||||
SET(_target_cflags "${oldProps} ${PCH_ADDITIONAL_COMPILER_FLAGS} -Winvalid-pch")
|
||||
ENDIF(MSVC)
|
||||
ENDIF()
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_target_cflags})
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET)
|
||||
ENDMACRO()
|
||||
|
||||
# Add specific flags for an arch
|
||||
MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
|
||||
|
@ -324,19 +327,19 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH _targetName _arch)
|
|||
|
||||
IF(${_FLAGS} MATCHES NOTFOUND)
|
||||
SET(_FLAGS "")
|
||||
ENDIF(${_FLAGS} MATCHES NOTFOUND)
|
||||
ENDIF()
|
||||
|
||||
SET(_FLAGS "${_FLAGS} -Xarch_${_arch} -include${PCH_INPUT}")
|
||||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS ${_FLAGS})
|
||||
ENDIF(PCH_ARCHS_COUNT GREATER 1)
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(PCH_CREATE_TARGET _targetName _targetNamePCH)
|
||||
ADD_CUSTOM_COMMAND(OUTPUT ${PCH_OUTPUT} COMMAND ${PCH_COMMAND} COMMENT "Generating ${_targetNamePCH}" DEPENDS ${PCH_INPUT})
|
||||
ADD_CUSTOM_TARGET(${_targetNamePCH} DEPENDS ${PCH_INPUT} ${PCH_OUTPUT})
|
||||
ADD_DEPENDENCIES(${_targetName} ${_targetNamePCH})
|
||||
ENDMACRO(PCH_CREATE_TARGET _targetName _inputh _inputcpp)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||
SET(_PCH_current_target ${_targetName})
|
||||
|
@ -346,7 +349,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
|||
"This is the ADD_PRECOMPILED_HEADER macro. "
|
||||
"You must set CMAKE_BUILD_TYPE!"
|
||||
)
|
||||
ENDIF(NOT CMAKE_BUILD_TYPE)
|
||||
ENDIF()
|
||||
|
||||
PCH_SET_COMPILE_FLAGS(${_targetName})
|
||||
|
||||
|
@ -362,25 +365,25 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
|||
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH})
|
||||
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH})
|
||||
ENDFOREACH(_ARCH)
|
||||
ELSE(PCH_ARCHS)
|
||||
ENDFOREACH()
|
||||
ELSE()
|
||||
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "")
|
||||
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
|
||||
|
||||
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}")
|
||||
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch)
|
||||
ENDIF(PCH_ARCHS)
|
||||
ENDIF()
|
||||
|
||||
ADD_PRECOMPILED_HEADER_TO_TARGET(${_targetName})
|
||||
|
||||
SET_DIRECTORY_PROPERTIES(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES "${PCH_OUTPUTS}")
|
||||
ENDMACRO(ADD_PRECOMPILED_HEADER)
|
||||
ENDMACRO()
|
||||
|
||||
MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
||||
IF(NOT PCHSupport_FOUND)
|
||||
MESSAGE(STATUS "PCH disabled because compiler doesn't support them")
|
||||
RETURN()
|
||||
ENDIF(NOT PCHSupport_FOUND)
|
||||
ENDIF()
|
||||
|
||||
# 0 => creating a new target for PCH, works for all makefiles
|
||||
# 1 => setting PCH for VC++ project, works for VC++ projects
|
||||
|
@ -389,9 +392,9 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
|||
SET(PCH_METHOD 1)
|
||||
ELSEIF(CMAKE_GENERATOR MATCHES "Xcode")
|
||||
SET(PCH_METHOD 2)
|
||||
ELSE(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
ELSE()
|
||||
SET(PCH_METHOD 0)
|
||||
ENDIF(CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
ENDIF()
|
||||
|
||||
IF(PCH_METHOD EQUAL 1)
|
||||
# Auto include the precompile (useful for moc processing, since the use of
|
||||
|
@ -401,7 +404,7 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
|||
GET_TARGET_PROPERTY(oldProps ${_targetName} COMPILE_FLAGS)
|
||||
IF(${oldProps} MATCHES NOTFOUND)
|
||||
SET(oldProps "")
|
||||
ENDIF(${oldProps} MATCHES NOTFOUND)
|
||||
ENDIF()
|
||||
|
||||
SET(newProperties "${oldProps} /Yu\"${_inputh}\" /FI\"${_inputh}\"")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES COMPILE_FLAGS "${newProperties}")
|
||||
|
@ -418,12 +421,12 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
|
|||
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${fullPath}")
|
||||
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
|
||||
ELSE(PCH_METHOD EQUAL 1)
|
||||
ELSE()
|
||||
#Fallback to the "old" precompiled suppport
|
||||
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
|
||||
ENDIF(PCH_METHOD EQUAL 1)
|
||||
ENDIF()
|
||||
|
||||
IF(TARGET ${_targetName}_static)
|
||||
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})
|
||||
ENDIF(TARGET ${_targetName}_static)
|
||||
ENDMACRO(ADD_NATIVE_PRECOMPILED_HEADER)
|
||||
ENDIF()
|
||||
ENDMACRO()
|
||||
|
|
Loading…
Reference in a new issue