summaryrefslogtreecommitdiff
path: root/Tests
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2006-03-24 09:15:05 -0500
committerBill Hoffman <bill.hoffman@kitware.com>2006-03-24 09:15:05 -0500
commitf7c1723135f140eaac1ee02c31c0339761778f22 (patch)
treeae4858167f38f2e57c3dcf442fbfe83aeea1cc82 /Tests
parentcec6543d0d7e0f8302b092f3ff66fb240bc212c4 (diff)
downloadcmake-f7c1723135f140eaac1ee02c31c0339761778f22.tar.gz
ENH: add support for universal binaries
Diffstat (limited to 'Tests')
-rw-r--r--Tests/ExternalOBJ/CMakeLists.txt10
-rw-r--r--Tests/ExternalOBJ/Object/CMakeLists.txt9
-rw-r--r--Tests/X11/CMakeLists.txt12
3 files changed, 31 insertions, 0 deletions
diff --git a/Tests/ExternalOBJ/CMakeLists.txt b/Tests/ExternalOBJ/CMakeLists.txt
index cf95dc578a..e5c5657b73 100644
--- a/Tests/ExternalOBJ/CMakeLists.txt
+++ b/Tests/ExternalOBJ/CMakeLists.txt
@@ -1,5 +1,15 @@
PROJECT (ExternalOBJ)
+IF(APPLE)
+ # set _CMAKE_OSX_MACHINE to umame -m
+ EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE)
+ # check for Power PC and change to ppc
+ IF("${_CMAKE_OSX_MACHINE}" MATCHES "Power")
+ SET(_CMAKE_OSX_MACHINE ppc)
+ ENDIF("${_CMAKE_OSX_MACHINE}" MATCHES "Power")
+ SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE})
+ENDIF(APPLE)
+
# Build the external object file.
TRY_COMPILE(EXTERNAL_OBJECT_BUILT
${ExternalOBJ_BINARY_DIR}/Object
diff --git a/Tests/ExternalOBJ/Object/CMakeLists.txt b/Tests/ExternalOBJ/Object/CMakeLists.txt
index 141af79077..7c01e54da5 100644
--- a/Tests/ExternalOBJ/Object/CMakeLists.txt
+++ b/Tests/ExternalOBJ/Object/CMakeLists.txt
@@ -1,3 +1,12 @@
PROJECT(Object)
+IF(APPLE)
+ # set _CMAKE_OSX_MACHINE to umame -m
+ EXEC_PROGRAM(uname ARGS -m OUTPUT_VARIABLE _CMAKE_OSX_MACHINE)
+ # check for Power PC and change to ppc
+ IF("${_CMAKE_OSX_MACHINE}" MATCHES "Power")
+ SET(_CMAKE_OSX_MACHINE ppc)
+ ENDIF("${_CMAKE_OSX_MACHINE}" MATCHES "Power")
+ SET(CMAKE_OSX_ARCHITECTURES ${_CMAKE_OSX_MACHINE})
+ENDIF(APPLE)
ADD_EXECUTABLE(external external_object.cxx external_main.cxx)
diff --git a/Tests/X11/CMakeLists.txt b/Tests/X11/CMakeLists.txt
index 9dc1e46ea5..f0652578fb 100644
--- a/Tests/X11/CMakeLists.txt
+++ b/Tests/X11/CMakeLists.txt
@@ -6,6 +6,18 @@ MESSAGE("X11_FOUND: ${X11_FOUND}")
ADD_EXECUTABLE (UseX11 X11.c)
+# so for universal binaries this test will fail if
+#
+IF(APPLE)
+ LIST(LENGTH CMAKE_OSX_ARCHITECTURES NUMARCH)
+ IF(NUMARCH GREATER 1)
+ IF(NOT EXISTS /usr/X11R6/lib//libSM.6.dylib)
+ SET(X11_FOUND FALSE)
+ MESSAGE("disable X11, because of universal binary and sysroot")
+ ENDIF(NOT EXISTS /usr/X11R6/lib//libSM.6.dylib)
+ ENDIF(NUMARCH GREATER 1)
+ENDIF(APPLE)
+
IF(X11_FOUND)
ADD_DEFINITIONS(-DCMAKE_HAS_X)
INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})