Fixed: Pass more system variables to PCH compilation

--HG--
branch : develop
This commit is contained in:
kervala 2019-04-14 11:31:39 +02:00
parent ae019d8cad
commit f997e73961

View file

@ -41,31 +41,49 @@ ENDMACRO()
MACRO(PCH_SET_COMPILE_FLAGS _target) MACRO(PCH_SET_COMPILE_FLAGS _target)
SET(PCH_FLAGS) SET(PCH_FLAGS)
SET(PCH_ARCHS) SET(PCH_ARCHS)
SET(PCH_INCLUDES)
SET(_FLAGS) # Append target for clang if defined
IF(CMAKE_CXX_COMPILER_TARGET)
LIST(APPEND PCH_FLAGS "--target=${CMAKE_CXX_COMPILER_TARGET}")
ENDIF()
IF(CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN)
LIST(APPEND PCH_FLAGS "--gcc-toolchain=${CMAKE_CXX_COMPILER_EXTERNAL_TOOLCHAIN}")
ENDIF()
IF(CMAKE_SYSROOT)
LIST(APPEND PCH_FLAGS "--sysroot=${CMAKE_SYSROOT}")
ENDIF()
IF(CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES)
FOREACH(item ${CMAKE_CXX_STANDARD_INCLUDE_DIRECTORIES})
LIST(APPEND PCH_FLAGS "-isystem ${item}")
ENDFOREACH()
ENDIF()
# C++ flags # C++ flags
SET(_FLAG ${CMAKE_CXX_FLAGS}) SET(_FLAGS ${CMAKE_CXX_FLAGS})
SEPARATE_ARGUMENTS(_FLAG) SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND _FLAGS ${_FLAG}) LIST(APPEND PCH_FLAGS ${_FLAGS})
# C++ config flags # C++ config flags
STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD) STRING(TOUPPER "${CMAKE_BUILD_TYPE}" _UPPER_BUILD)
SET(_FLAG ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}}) SET(_FLAGS ${CMAKE_CXX_FLAGS_${_UPPER_BUILD}})
SEPARATE_ARGUMENTS(_FLAG) SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND _FLAGS ${_FLAG}) LIST(APPEND PCH_FLAGS ${_FLAGS})
GET_TARGET_PROPERTY(_targetType ${_target} TYPE) GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
SET(_USE_PIC OFF) SET(_USE_PIC OFF)
IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY") IF(${_targetType} STREQUAL "SHARED_LIBRARY" OR ${_targetType} STREQUAL "MODULE_LIBRARY")
SET(_FLAG ${CMAKE_SHARED_LIBRARY_CXX_FLAGS}) SET(_FLAGS ${CMAKE_SHARED_LIBRARY_CXX_FLAGS})
SEPARATE_ARGUMENTS(_FLAG) SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND _FLAGS ${_FLAG}) LIST(APPEND PCH_FLAGS ${_FLAGS})
ELSE() ELSE()
GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE) GET_TARGET_PROPERTY(_pic ${_target} POSITION_INDEPENDENT_CODE)
IF(_pic) IF(_pic)
@ -75,7 +93,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES) GET_DIRECTORY_PROPERTY(DIRINC INCLUDE_DIRECTORIES)
FOREACH(item ${DIRINC}) FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS -I"${item}") LIST(APPEND PCH_INCLUDES "${item}")
ENDFOREACH() ENDFOREACH()
# NOTE: As cmake files (eg FindQT4) may now use generator expressions around their defines that evaluate # NOTE: As cmake files (eg FindQT4) may now use generator expressions around their defines that evaluate
@ -98,14 +116,14 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} COMPILE_DEFINITIONS) GET_DIRECTORY_PROPERTY(DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS)
IF(DEFINITIONS) IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS}) FOREACH(item ${DEFINITIONS})
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item}) 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_CURRENT_SOURCE_DIR} COMPILE_DEFINITIONS_${_UPPER_BUILD})
IF(DEFINITIONS) IF(DEFINITIONS)
FOREACH(item ${DEFINITIONS}) FOREACH(item ${DEFINITIONS})
APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item}) APPEND_DEFINITION(GLOBAL_DEFINITIONS ${item})
@ -114,22 +132,22 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS) GET_TARGET_PROPERTY(oldProps ${_target} COMPILE_FLAGS)
IF(oldProps) IF(oldProps)
SET(_FLAG ${oldProps}) SET(_FLAGS ${oldProps})
SEPARATE_ARGUMENTS(_FLAG) SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND _FLAGS ${_FLAG}) LIST(APPEND PCH_FLAGS ${_FLAGS})
ENDIF() ENDIF()
GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD}) GET_TARGET_PROPERTY(oldPropsBuild ${_target} COMPILE_FLAGS_${_UPPER_BUILD})
IF(oldPropsBuild) IF(oldPropsBuild)
SET(_FLAG ${oldPropsBuild}) SET(_FLAGS ${oldPropsBuild})
SEPARATE_ARGUMENTS(_FLAG) SEPARATE_ARGUMENTS(_FLAGS)
LIST(APPEND _FLAGS ${_FLAG}) LIST(APPEND PCH_FLAGS ${_FLAGS})
ENDIF() ENDIF()
GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES) GET_TARGET_PROPERTY(DIRINC ${_target} INCLUDE_DIRECTORIES)
IF(DIRINC) IF(DIRINC)
FOREACH(item ${DIRINC}) FOREACH(item ${DIRINC})
LIST(APPEND _FLAGS -I"${item}") LIST(APPEND PCH_INCLUDES "${item}")
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
@ -147,6 +165,18 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
GET_TARGET_PROPERTY(OPTIONS ${_target} COMPILE_OPTIONS)
IF(OPTIONS)
SEPARATE_ARGUMENTS(OPTIONS)
LIST(APPEND PCH_FLAGS ${OPTIONS})
ENDIF()
GET_TARGET_PROPERTY(OPTIONS ${_target} COMPILE_OPTIONS_${_UPPER_BUILD})
IF(OPTIONS)
SEPARATE_ARGUMENTS(OPTIONS)
LIST(APPEND PCH_FLAGS ${OPTIONS})
ENDIF()
GET_TARGET_PROPERTY(_LIBS ${_target} INTERFACE_LINK_LIBRARIES) GET_TARGET_PROPERTY(_LIBS ${_target} INTERFACE_LINK_LIBRARIES)
IF(_LIBS) IF(_LIBS)
FOREACH(_LIB ${_LIBS}) FOREACH(_LIB ${_LIBS})
@ -156,7 +186,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
IF(_DIRS) IF(_DIRS)
FOREACH(item ${_DIRS}) FOREACH(item ${_DIRS})
LIST(APPEND GLOBAL_DEFINITIONS -I"${item}") LIST(APPEND PCH_INCLUDES "${item}")
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
@ -185,7 +215,7 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
ENDIF() ENDIF()
IF(_USE_PIC) IF(_USE_PIC)
LIST(APPEND _FLAGS ${CMAKE_CXX_COMPILE_OPTIONS_PIC}) LIST(APPEND PCH_FLAGS ${CMAKE_CXX_COMPILE_OPTIONS_PIC})
ENDIF() ENDIF()
ENDIF() ENDIF()
@ -195,116 +225,81 @@ MACRO(PCH_SET_COMPILE_FLAGS _target)
IF(_DIRECTORY_FLAGS) IF(_DIRECTORY_FLAGS)
SEPARATE_ARGUMENTS(_DIRECTORY_FLAGS) SEPARATE_ARGUMENTS(_DIRECTORY_FLAGS)
FOREACH(item ${_DIRECTORY_FLAGS}) FOREACH(item ${_DIRECTORY_FLAGS})
LIST(APPEND _FLAGS "${item}") LIST(APPEND PCH_FLAGS "${item}")
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
GET_DIRECTORY_PROPERTY(_DIRECTORY_DEFINITIONS DIRECTORY ${CMAKE_SOURCE_DIR} DEFINITIONS) GET_DIRECTORY_PROPERTY(_DIRECTORY_DEFINITIONS DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DEFINITIONS)
IF(_DIRECTORY_DEFINITIONS) IF(_DIRECTORY_DEFINITIONS)
SEPARATE_ARGUMENTS(_DIRECTORY_DEFINITIONS) SEPARATE_ARGUMENTS(_DIRECTORY_DEFINITIONS)
FOREACH(item ${_DIRECTORY_DEFINITIONS}) FOREACH(item ${_DIRECTORY_DEFINITIONS})
LIST(APPEND _FLAGS "${item}") LIST(APPEND PCH_FLAGS "${item}")
ENDFOREACH() ENDFOREACH()
ENDIF() ENDIF()
ENDIF() ENDIF()
IF(CMAKE_CXX11_EXTENSION_COMPILE_OPTION) IF(CMAKE_CXX11_EXTENSION_COMPILE_OPTION)
LIST(APPEND _FLAGS ${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}) LIST(APPEND PCH_FLAGS "${CMAKE_CXX11_EXTENSION_COMPILE_OPTION}")
ENDIF()
# Format definitions
IF(MSVC)
# Fix path with space
SEPARATE_ARGUMENTS(_FLAGS UNIX_COMMAND "${_FLAGS}")
ENDIF() ENDIF()
# Already in list form and items may contain non-leading spaces that should not be split on # Already in list form and items may contain non-leading spaces that should not be split on
LIST(INSERT _FLAGS 0 "${GLOBAL_DEFINITIONS}") LIST(APPEND PCH_FLAGS "${GLOBAL_DEFINITIONS}")
IF(CLANG) IF(WIN32)
# Determining all architectures and get common flags SET(SYSTEM_FLAG "[-/$]")
SET(_ARCH_NEXT)
SET(_XARCH_NEXT)
FOREACH(item ${_FLAGS})
IF(_ARCH_NEXT)
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
IF(ITEM_FOUND EQUAL -1)
LIST(APPEND PCH_ARCHS ${item})
STRING(TOUPPER "${item}" _UPPER_ARCH)
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
ENDIF()
SET(_ARCH_NEXT OFF)
ELSEIF(_XARCH_NEXT)
SET(_XARCH_NEXT OFF)
ELSE() ELSE()
IF(item MATCHES "^-arch") SET(SYSTEM_FLAG "[-$]")
SET(_ARCH_NEXT ON)
ELSEIF(item MATCHES "^-Xarch_")
STRING(REGEX REPLACE "-Xarch_([a-z0-9_]+)" "\\1" item ${item})
LIST(FIND PCH_ARCHS ${item} ITEM_FOUND)
IF(ITEM_FOUND EQUAL -1)
LIST(APPEND PCH_ARCHS ${item})
STRING(TOUPPER "${item}" _UPPER_ARCH)
SET(PCH_ARCH_${_UPPER_ARCH}_FLAGS "-arch" ${item})
ENDIF() ENDIF()
SET(_XARCH_NEXT ON)
SET(_FINAL_FLAGS)
SET(_PREVIOUS_FLAG)
FOREACH(_FLAG ${PCH_FLAGS})
# If parameter is really a flag (starts with -)
IF(_FLAG MATCHES "^${SYSTEM_FLAG}")
IF(_PREVIOUS_FLAG)
# Append previous flag
LIST(APPEND _FINAL_FLAGS ${_PREVIOUS_FLAG})
ENDIF()
SET(_PREVIOUS_FLAG ${_FLAG})
ELSE() ELSE()
LIST(APPEND PCH_FLAGS ${item}) IF(_PREVIOUS_FLAG)
# Append previous flag and its parameter
# TODO: escape them only if there is an space
LIST(APPEND _FINAL_FLAGS "${_PREVIOUS_FLAG} \"${_FLAG}\"")
SET(_PREVIOUS_FLAG)
ELSE()
# Shouldn't happen
MESSAGE(FATAL_ERROR "No previous flag before ${_FLAG}")
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDFOREACH() ENDFOREACH()
# Get architcture specific flags IF(_PREVIOUS_FLAG)
SET(_XARCH_NEXT) LIST(APPEND _FINAL_FLAGS ${_PREVIOUS_FLAG})
FOREACH(item ${_FLAGS})
IF(_XARCH_NEXT)
STRING(TOUPPER "${_XARCH_NEXT}" _UPPER_XARCH)
LIST(APPEND PCH_ARCH_${_UPPER_XARCH}_FLAGS ${item})
SET(_XARCH_NEXT OFF)
ELSE()
IF(item MATCHES "^-Xarch_")
STRING(SUBSTRING "${item}" 7 -1 _XARCH_NEXT)
ENDIF()
ENDIF()
ENDFOREACH()
# Remove duplicated architectures
IF(_ARCHS AND PCH_ARCHS)
LIST(REMOVE_DUPLICATES PCH_ARCHS)
ENDIF()
ELSE()
SET(PCH_FLAGS ${_FLAGS})
ENDIF() ENDIF()
IF(PCH_FLAGS) SET(PCH_FLAGS ${_FINAL_FLAGS})
# Remove flags that don't work with PCH
LIST(REMOVE_ITEM PCH_FLAGS "-Wa,--noexecstack")
# Remove all empty parameters
LIST(REMOVE_ITEM PCH_FLAGS "") LIST(REMOVE_ITEM PCH_FLAGS "")
# Remove duplicate parameters
LIST(REMOVE_DUPLICATES PCH_FLAGS) LIST(REMOVE_DUPLICATES PCH_FLAGS)
ENDIF()
# create a command-line string
STRING(REGEX REPLACE ";" " " PCH_FLAGS "${PCH_FLAGS}")
# and separate arguments
SEPARATE_ARGUMENTS(PCH_FLAGS)
ENDMACRO() ENDMACRO()
MACRO(GET_PDB_FILENAME _out_filename _target) MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS _includes)
# determine output directory based on target type
GET_TARGET_PROPERTY(_targetType ${_target} TYPE)
IF(${_targetType} STREQUAL EXECUTABLE)
SET(_targetOutput ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})
ELSEIF(${_targetType} STREQUAL STATIC_LIBRARY)
SET(_targetOutput ${CMAKE_ARCHIVE_OUTPUT_DIRECTORY})
ELSE()
SET(_targetOutput ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
ENDIF()
# determine target postfix
STRING(TOUPPER "${CMAKE_BUILD_TYPE}_POSTFIX" _postfix_var_name)
GET_TARGET_PROPERTY(_targetPostfix ${_target} ${_postfix_var_name})
IF(${_targetPostfix} MATCHES NOTFOUND)
SET(_targetPostfix "")
ENDIF()
SET(${_out_filename} "${_targetOutput}/${_target}${_targetPostfix}.pdb")
ENDMACRO(GET_PDB_FILENAME)
MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
IF(CMAKE_CXX_COMPILER_ARG1) IF(CMAKE_CXX_COMPILER_ARG1)
# remove leading space in compiler argument # remove leading space in compiler argument
STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1}) STRING(REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${CMAKE_CXX_COMPILER_ARG1})
@ -313,19 +308,34 @@ MACRO(PCH_SET_COMPILE_COMMAND _inputcpp _compile_FLAGS)
ENDIF() ENDIF()
IF(MSVC) IF(MSVC)
GET_PDB_FILENAME(_PDB_FILE ${_PCH_current_target}) GET_INTERMEDIATE_PDB_FULLPATH(${_PCH_current_target} _PDB_FILE)
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${_PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
SET(PCH_TEMP_CONTENT)
FOREACH(_include ${_includes})
SET(PCH_TEMP_CONTENT "${PCH_TEMP_CONTENT} -I \"${_include}\"")
ENDFOREACH()
SET(PCH_TEMP_FILE ${CMAKE_CURRENT_BINARY_DIR}/pch_command.txt)
FILE(WRITE ${PCH_TEMP_FILE} "${PCH_TEMP_CONTENT}")
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} /nologo @${PCH_TEMP_FILE} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} /Yc /Fp"${PCH_OUTPUT}" ${_inputcpp} /Fd"${_PDB_FILE}" /c /Fo"${PCH_OUTPUT}.obj")
# Ninja PCH Support # Ninja PCH Support
# http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html # http://public.kitware.com/pipermail/cmake-developers/2012-March/003653.html
SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj") SET_SOURCE_FILES_PROPERTIES(${_inputcpp} PROPERTIES OBJECT_OUTPUTS "${PCH_OUTPUT}.obj")
ELSE() ELSE()
SET(HEADER_FORMAT "c++-header") SET(HEADER_FORMAT "c++-header")
SET(_FLAGS "") SET(_FLAGS)
IF(APPLE) IF(APPLE)
SET(HEADER_FORMAT "objective-${HEADER_FORMAT}") SET(HEADER_FORMAT "objective-${HEADER_FORMAT}")
SET(_FLAGS ${OBJC_FLAGS}) LIST(APPEND _FLAGS ${OBJC_FLAGS})
ENDIF() ENDIF()
FOREACH(_include ${_includes})
LIST(APPEND _FLAGS -I "${_include}")
ENDFOREACH()
SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT}) SET(PCH_COMMAND ${CMAKE_CXX_COMPILER} ${pchsupport_compiler_cxx_arg1} ${_compile_FLAGS} ${_FLAGS} -x ${HEADER_FORMAT} -o ${PCH_OUTPUT} -c ${PCH_INPUT})
ENDIF() ENDIF()
ENDMACRO() ENDMACRO()
@ -467,7 +477,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} ${_ARCH} "") PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} ${_ARCH} "")
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT}) LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_ARCH_${_UPPER_ARCH}_FLAGS};${PCH_FLAGS}") PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_ARCH_${_UPPER_ARCH}_FLAGS};${PCH_FLAGS}" "${PCH_INCLUDES}")
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH}) PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch_${_ARCH})
ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH}) ADD_PRECOMPILED_HEADER_TO_TARGET_ARCH(${_targetName} ${_ARCH})
@ -476,7 +486,7 @@ MACRO(ADD_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "") PCH_SET_PRECOMPILED_HEADER_OUTPUT(${_targetName} ${_inputh} "" "")
LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT}) LIST(APPEND PCH_OUTPUTS ${PCH_OUTPUT})
PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}") PCH_SET_COMPILE_COMMAND(${_inputcpp} "${PCH_FLAGS}" "${PCH_INCLUDES}")
PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch) PCH_CREATE_TARGET(${_targetName} ${_targetName}_pch)
ENDIF() ENDIF()
@ -525,8 +535,14 @@ MACRO(ADD_NATIVE_PRECOMPILED_HEADER _targetName _inputh _inputcpp)
SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES") SET_TARGET_PROPERTIES(${_targetName} PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER "YES")
ELSE() ELSE()
#Fallback to the "old" precompiled suppport #Fallback to the "old" precompiled suppport
IF(CMAKE_OSX_ARCHITECTURES AND TARGETS_COUNT GREATER 1)
FOREACH(_ARCH ${CMAKE_OSX_ARCHITECTURES})
ADD_PRECOMPILED_HEADER(${_targetName}_${_ARCH} ${_inputh} ${_inputcpp})
ENDFOREACH()
ELSE()
ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp}) ADD_PRECOMPILED_HEADER(${_targetName} ${_inputh} ${_inputcpp})
ENDIF() ENDIF()
ENDIF()
IF(TARGET ${_targetName}_static) IF(TARGET ${_targetName}_static)
ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp}) ADD_NATIVE_PRECOMPILED_HEADER(${_targetName}_static ${_inputh} ${_inputcpp})