2002-10-29 23:46:38 +03:00
|
|
|
# a simple C only test case
|
2008-03-25 18:27:18 +03:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
2008-04-11 18:23:27 +04:00
|
|
|
PROJECT (UseX11 CXX C)
|
2002-11-05 15:15:42 +03:00
|
|
|
|
2002-12-17 21:28:49 +03:00
|
|
|
INCLUDE (${CMAKE_ROOT}/Modules/FindX11.cmake)
|
2004-07-29 19:11:05 +04:00
|
|
|
MESSAGE("X11_FOUND: ${X11_FOUND}")
|
2002-10-29 23:54:40 +03:00
|
|
|
|
2002-12-18 17:38:34 +03:00
|
|
|
ADD_EXECUTABLE (UseX11 X11.c)
|
2009-01-21 19:54:30 +03:00
|
|
|
install(TARGETS UseX11 DESTINATION bin)
|
2002-10-29 23:46:38 +03:00
|
|
|
|
2006-03-24 17:15:05 +03:00
|
|
|
# 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)
|
|
|
|
|
2004-07-29 19:11:05 +04:00
|
|
|
IF(X11_FOUND)
|
2002-12-17 21:28:49 +03:00
|
|
|
ADD_DEFINITIONS(-DCMAKE_HAS_X)
|
2003-01-08 19:53:55 +03:00
|
|
|
INCLUDE_DIRECTORIES(${X11_INCLUDE_DIR})
|
2004-07-29 19:11:05 +04:00
|
|
|
TARGET_LINK_LIBRARIES(UseX11 ${X11_LIBRARIES})
|
2008-04-11 18:23:27 +04:00
|
|
|
IF(APPLE)
|
|
|
|
ADD_EXECUTABLE(HelloWorldX11 HelloWorldX11.cxx)
|
|
|
|
TARGET_LINK_LIBRARIES(HelloWorldX11 ${X11_LIBRARIES})
|
2009-01-21 19:54:30 +03:00
|
|
|
install(TARGETS HelloWorldX11 DESTINATION bin)
|
|
|
|
|
|
|
|
set(CPACK_BINARY_OSXX11 "ON")
|
|
|
|
set(CPACK_BINARY_PACKAGEMAKER "OFF")
|
2008-04-11 18:23:27 +04:00
|
|
|
set(CPACK_PACKAGE_NAME HelloWorldX11Package)
|
|
|
|
set(CPACK_PACKAGE_EXECUTABLES HelloWorldX11 HelloWorldX11)
|
|
|
|
ENDIF(APPLE)
|
2004-07-29 19:11:05 +04:00
|
|
|
ENDIF(X11_FOUND)
|
2009-01-21 19:54:30 +03:00
|
|
|
|
|
|
|
# build a CPack driven installer package
|
|
|
|
include(CPack)
|