mirror of
https://github.com/Kitware/CMake.git
synced 2026-03-14 13:30:29 -05:00
Tests/Architecture: Have test support Xcode 10+
This commit is contained in:
@@ -1,30 +1,21 @@
|
|||||||
cmake_minimum_required(VERSION 3.5)
|
cmake_minimum_required(VERSION 3.5)
|
||||||
project(Architecture C)
|
project(Architecture C)
|
||||||
|
|
||||||
function(test_for_xcode4 result_var)
|
if (CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 12)
|
||||||
set(${result_var} 0 PARENT_SCOPE)
|
# Since Xcode 12 we have two architectures again: arm64 and x86_64.
|
||||||
if(APPLE)
|
set(arch0 x86_64)
|
||||||
execute_process(COMMAND xcodebuild -version
|
set(arch1 arm64)
|
||||||
OUTPUT_VARIABLE ov RESULT_VARIABLE rv
|
elseif(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 10)
|
||||||
)
|
# Xcode 10 / 11 do not have two supported architectures for the host.
|
||||||
if("${rv}" STREQUAL "0" AND ov MATCHES "^Xcode ([0-9]+)\\.")
|
message(STATUS "Skip test x86_64 only")
|
||||||
if(NOT CMAKE_MATCH_1 VERSION_LESS 4)
|
return()
|
||||||
set(${result_var} 1 PARENT_SCOPE)
|
elseif(CMake_TEST_XCODE_VERSION VERSION_GREATER_EQUAL 4)
|
||||||
endif()
|
# Xcode 4 no longer supports ppc, but does support x86_64.
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
endfunction()
|
|
||||||
|
|
||||||
test_for_xcode4(is_xcode4)
|
|
||||||
|
|
||||||
set(arch0 i386)
|
|
||||||
set(arch1 ppc)
|
|
||||||
|
|
||||||
if(is_xcode4)
|
|
||||||
# Xcode 4, use modern architectures as defaults
|
|
||||||
# Arch 'ppc' no longer works: tools no longer available starting with Xcode 4
|
|
||||||
set(arch0 i386)
|
set(arch0 i386)
|
||||||
set(arch1 x86_64)
|
set(arch1 x86_64)
|
||||||
|
else()
|
||||||
|
set(arch0 i386)
|
||||||
|
set(arch1 ppc)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
add_library(foo foo.c)
|
add_library(foo foo.c)
|
||||||
@@ -43,7 +34,6 @@ if(CMAKE_OSX_ARCHITECTURES)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
message("is_xcode4='${is_xcode4}'")
|
|
||||||
message("archs='${archs}'")
|
message("archs='${archs}'")
|
||||||
message("arch0='${arch0}'")
|
message("arch0='${arch0}'")
|
||||||
message("arch1='${arch1}'")
|
message("arch1='${arch1}'")
|
||||||
|
|||||||
@@ -578,10 +578,13 @@ if(BUILD_TESTING)
|
|||||||
if("${CMAKE_GENERATOR}" MATCHES "Make")
|
if("${CMAKE_GENERATOR}" MATCHES "Make")
|
||||||
ADD_TEST_MACRO(Policy0002 Policy0002)
|
ADD_TEST_MACRO(Policy0002 Policy0002)
|
||||||
endif()
|
endif()
|
||||||
if(CTEST_TEST_OSX_ARCH)
|
if(CMake_TEST_XCODE_VERSION)
|
||||||
|
set(Architecture_BUILD_OPTIONS -DCMake_TEST_XCODE_VERSION=${CMake_TEST_XCODE_VERSION})
|
||||||
ADD_TEST_MACRO(Architecture Architecture)
|
ADD_TEST_MACRO(Architecture Architecture)
|
||||||
set_tests_properties(Architecture PROPERTIES
|
set_tests_properties(Architecture PROPERTIES
|
||||||
PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked|but attempting to link with file built for)")
|
PASS_REGULAR_EXPRESSION "(file is not of required architecture|does not match cputype|not the architecture being linked|but attempting to link with file built for)")
|
||||||
|
set_property(TEST Architecture APPEND PROPERTY
|
||||||
|
PASS_REGULAR_EXPRESSION "Skip test x86_64 only|found architecture '.*', required architecture '.*'")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
|
list(APPEND TEST_BUILD_DIRS ${CMake_TEST_INSTALL_PREFIX})
|
||||||
|
|||||||
Reference in New Issue
Block a user