DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 1 | # |
| 2 | # Setup |
| 3 | # |
| 4 | |
DRC | aeff331 | 2011-06-07 04:51:57 +0000 | [diff] [blame] | 5 | cmake_minimum_required(VERSION 2.8) |
DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 6 | |
Pierre Ossman | b232b5f | 2011-04-28 14:38:04 +0000 | [diff] [blame] | 7 | # Internal cmake modules |
| 8 | set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/Modules) |
| 9 | |
Pierre Ossman | 7f44326 | 2011-03-08 13:06:46 +0000 | [diff] [blame] | 10 | include(CheckIncludeFiles) |
| 11 | include(CheckFunctionExists) |
Pierre Ossman | b232b5f | 2011-04-28 14:38:04 +0000 | [diff] [blame] | 12 | include(CheckLibraryExists) |
Pierre Ossman | 7f44326 | 2011-03-08 13:06:46 +0000 | [diff] [blame] | 13 | include(CheckTypeSize) |
| 14 | include(CheckCSourceCompiles) |
Pierre Ossman | 89f868a | 2011-04-11 11:59:31 +0000 | [diff] [blame] | 15 | include(CheckCXXSourceCompiles) |
Pierre Ossman | 7f44326 | 2011-03-08 13:06:46 +0000 | [diff] [blame] | 16 | |
Henrik Andersson | 23029cc | 2011-06-09 09:13:23 +0000 | [diff] [blame] | 17 | include(CMakeMacroLibtoolFile) |
| 18 | |
Peter Åstrand | bb445ef | 2011-04-28 09:29:13 +0000 | [diff] [blame] | 19 | project(tigervnc) |
DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 20 | set(VERSION 1.0.90) |
| 21 | |
| 22 | # The RC version must always be four comma-separated numbers |
| 23 | set(RCVERSION 1,0,90,0) |
| 24 | |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 25 | # Manual toggle until we can deprecate the old viewers |
| 26 | option(BUILD_NEW_VNCVIEWER "Build the new FLTK based vncviewer instead of the old ones") |
| 27 | |
Pierre Ossman | 8f64ef7 | 2011-03-08 16:32:49 +0000 | [diff] [blame] | 28 | # Compatibility variables for the migration from autotools |
| 29 | add_definitions(-DPACKAGE_NAME="${CMAKE_PROJECT_NAME}") |
| 30 | add_definitions(-DPACKAGE_VERSION="${VERSION}") |
| 31 | add_definitions(-DLOCALEDIR="${CMAKE_INSTALL_PREFIX}/share/locale") |
| 32 | |
Pierre Ossman | e811516 | 2011-03-03 12:51:38 +0000 | [diff] [blame] | 33 | # Try to encode today's date into the build id. We assume that MSVC |
| 34 | # means we need to use a native Windows method, otherwise we assume |
| 35 | # some kind of Unix system. The id will be empty if things fail. |
| 36 | set(BUILD "") |
| 37 | if(MSVC) |
Pierre Ossman | b232b5f | 2011-04-28 14:38:04 +0000 | [diff] [blame] | 38 | execute_process(COMMAND "${CMAKE_SOURCE_DIR}/cmake/getdate.bat" |
DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 39 | OUTPUT_VARIABLE BUILD) |
DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 40 | else() |
Pierre Ossman | e811516 | 2011-03-03 12:51:38 +0000 | [diff] [blame] | 41 | execute_process(COMMAND "date" "+%Y%m%d" OUTPUT_VARIABLE BUILD) |
| 42 | endif() |
| 43 | |
| 44 | if(NOT BUILD) |
| 45 | set(BUILD "") |
| 46 | else() |
| 47 | string(REGEX REPLACE "\n" "" BUILD ${BUILD}) |
DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 48 | endif() |
| 49 | |
Pierre Ossman | 2c66a63 | 2011-03-03 12:52:59 +0000 | [diff] [blame] | 50 | # Default to optimised builds instead of debug ones. Our code has no bugs ;) |
| 51 | # (CMake makes it fairly easy to toggle this back to Debug if needed) |
DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 52 | if(NOT CMAKE_BUILD_TYPE) |
| 53 | set(CMAKE_BUILD_TYPE Release) |
| 54 | endif() |
| 55 | |
| 56 | message(STATUS "CMAKE_BUILD_TYPE = ${CMAKE_BUILD_TYPE}") |
| 57 | |
| 58 | # This only works if building from the command line. There is currently no way |
| 59 | # to set a variable's value based on the build type when using the MSVC IDE. |
| 60 | if(CMAKE_BUILD_TYPE STREQUAL "Debug") |
| 61 | set(BUILD "${BUILD}d") |
| 62 | endif() |
| 63 | |
| 64 | message(STATUS "VERSION = ${VERSION}, BUILD = ${BUILD}") |
| 65 | |
| 66 | if(NOT DEFINED BUILD_WINVNC) |
| 67 | if(MSVC) |
| 68 | set(BUILD_WINVNC 1) |
| 69 | else() |
| 70 | set(BUILD_WINVNC 0) |
| 71 | endif() |
| 72 | endif() |
| 73 | |
| 74 | if(MSVC) |
| 75 | # Use the static C library for all build types |
| 76 | foreach(var CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE |
| 77 | CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO |
| 78 | CMAKE_CXX_FLAGS CMAKE_CXX_FLAGS_DEBUG CMAKE_CXX_FLAGS_RELEASE |
| 79 | CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_RELWITHDEBINFO) |
| 80 | if(${var} MATCHES "/MD") |
| 81 | string(REGEX REPLACE "/MD" "/MT" ${var} "${${var}}") |
| 82 | endif() |
| 83 | endforeach() |
| 84 | |
| 85 | # NOTE: 4244 and 4267 are 64-bit to 32-bit conversion warnings, so normally |
| 86 | # it is not a good idea to disable them, but we do this to duplicate the |
| 87 | # behavior of GCC, which is less strict. |
| 88 | add_definitions(-wd4244 -wd4267 -wd4800 -wd4996) |
| 89 | endif() |
| 90 | |
Pierre Ossman | 9640f44 | 2011-03-08 13:12:33 +0000 | [diff] [blame] | 91 | # Minimum version is Windows 2000 (5.0) |
DRC | 2301beb | 2011-06-22 05:46:53 +0000 | [diff] [blame] | 92 | if(WIN32) |
| 93 | if(NOT CMAKE_SIZEOF_VOID_P MATCHES 8) |
| 94 | add_definitions(-D_WIN32_IE=0x0500 -D_WIN32_WINNT=0x0500) |
| 95 | else() |
| 96 | # Win64 doesn't like us requesting a Windows version that didn't have |
| 97 | # 64-bit support. Request XP (5.1) instead. |
| 98 | add_definitions(-D_WIN32_IE=0x0501 -D_WIN32_WINNT=0x0501) |
| 99 | endif() |
Pierre Ossman | 9640f44 | 2011-03-08 13:12:33 +0000 | [diff] [blame] | 100 | endif() |
| 101 | |
Pierre Ossman | 69314c7 | 2011-03-08 12:18:13 +0000 | [diff] [blame] | 102 | if(CMAKE_SIZEOF_VOID_P MATCHES 8) |
DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 103 | message(STATUS "64-bit build") |
| 104 | else() |
| 105 | message(STATUS "32-bit build") |
| 106 | endif() |
| 107 | |
| 108 | # CMake doesn't properly support resource compilation with MinGW. Boo! |
| 109 | if(MINGW) |
| 110 | if(NOT DEFINED RC) |
| 111 | set(CMAKE_RC_COMPILER_INIT windres) |
| 112 | else() |
| 113 | set(CMAKE_RC_COMPILER_INIT ${RC}) |
| 114 | endif() |
| 115 | enable_language(RC) |
| 116 | message(STATUS "Resource compiler: ${CMAKE_RC_COMPILER}") |
| 117 | set(CMAKE_RC_COMPILE_OBJECT |
| 118 | "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -o <OBJECT> --output-format=coff <SOURCE>") |
| 119 | endif() |
| 120 | |
Pierre Ossman | 8f64ef7 | 2011-03-08 16:32:49 +0000 | [diff] [blame] | 121 | # X11 stuff. It's in a if() so that we can say REQUIRED |
| 122 | if(UNIX) |
| 123 | find_package(X11 REQUIRED) |
| 124 | endif() |
| 125 | |
Pierre Ossman | a7769f2 | 2011-03-03 09:44:49 +0000 | [diff] [blame] | 126 | # Check for zlib |
| 127 | find_package(ZLIB) |
| 128 | option(USE_INCLUDED_ZLIB "Force use of the bundled zlib") |
| 129 | if(NOT ZLIB_FOUND) |
| 130 | message(STATUS "System zlib not found. Using included zlib") |
| 131 | set(USE_INCLUDED_ZLIB 1) |
| 132 | endif() |
| 133 | |
Peter Åstrand | bb445ef | 2011-04-28 09:29:13 +0000 | [diff] [blame] | 134 | # Check for gettext |
| 135 | option(ENABLE_NLS "Enable translation of program messages" ON) |
Pierre Ossman | b232b5f | 2011-04-28 14:38:04 +0000 | [diff] [blame] | 136 | if(ENABLE_NLS) |
| 137 | # Tools |
| 138 | find_package(Gettext REQUIRED) |
| 139 | set(LOCALE_DIR "${CMAKE_INSTALL_PREFIX}/share/locale") |
| 140 | |
| 141 | # Gettext needs iconv |
| 142 | find_package(Iconv REQUIRED) |
| 143 | |
| 144 | # Headers and libraries (copied from licq) |
| 145 | set(GETTEXT_FOUND FALSE) |
| 146 | |
| 147 | find_path(GETTEXT_INCLUDE_DIR libintl.h) |
| 148 | if(GETTEXT_INCLUDE_DIR) |
| 149 | set(CMAKE_REQUIRED_LIBRARIES ${ICONV_LIBRARIES}) |
| 150 | check_function_exists(dgettext LIBC_HAS_DGETTEXT) |
| 151 | if(LIBC_HAS_DGETTEXT) |
| 152 | set(GETTEXT_FOUND TRUE) |
| 153 | else() |
| 154 | find_library(LIBINTL_LIBRARY NAMES intl libintl) |
| 155 | check_library_exists(${LIBINTL_LIBRARY} "dgettext" "" LIBINTL_HAS_DGETTEXT) |
| 156 | if(LIBINTL_HAS_DGETTEXT) |
DRC | 61729dc | 2011-06-22 06:00:57 +0000 | [diff] [blame] | 157 | set(GETTEXT_LIBRARIES ${LIBINTL_LIBRARY} ${ICONV_LIBRARIES}) |
Pierre Ossman | b232b5f | 2011-04-28 14:38:04 +0000 | [diff] [blame] | 158 | set(GETTEXT_FOUND TRUE) |
| 159 | endif() |
| 160 | endif() |
| 161 | set(CMAKE_REQUIRED_LIBRARIES) |
| 162 | endif() |
| 163 | |
| 164 | if(NOT GETTEXT_FOUND) |
| 165 | message(FATAL_ERROR "Gettext NOT found") |
| 166 | endif() |
| 167 | endif() |
Peter Åstrand | bb445ef | 2011-04-28 09:29:13 +0000 | [diff] [blame] | 168 | |
Pierre Ossman | 4c6bd4c | 2011-03-03 09:55:21 +0000 | [diff] [blame] | 169 | # Check for libjpeg |
| 170 | find_package(JPEG REQUIRED) |
| 171 | |
Pierre Ossman | 6fa0749 | 2011-03-04 11:35:24 +0000 | [diff] [blame] | 172 | # Warn if it doesn't seem to be the accelerated libjpeg that's found |
DRC | 63b40b7 | 2011-06-07 01:47:38 +0000 | [diff] [blame] | 173 | set(CMAKE_REQUIRED_LIBRARIES ${JPEG_LIBRARIES}) |
| 174 | set(CMAKE_REQUIRED_FLAGS -I${JPEG_INCLUDE_DIR}) |
DRC | fe06e61 | 2011-06-07 01:55:12 +0000 | [diff] [blame] | 175 | |
Pierre Ossman | 6fa0749 | 2011-03-04 11:35:24 +0000 | [diff] [blame] | 176 | check_c_source_compiles("#include <stdio.h>\n#include <jpeglib.h>\nint main(int c, char** v) { return JCS_EXT_RGBX; }" FOUND_JPEG_TURBO) |
DRC | fe06e61 | 2011-06-07 01:55:12 +0000 | [diff] [blame] | 177 | |
| 178 | set(CMAKE_REQUIRED_LIBRARIES) |
| 179 | set(CMAKE_REQUIRED_FLAGS) |
| 180 | |
Pierre Ossman | 6fa0749 | 2011-03-04 11:35:24 +0000 | [diff] [blame] | 181 | if(NOT FOUND_JPEG_TURBO) |
| 182 | message(STATUS "WARNING: You are not using libjpeg-turbo. Performance will suffer.") |
| 183 | endif() |
| 184 | |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 185 | # Check for FLTK |
| 186 | if(BUILD_NEW_VNCVIEWER) |
| 187 | set(FLTK_SKIP_FLUID TRUE) |
| 188 | set(FLTK_SKIP_OPENGL TRUE) |
| 189 | find_package(FLTK COMPONENTS REQUIRED) |
Pierre Ossman | 89f868a | 2011-04-11 11:59:31 +0000 | [diff] [blame] | 190 | |
Pierre Ossman | 4a6be4a | 2011-05-19 14:49:18 +0000 | [diff] [blame] | 191 | # No proper handling for extra X11 libs that FLTK might need... |
Pierre Ossman | 34dde79 | 2011-05-24 07:49:09 +0000 | [diff] [blame] | 192 | if(X11_Xft_FOUND) |
| 193 | set(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${X11_Xft_LIB}) |
| 194 | endif() |
| 195 | if(X11_Xinerama_FOUND) |
| 196 | set(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${X11_Xinerama_LIB}) |
| 197 | endif() |
Pierre Ossman | 4a6be4a | 2011-05-19 14:49:18 +0000 | [diff] [blame] | 198 | if(X11_Xfixes_FOUND) |
| 199 | set(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${X11_Xfixes_LIB}) |
| 200 | endif() |
Pierre Ossman | 835b4ef | 2011-06-08 17:02:36 +0000 | [diff] [blame] | 201 | if(X11_Xcursor_FOUND) |
| 202 | set(FLTK_LIBRARIES ${FLTK_LIBRARIES} ${X11_Xcursor_LIB}) |
| 203 | endif() |
Pierre Ossman | 4a6be4a | 2011-05-19 14:49:18 +0000 | [diff] [blame] | 204 | |
Pierre Ossman | 89f868a | 2011-04-11 11:59:31 +0000 | [diff] [blame] | 205 | set(CMAKE_REQUIRED_INCLUDES ${FLTK_INCLUDE_DIR}) |
| 206 | set(CMAKE_REQUIRED_LIBRARIES ${FLTK_LIBRARIES}) |
Pierre Ossman | 4a6be4a | 2011-05-19 14:49:18 +0000 | [diff] [blame] | 207 | |
| 208 | # FLTK STR #2599 |
DRC | fdb348e | 2011-06-10 17:29:35 +0000 | [diff] [blame] | 209 | check_cxx_source_compiles("#include <FL/Fl_Widget.H>\nint main(int c, char** v) { void (Fl_Widget::*foo)() = &Fl_Widget::set_simple_keyboard; return 0; }" HAVE_FLTK_DEAD_KEYS) |
Pierre Ossman | 4a6be4a | 2011-05-19 14:49:18 +0000 | [diff] [blame] | 210 | |
| 211 | # FLTK STR #2636 |
| 212 | check_cxx_source_compiles("#include <FL/Fl.H>\nint main(int c, char** v) { Fl::add_clipboard_notify(NULL, NULL); return 0; }" HAVE_FLTK_CLIPBOARD) |
| 213 | |
Pierre Ossman | cb0cffe | 2011-05-20 14:55:10 +0000 | [diff] [blame] | 214 | # FLTK STR #2638 |
| 215 | check_cxx_source_compiles("#include <FL/Enumerations.H>\nint main(int c, char** v) { return FL_Volume_Down; }" HAVE_FLTK_MEDIAKEYS) |
| 216 | |
Pierre Ossman | 4c613d3 | 2011-05-26 14:14:06 +0000 | [diff] [blame] | 217 | # FLTK STR #2641 |
| 218 | check_cxx_source_compiles("#include <FL/Enumerations.H>\nint main(int c, char** v) { return FL_FULLSCREEN; }" HAVE_FLTK_FULLSCREEN) |
| 219 | |
Pierre Ossman | 835b4ef | 2011-06-08 17:02:36 +0000 | [diff] [blame] | 220 | # FLTK STR #2660 |
| 221 | check_cxx_source_compiles("#include <FL/Fl_Window.H>\nint main(int c, char** v) { void (Fl_Window::*foo)(const Fl_RGB_Image*,int,int) = &Fl_Window::cursor; return 0; }" HAVE_FLTK_CURSOR) |
| 222 | |
Pierre Ossman | 89f868a | 2011-04-11 11:59:31 +0000 | [diff] [blame] | 223 | set(CMAKE_REQUIRED_INCLUDES) |
| 224 | set(CMAKE_REQUIRED_LIBRARIES) |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 225 | endif() |
| 226 | |
Adam Tkac | 125bd25 | 2011-01-19 14:20:34 +0000 | [diff] [blame] | 227 | # Check for GNUTLS library |
Pierre Ossman | 9506420 | 2011-05-30 12:22:39 +0000 | [diff] [blame] | 228 | option(ENABLE_GNUTLS "Enable protocol encryption and advanced authentication" ON) |
Pierre Ossman | 32c88c4 | 2011-05-27 11:50:58 +0000 | [diff] [blame] | 229 | if(ENABLE_GNUTLS) |
Pierre Ossman | 9506420 | 2011-05-30 12:22:39 +0000 | [diff] [blame] | 230 | find_package(GnuTLS) |
| 231 | if (GNUTLS_FOUND) |
| 232 | include_directories(${GNUTLS_INCLUDE_DIR}) |
| 233 | add_definitions("-DHAVE_GNUTLS") |
| 234 | add_definitions(${GNUTLS_DEFINITIONS}) |
| 235 | |
| 236 | # Detect old version of GnuTLS |
DRC | 17331b9 | 2011-06-07 04:07:20 +0000 | [diff] [blame] | 237 | set(CMAKE_REQUIRED_FLAGS -I${GNUTLS_INCLUDE_DIR}) |
Pierre Ossman | 9506420 | 2011-05-30 12:22:39 +0000 | [diff] [blame] | 238 | set(CMAKE_EXTRA_INCLUDE_FILES gnutls/gnutls.h) |
DRC | 17331b9 | 2011-06-07 04:07:20 +0000 | [diff] [blame] | 239 | set(CMAKE_REQUIRED_LIBRARIES ${GNUTLS_LIBRARIES}) |
| 240 | if(ZLIB_FOUND) |
| 241 | # When we build against the static version of GnuTLS, we also use the |
| 242 | # included version of Zlib, but it isn't built yet, so we have to use the |
| 243 | # system's version (if available) to perform this test. |
| 244 | set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES};-lz) |
| 245 | endif() |
Pierre Ossman | 9506420 | 2011-05-30 12:22:39 +0000 | [diff] [blame] | 246 | check_function_exists(gnutls_transport_set_global_errno HAVE_OLD_GNUTLS) |
| 247 | check_function_exists(gnutls_x509_crt_print HAVE_GNUTLS_X509_CRT_PRINT) |
| 248 | check_type_size(gnutls_x509_crt_t GNUTLS_X509_CRT_T) |
| 249 | check_type_size(gnutls_datum_t GNUTLS_DATUM_T) |
| 250 | check_type_size(gnutls_pk_algorithm_t GNUTLS_PK_ALGORITHM_T) |
| 251 | check_type_size(gnutls_sign_algorithm_t GNUTLS_SIGN_ALGORITHM_T) |
DRC | 17331b9 | 2011-06-07 04:07:20 +0000 | [diff] [blame] | 252 | set(CMAKE_REQUIRED_FLAGS) |
Pierre Ossman | 9506420 | 2011-05-30 12:22:39 +0000 | [diff] [blame] | 253 | set(CMAKE_EXTRA_INCLUDE_FILES) |
| 254 | set(CMAKE_REQUIRED_LIBRARIES) |
| 255 | endif() |
Adam Tkac | 125bd25 | 2011-01-19 14:20:34 +0000 | [diff] [blame] | 256 | endif() |
| 257 | |
DRC | 777290b | 2011-06-22 00:18:17 +0000 | [diff] [blame] | 258 | # Check for PAM library |
| 259 | option(ENABLE_PAM "Enable PAM authentication support" ON) |
| 260 | if(ENABLE_PAM) |
| 261 | check_include_files(security/pam_appl.h HAVE_PAM_H) |
| 262 | set(CMAKE_REQUIRED_LIBRARIES -lpam) |
| 263 | check_function_exists(pam_start HAVE_PAM_START) |
| 264 | set(CMAKE_REQUIRED_LIBRARIES) |
| 265 | if(HAVE_PAM_H AND HAVE_PAM_START) |
| 266 | set(PAM_LIBS pam) |
| 267 | else() |
| 268 | set(ENABLE_PAM 0) |
| 269 | endif() |
| 270 | endif() |
| 271 | set(HAVE_PAM ${ENABLE_PAM}) |
| 272 | |
Pierre Ossman | ee0e362 | 2011-03-08 13:08:15 +0000 | [diff] [blame] | 273 | # Check for socket functions |
Henrik Andersson | e1fd8e1 | 2011-03-08 13:00:12 +0000 | [diff] [blame] | 274 | if(WIN32) |
Pierre Ossman | 0153e23 | 2011-03-08 13:05:27 +0000 | [diff] [blame] | 275 | set(CMAKE_EXTRA_INCLUDE_FILES winsock2.h ws2tcpip.h) |
Henrik Andersson | e1fd8e1 | 2011-03-08 13:00:12 +0000 | [diff] [blame] | 276 | set(CMAKE_REQUIRED_LIBRARIES ws2_32) |
Pierre Ossman | 0153e23 | 2011-03-08 13:05:27 +0000 | [diff] [blame] | 277 | else() |
| 278 | set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h) |
Henrik Andersson | e1fd8e1 | 2011-03-08 13:00:12 +0000 | [diff] [blame] | 279 | endif() |
DRC | 6375809 | 2010-11-09 19:24:12 +0000 | [diff] [blame] | 280 | check_function_exists(inet_aton HAVE_INET_ATON) |
| 281 | check_function_exists(inet_ntop HAVE_INET_NTOP) |
Henrik Andersson | e1fd8e1 | 2011-03-08 13:00:12 +0000 | [diff] [blame] | 282 | check_type_size(socklen_t SOCKLEN_T) |
DRC | 6375809 | 2010-11-09 19:24:12 +0000 | [diff] [blame] | 283 | set(CMAKE_EXTRA_INCLUDE_FILES) |
| 284 | set(CMAKE_REQUIRED_LIBRARIES) |
Pierre Ossman | ee0e362 | 2011-03-08 13:08:15 +0000 | [diff] [blame] | 285 | |
| 286 | # Check for the newer standard string functions |
DRC | 6375809 | 2010-11-09 19:24:12 +0000 | [diff] [blame] | 287 | check_function_exists(snprintf HAVE_SNPRINTF) |
| 288 | check_function_exists(strcasecmp HAVE_STRCASECMP) |
| 289 | check_function_exists(strncasecmp HAVE_STRNCASECMP) |
| 290 | check_function_exists(vsnprintf HAVE_VSNPRINTF) |
Pierre Ossman | ee0e362 | 2011-03-08 13:08:15 +0000 | [diff] [blame] | 291 | |
| 292 | # Generate config.h and make sure the source finds it |
DRC | 6375809 | 2010-11-09 19:24:12 +0000 | [diff] [blame] | 293 | configure_file(config.h.cmake.in config.h) |
| 294 | add_definitions(-DHAVE_CONFIG_H) |
| 295 | include_directories(${CMAKE_BINARY_DIR}) |
DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 296 | |
DRC | 180c016 | 2010-10-27 07:20:27 +0000 | [diff] [blame] | 297 | add_subdirectory(common) |
Pierre Ossman | 8f64ef7 | 2011-03-08 16:32:49 +0000 | [diff] [blame] | 298 | |
| 299 | if(WIN32) |
| 300 | add_subdirectory(win) |
| 301 | else() |
Henrik Andersson | a7a38a6 | 2011-06-10 13:05:09 +0000 | [diff] [blame] | 302 | # No interest in building x related parts on Apple |
| 303 | if(NOT APPLE) |
| 304 | add_subdirectory(unix) |
| 305 | endif() |
Pierre Ossman | 8f64ef7 | 2011-03-08 16:32:49 +0000 | [diff] [blame] | 306 | endif() |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 307 | |
| 308 | if(BUILD_NEW_VNCVIEWER) |
DRC | d0b64c9 | 2011-06-07 04:07:41 +0000 | [diff] [blame] | 309 | if(ENABLE_NLS) |
| 310 | add_subdirectory(po) |
| 311 | endif() |
Pierre Ossman | 5156d5e | 2011-03-09 09:42:34 +0000 | [diff] [blame] | 312 | add_subdirectory(vncviewer) |
| 313 | endif() |