diff options
author | David Cole <david.cole@kitware.com> | 2011-07-15 18:51:22 (GMT) |
---|---|---|
committer | David Cole <david.cole@kitware.com> | 2011-07-15 19:02:59 (GMT) |
commit | 923b030ed989472bc421379eecc5f8c979dc6ccb (patch) | |
tree | eea9ed0ef3124d0b69d0f72b892297190109f343 /Tests/Architecture | |
parent | 8b238f4945e839fa4d7a3d87e612cfab2d4021cf (diff) | |
download | CMake-923b030ed989472bc421379eecc5f8c979dc6ccb.zip CMake-923b030ed989472bc421379eecc5f8c979dc6ccb.tar.gz CMake-923b030ed989472bc421379eecc5f8c979dc6ccb.tar.bz2 |
Fix Architecture test to work with Xcode 4
ppc tools are no longer available in the Xcode 4 installation.
Eliminate the use of the hard-coded 'ppc' in the test when
running on Snow Leopard or later.
Diffstat (limited to 'Tests/Architecture')
-rw-r--r-- | Tests/Architecture/CMakeLists.txt | 31 |
1 files changed, 27 insertions, 4 deletions
diff --git a/Tests/Architecture/CMakeLists.txt b/Tests/Architecture/CMakeLists.txt index bc767fe..db84ea9 100644 --- a/Tests/Architecture/CMakeLists.txt +++ b/Tests/Architecture/CMakeLists.txt @@ -1,6 +1,14 @@ cmake_minimum_required(VERSION 2.8) 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 + # Arch 'ppc' no longer works: tools no longer available starting with Xcode 4 + set(archs i386 x86_64) +endif() + add_library(foo foo.c) if(CMAKE_OSX_ARCHITECTURES) get_property(archs TARGET foo PROPERTY OSX_ARCHITECTURES) @@ -11,11 +19,26 @@ if(CMAKE_OSX_ARCHITECTURES) ) endif() endif() -set_property(TARGET foo PROPERTY OSX_ARCHITECTURES i386) -set_property(TARGET foo PROPERTY OSX_ARCHITECTURES_DEBUG ppc) + +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("archs='${archs}'") +message("arch0='${arch0}'") +message("arch1='${arch1}'") + +set_property(TARGET foo PROPERTY OSX_ARCHITECTURES ${arch0}) +set_property(TARGET foo PROPERTY OSX_ARCHITECTURES_DEBUG ${arch1}) add_executable(bar bar.c) target_link_libraries(bar foo) + set_property(TARGET bar PROPERTY OUTPUT_NAME Architecture) -set_property(TARGET bar PROPERTY OSX_ARCHITECTURES ppc) -set_property(TARGET bar PROPERTY OSX_ARCHITECTURES_DEBUG i386) +set_property(TARGET bar PROPERTY OSX_ARCHITECTURES ${arch1}) +set_property(TARGET bar PROPERTY OSX_ARCHITECTURES_DEBUG ${arch0}) |