2002-10-29 20:46:38 +00:00
|
|
|
# a simple C only test case
|
2008-03-25 15:27:18 +00:00
|
|
|
cmake_minimum_required (VERSION 2.6)
|
2012-08-13 17:47:32 +00:00
|
|
|
project (UseX11 CXX C)
|
2002-11-05 12:15:42 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
include (${CMAKE_ROOT}/Modules/FindX11.cmake)
|
|
|
|
message("X11_FOUND: ${X11_FOUND}")
|
2002-10-29 20:54:40 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
add_executable (UseX11 X11.c)
|
2009-01-21 16:54:30 +00:00
|
|
|
install(TARGETS UseX11 DESTINATION bin)
|
2002-10-29 20:46:38 +00:00
|
|
|
|
2012-08-13 17:42:58 +00:00
|
|
|
# so for universal binaries this test will fail if
|
|
|
|
#
|
2012-08-13 17:47:32 +00:00
|
|
|
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")
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
endif()
|
2006-03-24 14:15:05 +00:00
|
|
|
|
2012-08-13 17:47:32 +00:00
|
|
|
if(X11_FOUND)
|
|
|
|
add_definitions(-DCMAKE_HAS_X)
|
|
|
|
include_directories(${X11_INCLUDE_DIR})
|
|
|
|
target_link_libraries(UseX11 ${X11_LIBRARIES})
|
|
|
|
if(APPLE)
|
|
|
|
add_executable(HelloWorldX11 HelloWorldX11.cxx)
|
|
|
|
target_link_libraries(HelloWorldX11 ${X11_LIBRARIES})
|
2009-01-21 16:54:30 +00:00
|
|
|
install(TARGETS HelloWorldX11 DESTINATION bin)
|
|
|
|
|
2009-04-21 21:15:04 +00:00
|
|
|
set(CPACK_BINARY_OSXX11 ON CACHE BOOL "" FORCE)
|
2009-04-21 21:15:42 +00:00
|
|
|
set(CPACK_BINARY_PACKAGEMAKER OFF CACHE BOOL "" FORCE )
|
2008-04-11 14:23:27 +00:00
|
|
|
set(CPACK_PACKAGE_NAME HelloWorldX11Package)
|
|
|
|
set(CPACK_PACKAGE_EXECUTABLES HelloWorldX11 HelloWorldX11)
|
2012-08-13 17:50:14 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2009-01-21 16:54:30 +00:00
|
|
|
|
|
|
|
# build a CPack driven installer package
|
|
|
|
include(CPack)
|