Xcode: Fix compiler id detection for iOS tools (#15214)
Since commit 0cce556b
(Xcode: Use sysroot and deployment target to
identify compiler, 2014-04-29) our compiler id detection project uses
the target platform SDK in case Xcode selects a different compiler based
on it. Now the compiler id project actually compiles with the target
compiler and SDK when cross-compiling.
The iOS tools do not support the 'com.apple.product-type.tool' product
type we use in our compiler id detection project. When targeting
iPhone, use product type 'com.apple.product-type.bundle.unit-test'
instead.
This commit is contained in:
parent
54ff77dc62
commit
c48f6e1229
|
@ -261,8 +261,12 @@ Id flags: ${testflags}
|
||||||
else()
|
else()
|
||||||
set(id_deployment_target "")
|
set(id_deployment_target "")
|
||||||
endif()
|
endif()
|
||||||
|
set(id_product_type "com.apple.product-type.tool")
|
||||||
if(CMAKE_OSX_SYSROOT)
|
if(CMAKE_OSX_SYSROOT)
|
||||||
set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";")
|
set(id_sdkroot "SDKROOT = \"${CMAKE_OSX_SYSROOT}\";")
|
||||||
|
if(CMAKE_OSX_SYSROOT MATCHES "(^|/)[Ii][Pp][Hh][Oo][Nn][Ee]")
|
||||||
|
set(id_product_type "com.apple.product-type.bundle.unit-test")
|
||||||
|
endif()
|
||||||
else()
|
else()
|
||||||
set(id_sdkroot "")
|
set(id_sdkroot "")
|
||||||
endif()
|
endif()
|
||||||
|
@ -298,7 +302,7 @@ Id flags: ${testflags}
|
||||||
# ...
|
# ...
|
||||||
# /path/to/cc ...CompilerId${lang}/...
|
# /path/to/cc ...CompilerId${lang}/...
|
||||||
# to extract the compiler front-end for the language.
|
# to extract the compiler front-end for the language.
|
||||||
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}/(\\./)?CompilerId${lang}[ \t\n\\\"]")
|
if("${CMAKE_${lang}_COMPILER_ID_OUTPUT}" MATCHES "\nLd[^\n]*(\n[ \t]+[^\n]*)*\n[ \t]+([^ \t\r\n]+)[^\r\n]*-o[^\r\n]*CompilerId${lang}(/CompilerId${lang}.xctest)?/(\\./)?CompilerId${lang}[ \t\n\\\"]")
|
||||||
set(_comp "${CMAKE_MATCH_2}")
|
set(_comp "${CMAKE_MATCH_2}")
|
||||||
if(EXISTS "${_comp}")
|
if(EXISTS "${_comp}")
|
||||||
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
|
set(CMAKE_${lang}_COMPILER_ID_TOOL "${_comp}" PARENT_SCOPE)
|
||||||
|
@ -366,7 +370,13 @@ ${CMAKE_${lang}_COMPILER_ID_OUTPUT}
|
||||||
# binary dir.
|
# binary dir.
|
||||||
file(GLOB files
|
file(GLOB files
|
||||||
RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR}
|
RELATIVE ${CMAKE_${lang}_COMPILER_ID_DIR}
|
||||||
${CMAKE_${lang}_COMPILER_ID_DIR}/*)
|
|
||||||
|
# normal case
|
||||||
|
${CMAKE_${lang}_COMPILER_ID_DIR}/*
|
||||||
|
|
||||||
|
# com.apple.package-type.bundle.unit-test
|
||||||
|
${CMAKE_${lang}_COMPILER_ID_DIR}/*.xctest/*
|
||||||
|
)
|
||||||
list(REMOVE_ITEM files "${src}")
|
list(REMOVE_ITEM files "${src}")
|
||||||
set(COMPILER_${lang}_PRODUCED_FILES "")
|
set(COMPILER_${lang}_PRODUCED_FILES "")
|
||||||
foreach(file ${files})
|
foreach(file ${files})
|
||||||
|
|
|
@ -29,7 +29,7 @@
|
||||||
);
|
);
|
||||||
name = CompilerId@id_lang@;
|
name = CompilerId@id_lang@;
|
||||||
productName = CompilerId@id_lang@;
|
productName = CompilerId@id_lang@;
|
||||||
productType = "com.apple.product-type.tool";
|
productType = "@id_product_type@";
|
||||||
};
|
};
|
||||||
08FB7793FE84155DC02AAC07 = {
|
08FB7793FE84155DC02AAC07 = {
|
||||||
isa = PBXProject;
|
isa = PBXProject;
|
||||||
|
|
Loading…
Reference in New Issue