Use correct default multiple architecture values in test

Even if CMAKE_OSX_ARCHITECTURES value is a single value...
This commit is contained in:
David Cole 2011-07-19 11:53:31 -04:00
parent 5f7acc8d75
commit 1a53fb7537
1 changed files with 10 additions and 9 deletions

View File

@ -1,8 +1,6 @@
cmake_minimum_required(VERSION 2.8) cmake_minimum_required(VERSION 2.8)
project(Architecture C) project(Architecture C)
set(archs i386 ppc)
function(test_for_xcode4 result_var) function(test_for_xcode4 result_var)
set(${result_var} 0 PARENT_SCOPE) set(${result_var} 0 PARENT_SCOPE)
if(APPLE) if(APPLE)
@ -19,10 +17,14 @@ endfunction()
test_for_xcode4(is_xcode4) test_for_xcode4(is_xcode4)
set(arch0 i386)
set(arch1 ppc)
if(is_xcode4) if(is_xcode4)
# Xcode 4, use modern architectures as defaults # Xcode 4, use modern architectures as defaults
# Arch 'ppc' no longer works: tools no longer available starting with Xcode 4 # Arch 'ppc' no longer works: tools no longer available starting with Xcode 4
set(archs i386 x86_64) set(arch0 i386)
set(arch1 x86_64)
endif() endif()
add_library(foo foo.c) add_library(foo foo.c)
@ -34,12 +36,11 @@ if(CMAKE_OSX_ARCHITECTURES)
"Expected [${CMAKE_OSX_ARCHITECTURES}], got [${archs}]." "Expected [${CMAKE_OSX_ARCHITECTURES}], got [${archs}]."
) )
endif() endif()
endif() list(LENGTH archs archs_len)
if(archs_len GREATER 1)
list(LENGTH archs archs_len) list(GET archs 0 arch0)
if(archs_len GREATER 1) list(GET archs 1 arch1)
list(GET archs 0 arch0) endif()
list(GET archs 1 arch1)
endif() endif()
message("is_xcode4='${is_xcode4}'") message("is_xcode4='${is_xcode4}'")