summaryrefslogtreecommitdiffstats
path: root/Tests/X11/CMakeLists.txt
blob: 28b41edc9afa33a7e985e85c0666e4b3d4925bde (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# a simple C only test case
cmake_minimum_required (VERSION 2.6)
PROJECT (UseX11 C)

INCLUDE (${CMAKE_ROOT}/Modules/FindX11.cmake)
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})
  TARGET_LINK_LIBRARIES(UseX11 ${X11_LIBRARIES})
ENDIF(X11_FOUND)