summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorDavid Cole <david.cole@kitware.com>2011-07-18 13:59:58 (GMT)
committerDavid Cole <david.cole@kitware.com>2011-07-18 13:59:58 (GMT)
commit5f7acc8d75d736905d9f54badebc80ad196e8877 (patch)
tree8280f6f914d24d9883186d75257478147f7b5754 /Tests
parentc050c592eef00a13bfc1e9bf31e45b2005588ccf (diff)
downloadCMake-5f7acc8d75d736905d9f54badebc80ad196e8877.zip
CMake-5f7acc8d75d736905d9f54badebc80ad196e8877.tar.gz
CMake-5f7acc8d75d736905d9f54badebc80ad196e8877.tar.bz2
Base architecture choice logic on Xcode version
Not on Darwin version.
Diffstat (limited to 'Tests')
-rw-r--r--Tests/Architecture/CMakeLists.txt24
-rw-r--r--Tests/BuildDepends/Project/CMakeLists.txt20
2 files changed, 37 insertions, 7 deletions
diff --git a/Tests/Architecture/CMakeLists.txt b/Tests/Architecture/CMakeLists.txt
index db84ea9..c210727 100644
--- a/Tests/Architecture/CMakeLists.txt
+++ b/Tests/Architecture/CMakeLists.txt
@@ -3,8 +3,24 @@ project(Architecture C)
set(archs i386 ppc)
-if(NOT "${DARWIN_MAJOR_VERSION}.${DARWIN_MINOR_VERSION}" VERSION_LESS 10.0)
- # Snow Leopard or later, use modern architectures as defaults
+function(test_for_xcode4 result_var)
+ set(${result_var} 0 PARENT_SCOPE)
+ if(APPLE)
+ execute_process(COMMAND xcodebuild -version
+ OUTPUT_VARIABLE ov RESULT_VARIABLE rv
+ )
+ if("${rv}" STREQUAL "0")
+ if(ov MATCHES "^Xcode 4.[0-9].*$")
+ set(${result_var} 1 PARENT_SCOPE)
+ endif()
+ endif()
+ endif()
+endfunction()
+
+test_for_xcode4(is_xcode4)
+
+if(is_xcode4)
+ # Xcode 4, use modern architectures as defaults
# Arch 'ppc' no longer works: tools no longer available starting with Xcode 4
set(archs i386 x86_64)
endif()
@@ -24,11 +40,9 @@ list(LENGTH archs archs_len)
if(archs_len GREATER 1)
list(GET archs 0 arch0)
list(GET archs 1 arch1)
-else()
- set(arch0 ${archs})
- set(arch1 ${archs})
endif()
+message("is_xcode4='${is_xcode4}'")
message("archs='${archs}'")
message("arch0='${arch0}'")
message("arch1='${arch1}'")
diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt
index f03c238..a977884 100644
--- a/Tests/BuildDepends/Project/CMakeLists.txt
+++ b/Tests/BuildDepends/Project/CMakeLists.txt
@@ -1,11 +1,27 @@
cmake_minimum_required(VERSION 2.6)
project(testRebuild)
+
+function(test_for_xcode4 result_var)
+ set(${result_var} 0 PARENT_SCOPE)
+ if(APPLE)
+ execute_process(COMMAND xcodebuild -version
+ OUTPUT_VARIABLE ov RESULT_VARIABLE rv
+ )
+ if("${rv}" STREQUAL "0")
+ if(ov MATCHES "^Xcode 4.[0-9].*$")
+ set(${result_var} 1 PARENT_SCOPE)
+ endif()
+ endif()
+ endif()
+endfunction()
+
if(APPLE)
# only use multi-arch if the sysroot exists on this machine
if(EXISTS "${CMAKE_OSX_SYSROOT}")
set(CMAKE_OSX_ARCHITECTURES "ppc;i386")
- if(NOT "${DARWIN_MAJOR_VERSION}.${DARWIN_MINOR_VERSION}" VERSION_LESS 10.0)
- # Snow Leopard or later, use modern architectures as defaults
+ test_for_xcode4(is_xcode4)
+ if(is_xcode4)
+ # Xcode 4, use modern architectures as defaults
# Arch 'ppc' no longer works: tools no longer available starting with Xcode 4
set(CMAKE_OSX_ARCHITECTURES i386 x86_64)
endif()