1# 2# Our build-time options 3# 4 5 6# 7# Define options 8# These can be set at the command line; e.g., "cmake -DUSE_JPEG=OFF" 9# 10option(USE_XPM "Enable XPM support" ON ) 11option(USE_JPEG "Enable libjpeg support" ON ) 12option(USE_M4 "Enable m4 support" ON ) 13option(USE_RPLAY "Enable librplay sound support" OFF) 14option(USE_SREGEX "Use regex from libc" ON ) 15option(USE_EWMH "Support some Extended Window Manager Hints" ON ) 16option(USE_XRANDR "Enable Xrandr support" ON ) 17 18# Temp and hidden-ish, to make it easier to deorbit all at once 19option(USE_CAPTIVE "Enable captive CTWM support" OFF ) 20option(USE_VSCREEN "Enable VirtualScreens support" OFF ) 21option(USE_WINBOX "Enable WindowBox support" OFF ) 22option(USE_SESSION "Enable XSMP support" ON ) 23 24 25 26 27# 28# Now check what's set, make sure we can find stuff, and configure bits 29# up. 30# 31 32# Hard to imagine xpm not being around or somebody not wanting it, but... 33if(USE_XPM) 34 if(NOT X11_Xpm_FOUND) 35 message(FATAL_ERROR "Couldn't find XPM libs") 36 endif(NOT X11_Xpm_FOUND) 37 38 list(APPEND CTWMLIBS ${X11_Xpm_LIB}) 39 list(APPEND CTWMSRC image_xpm.c) 40 message(STATUS "Enabling XPM support: ${X11_Xpm_LIB}") 41 42 # DATADIR should already be defined; guard against me being stupid 43 # when I change something 44 if(NOT DATADIR) 45 message(FATAL_ERROR "Internal error: DATADIR not defined!") 46 endif(NOT DATADIR) 47endif(USE_XPM) 48 49 50# libjpeg is pretty common 51if(USE_JPEG) 52 find_package(JPEG) 53 if(NOT JPEG_FOUND) 54 message(FATAL_ERROR "Couldn't find libjpeg") 55 endif() 56 57 include_directories(${JPEG_INCLUDE_DIR}) 58 list(APPEND CTWMLIBS ${JPEG_LIBRARIES}) 59 list(APPEND CTWMSRC image_jpeg.c) 60 message(STATUS "Enabling libjpeg support.") 61endif(USE_JPEG) 62 63 64# m4 is on by default too 65if(USE_M4) 66 if(NOT M4_CMD) 67 find_program(M4_CMD m4 gm4) 68 endif(NOT M4_CMD) 69 if(NOT M4_CMD) 70 message(FATAL_ERROR "Can't find m4 program: try setting M4_CMD.") 71 endif(NOT M4_CMD) 72 list(APPEND CTWMSRC parse_m4.c) 73 message(STATUS "Enabling m4 support (${M4_CMD}).") 74endif(USE_M4) 75 76 77# rplay off by default 78if(USE_SOUND) 79 message(WARNING "USE_SOUND is deprecated; use USE_RPLAY instead.") 80 set(USE_RPLAY YES) 81endif(USE_SOUND) 82if(USE_RPLAY) 83 find_library(LIBRPLAY NAMES rplay PATHS ${LIBSEARCH}) 84 if(NOT LIBRPLAY) 85 message(FATAL_ERROR "Can't find librplay lib.") 86 endif(NOT LIBRPLAY) 87 find_path(LIBRPLAY_INCLUDE_DIR NAME rplay.h PATHS ${INCSEARCH}) 88 if(NOT LIBRPLAY_INCLUDE_DIR) 89 message(FATAL_ERROR "Can't find rplay.h.") 90 endif(NOT LIBRPLAY_INCLUDE_DIR) 91 92 list(APPEND CTWMSRC sound.c) 93 list(APPEND CTWMLIBS ${LIBRPLAY}) 94 include_directories(${LIBRPLAY_INCLUDE_DIR}) 95 message(STATUS "Enabling librplay sound support.") 96endif(USE_RPLAY) 97 98 99# Check if the user wants EWMH support built in. 100if(USE_EWMH) 101 # Hand-build ewmh_atoms.[ch] 102 set(ewmh_atoms ewmh_atoms.h ewmh_atoms.c) 103 add_custom_command(OUTPUT ${ewmh_atoms} 104 DEPENDS ewmh_atoms.in ${TOOLS}/mk_atoms.sh 105 COMMAND ${TOOLS}/mk_atoms.sh ${CMAKE_CURRENT_SOURCE_DIR}/ewmh_atoms.in ewmh_atoms EWMH 106 ) 107 108 list(APPEND CTWMSRC ewmh.c ewmh_atoms.c) 109 message(STATUS "Enabling Extended Window Manager Hints support.") 110else() 111 message(STATUS "Disabling Extended Window Manager Hints support.") 112endif(USE_EWMH) 113 114 115# System provides regex stuff in libc? 116if(USE_SREGEX) 117 check_include_files(regex.h HAS_REGEX_H) 118 check_function_exists(regexec HAS_REGEXEC) 119 120 if(NOT HAS_REGEX_H) 121 message(FATAL_ERROR "Can't find regex.h") 122 endif(NOT HAS_REGEX_H) 123 if(NOT HAS_REGEXEC) 124 message(FATAL_ERROR "Can't find regexec()") 125 endif(NOT HAS_REGEXEC) 126 127 message(STATUS "Enabling libc regex usage.") 128else() 129 message(FATAL_ERROR "USE_SREGEX=OFF no longer supported.") 130endif(USE_SREGEX) 131 132 133# Is Xrandr of a suitable version available? 134if(USE_XRANDR) 135 if(NOT X11_Xrandr_FOUND) 136 message(FATAL_ERROR "Couldn't find Xrandr libs") 137 endif(NOT X11_Xrandr_FOUND) 138 139 # We need XRRGetMonitors() 140 set(OLD_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES}) 141 set(OLD_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES}) 142 set(CMAKE_REQUIRED_INCLUDES ${X11_Xrandr_INCLUDE_PATH}) 143 set(CMAKE_REQUIRED_LIBRARIES ${X11_Xrandr_LIB}) 144 check_symbol_exists(XRRGetMonitors "X11/extensions/Xrandr.h" HAVE_XRRGETMONITORS) 145 set(CMAKE_REQUIRED_INCLUDES ${OLD_CMAKE_REQUIRED_INCLUDES}) 146 set(CMAKE_REQUIRED_LIBRARIES ${OLD_CMAKE_REQUIRED_LIBRARIES}) 147 148 if(NOT HAVE_XRRGETMONITORS) 149 message(FATAL_ERROR "Xrandr lib does not implement XRRGetMonitors, Xrandr 1.5 needed") 150 endif(NOT HAVE_XRRGETMONITORS) 151 152 # Got it 153 include_directories(${X11_Xrandr_INCLUDE_PATH}) 154 list(APPEND CTWMLIBS ${X11_Xrandr_LIB}) 155 list(APPEND CTWMSRC xrandr.c) 156 message(STATUS "Enabling Xrandr support: ${X11_Xrandr_LIB}") 157else() 158 message(STATUS "Disabling Xrandr support.") 159endif(USE_XRANDR) 160 161 162# Captive mode 163if(USE_CAPTIVE) 164 # This isn't going to be here long, you shouldn't be enabling it 165 # unless you're ready to argue on the mailing list to preserve it. 166 message(WARNING "Captive mode will not be supported in future versions") 167 168 # Some whole files are involved 169 list(APPEND CTWMSRC captive.c functions_captive.c) 170else() 171 # Nothing much... 172endif(USE_CAPTIVE) 173 174 175# VirtualScreens (going the heck away) 176if(USE_VSCREEN) 177 message(WARNING "VirtualScreens will not be supported in future versions") 178else() 179endif(USE_VSCREEN) 180 181 182# WindowBox's 183if(USE_WINBOX) 184 message(WARNING "WindowBox will not be supported in future versions") 185 186 list(APPEND CTWMSRC windowbox.c) 187else() 188endif(USE_WINBOX) 189 190 191# XSMP session manager support 192if(USE_SESSION) 193 #message(WARNING "XSMP will not be supported in future versions") 194 195 list(APPEND CTWMSRC session.c) 196else() 197endif(USE_SESSION) 198