685.1.1
by Matthew Fuller
Bump minimum version to 3.6; 3.6.1 is available in EPEL for CentOS 6, |
1 |
cmake_minimum_required(VERSION 3.6) |
294.1.1
by Matthew Fuller
Add basically working cmake config file. |
2 |
|
466.1.8
by Matthew Fuller
Pull the version out into a text file, and split it up in cmake to |
3 |
# Figure our version
|
4 |
file(READ "VERSION" vf_str) |
|
5 |
string(STRIP ${vf_str} vf_str) |
|
685.1.5
by Matthew Fuller
cmake 3.0 starts allowing (and maybe wanting) VERSION set in the |
6 |
# Use split variants for project() call.
|
7 |
if(1) |
|
516.1.9
by Matthew Fuller
The only bit of VERSION we're using in cmake now is the unsplit |
8 |
set(version_file_re "([0-9]+)\\.([0-9]+)\\.([0-9]+)(.*)") |
9 |
string(REGEX REPLACE ${version_file_re} "\\1" ctwm_version_major ${vf_str}) |
|
10 |
string(REGEX REPLACE ${version_file_re} "\\2" ctwm_version_minor ${vf_str}) |
|
11 |
string(REGEX REPLACE ${version_file_re} "\\3" ctwm_version_patch ${vf_str}) |
|
12 |
string(REGEX REPLACE ${version_file_re} "\\4" ctwm_version_addl ${vf_str}) |
|
13 |
set(ctwm_version_str "${ctwm_version_major}.${ctwm_version_minor}.${ctwm_version_patch}${ctwm_version_addl}") |
|
14 |
else() |
|
15 |
set(ctwm_version_str ${vf_str}) |
|
16 |
endif() |
|
466.1.7
by Matthew Fuller
Define the version bits in the cmake config rather than in the C file, |
17 |
|
685.1.5
by Matthew Fuller
cmake 3.0 starts allowing (and maybe wanting) VERSION set in the |
18 |
# Now we can delcade that
|
19 |
project(ctwm |
|
20 |
VERSION ${ctwm_version_major}.${ctwm_version_minor}.${ctwm_version_patch} |
|
21 |
LANGUAGES C |
|
22 |
)
|
|
23 |
||
395.2.2
by Matthew Fuller
Move these modules up to the top so we can reuse them in more places. |
24 |
# Modules we'll need
|
25 |
include(CheckIncludeFiles) |
|
26 |
include(CheckFunctionExists) |
|
395.2.3
by Matthew Fuller
Add checking for a glibc-looking features.h, and set _POSIX_C_SOURCE |
27 |
include(CheckSymbolExists) |
395.2.2
by Matthew Fuller
Move these modules up to the top so we can reuse them in more places. |
28 |
|
294.1.68
by Matthew Fuller
Add a guard to try and avoid accidentally doing in-tree builds (which |
29 |
# Guard against in-tree builds
|
30 |
string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" insrc) |
|
31 |
if(insrc) |
|
32 |
message(FATAL_ERROR "Please build out of tree; don't run cmake " |
|
33 |
"directly in the source tree.") |
|
34 |
endif(insrc) |
|
35 |
||
685.1.12
by Matthew Fuller
As of cmake 3.20, EXPORT_COMPILE_COMMANDS is a target property |
36 |
# Let cmake write out compile commands for external tools. Requires
|
37 |
# cmake 3.5+, but setting an unknown var won't hurt earlier versions.
|
|
38 |
set(CMAKE_EXPORT_COMPILE_COMMANDS TRUE) |
|
39 |
||
294.1.68
by Matthew Fuller
Add a guard to try and avoid accidentally doing in-tree builds (which |
40 |
|
582.1.14
by Matthew Fuller
More rearranging and collapsing, so things are more tightly grouped. |
41 |
#
|
42 |
# Most of our bits are broken out into smaller files in a local dir
|
|
43 |
#
|
|
44 |
list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake_files) |
|
45 |
||
46 |
# Setup basic vars for where our pieces are, list of source files, etc.
|
|
47 |
include(basic_vars) |
|
48 |
||
49 |
# Do some basic checks of the compiler and stdlib
|
|
410.1.1
by Matthew Fuller
Break the -std=c99 and glibc features.h checks off into an include for |
50 |
include(compiler_feature_checks) |
582.1.14
by Matthew Fuller
More rearranging and collapsing, so things are more tightly grouped. |
51 |
|
52 |
# Set our install paths
|
|
53 |
include(install_paths) |
|
54 |
||
55 |
||
56 |
#
|
|
294.1.19
by Matthew Fuller
Do a bunch of rearranging of CMakeLists.txt to put things more |
57 |
# First things first. If we don't have X, we're going nowhere.
|
582.1.14
by Matthew Fuller
More rearranging and collapsing, so things are more tightly grouped. |
58 |
#
|
294.1.1
by Matthew Fuller
Add basically working cmake config file. |
59 |
find_package(X11) |
294.1.17
by Matthew Fuller
Reverse this conditionalization; if we don't find X, we bomb out right |
60 |
if(NOT X11_FOUND) |
294.1.1
by Matthew Fuller
Add basically working cmake config file. |
61 |
# This just isn't feasible...
|
62 |
message(FATAL_ERROR "Can't find X libs.") |
|
294.1.17
by Matthew Fuller
Reverse this conditionalization; if we don't find X, we bomb out right |
63 |
endif(NOT X11_FOUND) |
553
by Matthew Fuller
Add some extra checks of the X libraries before we try linking them |
64 |
if(NOT X11_INCLUDE_DIR) |
65 |
message(FATAL_ERROR "Can't find X includes.") |
|
66 |
endif(NOT X11_INCLUDE_DIR) |
|
294.1.17
by Matthew Fuller
Reverse this conditionalization; if we don't find X, we bomb out right |
67 |
|
68 |
include_directories(${X11_INCLUDE_DIR}) |
|
553
by Matthew Fuller
Add some extra checks of the X libraries before we try linking them |
69 |
|
70 |
# Need to link in at least these; double check that we found 'em before
|
|
71 |
# blindly applying them. We can seemingly get through the above just
|
|
72 |
# fine, even if it didn't find all the bits...
|
|
614.1.11
by Maxime Soulé
Xrandr support can be disabled at compile time (ON by default) |
73 |
foreach(VEXT LIBRARIES Xmu_LIB Xt_LIB) |
553
by Matthew Fuller
Add some extra checks of the X libraries before we try linking them |
74 |
if(NOT X11_${VEXT}) |
75 |
message(FATAL_ERROR "Can't find X11_${VEXT}; missing lib or " |
|
76 |
"-devel package?") |
|
77 |
endif() |
|
78 |
list(APPEND CTWMLIBS ${X11_${VEXT}}) |
|
79 |
endforeach() |
|
294.1.21
by Matthew Fuller
Conditionalize some defines and the installation of the pixmaps on |
80 |
|
294.1.30
by Matthew Fuller
Add comment. |
81 |
|
294.1.47
by Matthew Fuller
Add some hints on where to search for includes/libs, and look for the |
82 |
#
|
83 |
# Setup some search paths
|
|
84 |
#
|
|
85 |
set(INCSEARCH |
|
86 |
"${CMAKE_INSTALL_PREFIX}/include"
|
|
87 |
${X11_INCLUDE_DIR} |
|
88 |
"/usr/local/include"
|
|
89 |
"/usr/include"
|
|
90 |
)
|
|
91 |
set(LIBSEARCH |
|
92 |
"${CMAKE_INSTALL_PREFIX}/lib"
|
|
93 |
${X11_LIBRARY_DIR} |
|
94 |
"/usr/local/lib"
|
|
95 |
"/usr/lib"
|
|
96 |
"/lib"
|
|
97 |
)
|
|
98 |
||
582.1.9
by Matthew Fuller
Little more collapsing and rearranging. |
99 |
# Header files are in both source and build dirs
|
100 |
include_directories(${CMAKE_CURRENT_SOURCE_DIR}) |
|
101 |
include_directories(${CMAKE_CURRENT_BINARY_DIR}) |
|
294.1.47
by Matthew Fuller
Add some hints on where to search for includes/libs, and look for the |
102 |
|
313
by Matthew Fuller
Whoops, somewhere along the line I moved the PIXMAPDIR definition to |
103 |
|
410.1.10
by Matthew Fuller
Break out the handling of build options. |
104 |
#
|
582.1.13
by Matthew Fuller
Little more collapsing and regrouping/reordering. |
105 |
# Look for various things on the system and setup our handlers for them,
|
106 |
# and put the build together.
|
|
582.1.12
by Matthew Fuller
More collapsing. |
107 |
#
|
108 |
||
410.1.10
by Matthew Fuller
Break out the handling of build options. |
109 |
# Check our build options and set things based on them
|
110 |
include(build_options) |
|
294.1.31
by Matthew Fuller
Add -DWITH_GNU_REGEX stuff, which doesn't actually have a darn thing |
111 |
|
582.1.13
by Matthew Fuller
Little more collapsing and regrouping/reordering. |
112 |
# Do checks for library functions we need, and enable workarounds for any
|
113 |
# cases we decide are worth handling that way.
|
|
114 |
include(check_funcs_etc) |
|
115 |
||
582.1.16
by Matthew Fuller
Need the vcs checks before the gen_source_files tries to build |
116 |
# If we're building out of a VCS, find those bits so we can stash the
|
117 |
# revision info.
|
|
118 |
include(vcs_checks) |
|
119 |
||
582.1.13
by Matthew Fuller
Little more collapsing and regrouping/reordering. |
120 |
# Find some tools used for generating sources and manuals, and setup the
|
121 |
# targets to build them all.
|
|
410.1.3
by Matthew Fuller
Break the lex.l handline out into an include file. |
122 |
include(setup_lex) |
410.1.4
by Matthew Fuller
Pull out the yacc handling too. |
123 |
include(setup_yacc) |
410.1.9
by Matthew Fuller
Bust out the manual building bits. |
124 |
include(handle_manual) |
410.1.18
by Matthew Fuller
Pull generated source files into a separate include. |
125 |
include(gen_source_files) |
126 |
||
617
by Matthew Fuller
Add build infra to find and give a target to run ctags, so I can stop |
127 |
# Targets to run doxygen and ctags; nobody but devs care
|
583.1.1
by Matthew Fuller
Add basic skeleton for running doxygen. |
128 |
include(doxygen) |
617
by Matthew Fuller
Add build infra to find and give a target to run ctags, so I can stop |
129 |
include(ctags) |
583.1.1
by Matthew Fuller
Add basic skeleton for running doxygen. |
130 |
|
582.1.13
by Matthew Fuller
Little more collapsing and regrouping/reordering. |
131 |
|
628
by Matthew Fuller
Reworking the building a little so main() becomes ctwm_main(), and we |
132 |
# And link up the actual ctwm binary. We actually build a libctwmlib
|
133 |
# with all our contents except the trivial main() wrapper, then build
|
|
134 |
# ctwm with that; this makes it easy to build other binaries (like tests)
|
|
135 |
# with access to all our internal funcs.
|
|
685.1.9
by Matthew Fuller
cmake 2.8.8 (preceeded our cmake conversion by several years) added |
136 |
add_library(ctwmlib OBJECT ${CTWMSRC}) |
628
by Matthew Fuller
Reworking the building a little so main() becomes ctwm_main(), and we |
137 |
add_executable(ctwm "ctwm_wrap.c") |
685.1.9
by Matthew Fuller
cmake 2.8.8 (preceeded our cmake conversion by several years) added |
138 |
target_sources(ctwm PUBLIC $<TARGET_OBJECTS:ctwmlib>) |
294.1.7
by Matthew Fuller
Accumulate up libs in $CTWMLIBS and move add_executable and |
139 |
target_link_libraries(ctwm ${CTWMLIBS}) |
294.1.9
by Matthew Fuller
Add some handling for libctwmc, which doesn't hook up to anything. |
140 |
|
329.1.6
by Matthew Fuller
Move the libctwm/demolib stuff into a subdir, and break out a separate |
141 |
# This doesn't really serve much purpose at the moment, so it's not even
|
142 |
# documented, but the code exists. So make it buildable.
|
|
143 |
if(DO_CLIENT) |
|
144 |
add_subdirectory(client) |
|
145 |
endif(DO_CLIENT) |
|
294.1.11
by Matthew Fuller
Put together a target that theoretically puts manpages together. |
146 |
|
400.1.11
by Matthew Fuller
Add some ability to install the HTML manual, if we're not building |
147 |
|
582.1.11
by Matthew Fuller
Collapse away some further unnecessary space and tweak comments. |
148 |
# Setup the installation
|
582.1.3
by Matthew Fuller
Better name. |
149 |
include(do_install) |
410.1.14
by Matthew Fuller
Create a separate file, called last, for outputting various |
150 |
|
151 |
||
582.1.11
by Matthew Fuller
Collapse away some further unnecessary space and tweak comments. |
152 |
#
|
153 |
# And some trailing misc bits
|
|
154 |
#
|
|
155 |
||
466.1.1
by Matthew Fuller
Start setting up some control stuff cpack can use to auto-build RPM's. |
156 |
# Pull in some CPack config for auto-building packages (like .deb and
|
157 |
# .rpm)
|
|
158 |
include(cpack_setup) |
|
159 |
||
472.1.1
by Matthew Fuller
Add a target that we can use to generate various generated files for |
160 |
# Some targets to support release management stuff; building generated
|
161 |
# files for the tarballs
|
|
162 |
include(mktar_support) |
|
163 |
||
587.2.1
by Matthew Fuller
First stab at running ctfconvert/ctfmerge to get CTF info in the |
164 |
# Pull in dtrace bits
|
587.2.5
by Matthew Fuller
Move to slightly more specific name, just in case we run into |
165 |
include(dtrace_support) |
587.2.1
by Matthew Fuller
First stab at running ctfconvert/ctfmerge to get CTF info in the |
166 |
|
632.1.1
by Matthew Fuller
Start adding a few simple tests, beginning with one that just checks |
167 |
# Include tests
|
632.1.8
by Matthew Fuller
It seems like this may be a slightly more idiomatic way of hooking up |
168 |
include(CTest) |
169 |
if(BUILD_TESTING) |
|
170 |
enable_testing() |
|
171 |
add_subdirectory(tests) |
|
172 |
endif() |
|
632.1.1
by Matthew Fuller
Start adding a few simple tests, beginning with one that just checks |
173 |
|
582.1.11
by Matthew Fuller
Collapse away some further unnecessary space and tweak comments. |
174 |
# Finish by outputting various information about what we've figured and
|
175 |
# what we're doing for the builder's edification.
|
|
410.1.14
by Matthew Fuller
Create a separate file, called last, for outputting various |
176 |
include(show_build_info) |