diff options
Diffstat (limited to 'Tests')
-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}) |