Get the Unix stuff to build using CMake. Based on a patch by Henrik Andersson.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@4336 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 58bb224..83926e7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -15,6 +15,11 @@
 # The RC version must always be four comma-separated numbers
 set(RCVERSION 1,0,90,0)
 
+# Compatibility variables for the migration from autotools
+add_definitions(-DPACKAGE_NAME="${CMAKE_PROJECT_NAME}")
+add_definitions(-DPACKAGE_VERSION="${VERSION}")
+add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_PREFIX}/share/locale")
+
 # Try to encode today's date into the build id. We assume that MSVC
 # means we need to use a native Windows method, otherwise we assume
 # some kind of Unix system. The id will be empty if things fail.
@@ -101,6 +106,11 @@
     "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> --output-format=coff <SOURCE>")
 endif()
 
+# X11 stuff. It's in a if() so that we can say REQUIRED
+if(UNIX)
+  find_package(X11 REQUIRED)
+endif()
+
 # Check for zlib
 find_package(ZLIB)
 option(USE_INCLUDED_ZLIB "Force use of the bundled zlib")
@@ -163,4 +173,9 @@
 include_directories(${CMAKE_BINARY_DIR})
 
 add_subdirectory(common)
-add_subdirectory(win)
+
+if(WIN32)
+  add_subdirectory(win)
+else()
+  add_subdirectory(unix)
+endif()