1
1
cmake_minimum_required (VERSION 3.19 )
2
2
cmake_policy (SET CMP0074 NEW )
3
- project (ssc VERSION 0.1.57 DESCRIPTION "static site checker" LANGUAGES CXX HOMEPAGE_URL "https://ssc.lu" )
3
+ project (ssc VERSION 0.1.58 DESCRIPTION "static site checker" LANGUAGES CXX HOMEPAGE_URL "https://ssc.lu" )
4
4
5
5
set (CMAKE_CXX_STANDARD 17 )
6
6
@@ -11,22 +11,18 @@ set (S ${R}/sauce)
11
11
set (T ${R} /toast )
12
12
set (TT ${T} /ssc-test )
13
13
set (TEA ${R} /tea )
14
-
15
- if (NOT DEFINED prefix )
16
- if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
17
- set (prefix "/opt/local" )
18
- elseif ()
19
- set (prefix "/usr/local" )
20
- endif ()
21
- endif ()
22
-
14
+ set (DD "${DESTDIR}${CMAKE_INSTALL_PREFIX} " )
15
+ set (INCS "${DD} /include" "${CMAKE_INSTALL_PREFIX} /include" )
16
+ set (LIBS "${DD} /lib" "${CMAKE_INSTALL_PREFIX} /lib" )
23
17
set (BV "1.75" )
18
+ set (HV "1.7" )
19
+ set (CFT "Debug;Release" )
24
20
25
21
# if using a non-thread safe version of SSL, add this compiler definition
26
22
# CURL_SSL_NOT_THREADSAFE
27
23
28
24
# Debug / Release (https://riptutorial.com/cmake/example/26702/setting-a-release-debug-configuration)
29
- set (CMAKE_CONFIGURATION_TYPES "Debug;Release" CACHE STRING "Configs" FORCE )
25
+ set (CMAKE_CONFIGURATION_TYPES ${CFT} CACHE STRING "Configs" FORCE )
30
26
31
27
if (DEFINED CMAKE_BUILD_TYPE )
32
28
set_property (CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS ${CMAKE_CONFIGURATION_TYPES} )
@@ -46,22 +42,17 @@ set (BREGEX "regex")
46
42
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows" )
47
43
message (FATAL_ERROR "Use the included Visual Studio solutions to build under Windows (https://visualstudio.microsoft.com/downloads/)" )
48
44
elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD" )
49
- set (DOCU "${prefix } /share/doc/ssc" )
50
- set (D "${prefix } /bin" )
51
- set (INC " ${prefix} /include/" " ${prefix} /include/hunspell" )
52
- set (LD " ${prefix} /lib" )
45
+ set (DOCU "${DD } /share/doc/ssc" )
46
+ set (D "${DD } /bin" )
47
+ set (INC ${INCS} )
48
+ set (LD ${LIBS} )
53
49
target_compile_definitions (ssc-test PRIVATE UNIX NO_PCF_STR )
54
50
set (BUILD_OS ${CMAKE_SYSTEM} )
55
51
if (${CMAKE_SYSTEM_VERSION} VERSION_GREATER_EQUAL "7.0" )
56
- if (DEFINED ${HUNSPELL_USE_STATIC_LIBS} )
57
- set (LIB "${prefix} /lib/libhunspell-1.7.a" )
58
- else ()
59
- set (LIB "${prefix} /lib/libhunspell-1.7.so.1.0" )
60
- endif ()
61
52
target_compile_definitions (ssc PRIVATE UNIX OS_VER= "${BUILD_OS} " OBSD NO_PCF_STR HUNSPELL )
62
53
elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.8" )
63
- set (LIB "${prefix} /lib/libhunspell-1.6.a" )
64
54
set (BV "1.67" )
55
+ set (HV "1.6" )
65
56
set (NJ "1" )
66
57
target_compile_definitions (ssc PRIVATE UNIX OS_VER= "${BUILD_OS} " OBSD NO_PCF_STR NO_JSONIC HUNSPELL )
67
58
elseif (${CMAKE_SYSTEM_VERSION} MATCHES "6.9" )
@@ -71,15 +62,14 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD")
71
62
else ()
72
63
message (WARNING "untested version of OpenBSD" )
73
64
set (BUILD_OS ${CMAKE_SYSTEM_NAME} )
74
- target_compile_definitions (ssc PRIVATE UNIX OS_VER= "${BUILD_OS} " OBSD OMG NO_PCF_STR NO_JSONIC )
65
+ target_compile_definitions (ssc PRIVATE UNIX OS_VER= "${BUILD_OS} " OBSD OMG NO_PCF_STR NO_JSONIC NOSPELL )
75
66
set (NJ "1" )
76
67
endif ()
77
68
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD" )
78
- set (DOCU "${prefix} /share/doc/ssc" )
79
- set (D "${prefix} /bin" )
80
- set (INC "${prefix} /include/" "${prefix} /include/hunspell" )
81
- set (LD "${prefix} /lib" )
82
- set (LIB "${prefix} /lib/libhunspell-1.7.so.0" )
69
+ set (DOCU "${DD} /share/doc/ssc" )
70
+ set (D "${DD} /bin" )
71
+ set (INC ${INC} )
72
+ set (LD ${LIBS} )
83
73
set (BUILD_OS ${CMAKE_SYSTEM} )
84
74
target_compile_definitions (ssc-test PRIVATE UNIX NO_PCF_STR )
85
75
set (NO_CURL "1" )
@@ -94,7 +84,7 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
94
84
else ()
95
85
set (BUILD_OS "FreeBSD?" )
96
86
message (WARNING "untested version of FreeBSD" )
97
- target_compile_definitions (ssc PRIVATE UNIX OS_VER= "${BUILD_OS} " FBSD OMG NO_PCF_STR NO_JSONIC HUNSPELL NOCURL )
87
+ target_compile_definitions (ssc PRIVATE UNIX OS_VER= "${BUILD_OS} " FBSD OMG NO_PCF_STR NO_JSONIC NOSPELL NOCURL )
98
88
set (NJ "1" )
99
89
endif ()
100
90
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux" )
@@ -129,46 +119,39 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
129
119
set (NJ "1" )
130
120
endif ()
131
121
set (BV "1.67" )
132
- set (D "${prefix} /bin" )
133
- set (DOCU "${prefix} /../share/doc/ssc" )
134
- set (INC "/usr/include/" "/usr/local/include/" "/usr/include/hunspell" "/usr/include/x86_64-linux-gnu/" )
135
- set (LD "/usr/lib64/" )
136
- set (LIB "/usr/lib64/libhunspell-1.7.so" )
122
+ set (D "${DD} /bin" )
123
+ set (DOCU "${DD} /../share/doc/ssc" )
124
+ set (INC ${INC} "/usr/include/" "/usr/local/include/" "/usr/include/hunspell" "/usr/include/x86_64-linux-gnu/" )
125
+ set (LD ${LIBS} "/usr/lib64/" )
137
126
set (Boost_USE_STATIC_LIBS OFF )
138
127
if (${LSB_RELEASE_ID_SHORT} MATCHES "Ubuntu" )
139
- set (LD "/usr/lib/x86_64-linux-gnu/" )
140
- set (LIB "/usr/lib/x86_64-linux-gnu/libhunspell-1.7.so" )
141
- elseif (${LSB_RELEASE_ID_SHORT} MATCHES "CentOSStream" )
128
+ set (LD ${LIBS} "/usr/lib64/" "/usr/lib/x86_64-linux-gnu/" )
129
+ elseif (${LSB_RELEASE_ID_SHORT} MATCHES "CentOSStream" )
142
130
if (${LSB_RELEASE_VER_SHORT} MATCHES "8" )
143
131
set (BV "1.66" )
144
- set (LIB "/usr/lib64/libhunspell- 1.6.so " )
132
+ set (HV " 1.6" )
145
133
endif ()
146
134
endif ()
147
135
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin" )
148
- set (D "${prefix } /bin" )
149
- set (DOCU "${prefix } /share/doc/ssc" )
150
- set (INC "/usr/local/include/" " ${prefix} /include/" " ${prefix} /include/hunspell " )
151
- set (LD "/usr/local/lib" " ${prefix} /lib" )
136
+ set (D "${DD } /bin" )
137
+ set (DOCU "${DD } /share/doc/ssc" )
138
+ set (INC ${INC} "/usr/local/include/" )
139
+ set (LD ${LIBS} "/usr/local/lib" )
152
140
set (Boost_USE_STATIC_LIBS OFF )
153
141
target_compile_definitions (ssc-test PRIVATE UNIX )
154
142
if (${CMAKE_SYSTEM} MATCHES "Darwin-23" )
155
143
set (BUILD_OS "Sonoma" )
156
- set (LIB "${prefix} /lib/libhunspell-1.7.a" )
157
144
target_compile_definitions (ssc PRIVATE OS_VER= "${BUILD_OS} " UNIX DARWIN HUNSPELL CLEAN_SHAREDPTR_ARRAY ORDERED )
158
145
elseif (${CMAKE_SYSTEM} MATCHES "Darwin-22" )
159
146
set (BUILD_OS "Ventura" )
160
- set (LIB "${prefix} /lib/libhunspell-1.7.a" )
161
147
target_compile_definitions (ssc PRIVATE OS_VER= "${BUILD_OS} " UNIX DARWIN HUNSPELL CLEAN_SHAREDPTR_ARRAY ORDERED )
162
148
elseif (${CMAKE_SYSTEM} MATCHES "Darwin-21" )
163
149
set (BUILD_OS "Monterey" )
164
- set (LIB "${prefix} /lib/libhunspell-1.7.a" )
165
150
target_compile_definitions (ssc PRIVATE OS_VER= "${BUILD_OS} " UNIX DARWIN HUNSPELL CLEAN_SHAREDPTR_ARRAY )
166
151
elseif (${CMAKE_SYSTEM} MATCHES "Darwin-20" )
167
152
set (BUILD_OS "Big Sur" )
168
- set (LIB "${prefix} /lib/libhunspell-1.7.a" )
169
153
target_compile_definitions (ssc PRIVATE OS_VER= "${BUILD_OS} " UNIX DARWIN HUNSPELL )
170
154
elseif (${CMAKE_SYSTEM} MATCHES "Darwin-19" )
171
- set (LIB "${prefix} /lib/libhunspell-1.7.a" )
172
155
set (BUILD_OS "Catalina" )
173
156
target_compile_definitions (ssc PRIVATE OS_VER= "${BUILD_OS} " UNIX DARWIN NO_JSONIC HUNSPELL )
174
157
set (NJ "1" )
@@ -202,22 +185,8 @@ elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
202
185
set (BREGEX "" )
203
186
target_compile_definitions (ssc PRIVATE OS_VER= "${BUILD_OS} " UNIX DARWIN FUDDYDUDDY NO_JSONIC NOSPELL NOMERGE NO_GSL NO_FALLTHROUGH NO_BOOST_REGEX ELDERLY_CPP )
204
187
set (NJ "1" )
205
- elseif (${CMAKE_SYSTEM} MATCHES "Darwin-13" )
206
- message (FATAL_ERROR "ssc requires a more recent C++ dialect than that available in Mavericks" )
207
- elseif (${CMAKE_SYSTEM} MATCHES "Darwin-12" )
208
- message (FATAL_ERROR "ssc requires a more recent C++ dialect than that available in Mountain Lion" )
209
- elseif (${CMAKE_SYSTEM} MATCHES "Darwin-11" )
210
- message (FATAL_ERROR "ssc requires a more recent C++ dialect than that available in Lion" )
211
- elseif (${CMAKE_SYSTEM} MATCHES "Darwin-10" )
212
- message (FATAL_ERROR "ssc requires a more recent C++ dialect than that available in Snow Leopard" )
213
- elseif (${CMAKE_SYSTEM} MATCHES "Darwin-9" )
214
- message (FATAL_ERROR "ssc requires a more recent C++ dialect than that available in Leopard" )
215
- elseif (${CMAKE_SYSTEM} MATCHES "Darwin-8" )
216
- message (FATAL_ERROR "ssc requires a more recent C++ dialect than that available in Tiger" )
217
- elseif (${CMAKE_SYSTEM} MATCHES "Darwin-7" )
218
- message (FATAL_ERROR "ssc requires a more recent C++ dialect than that available in Panther" )
219
- elseif (${CMAKE_SYSTEM} MATCHES "Darwin-6" )
220
- message (FATAL_ERROR "ssc requires a more recent C++ dialect than that available in Jaguar" )
188
+ elseif (${CMAKE_SYSTEM_VERSION} VERSION_LESS_EQUAL "13" )
189
+ message (FATAL_ERROR "apologies, but ssc needs a less ancient operating system" )
221
190
else ()
222
191
message (WARNING "unknown, untested MacOS" )
223
192
set (BUILD_OS "Darwin?" )
@@ -241,39 +210,33 @@ else ()
241
210
set (NJ "1" )
242
211
endif ()
243
212
244
- target_link_libraries (ssc PRIVATE ${LIB} )
245
-
246
213
message (${BUILD_OS} )
247
214
248
215
set (Boost_USE_STATIC_LIBS OFF )
249
216
set (Boost_USE_MULTI_THREADED ON )
250
217
if (${CMAKE_BUILD_TYPE} MATCHES "Debug" )
251
- set (ICU_DEBUG ON )
252
- set (Boost_USE_DEBUG_LIBS ON )
253
- set (Boost_USE_DEBUG_RUNTIME ON )
218
+ set (ICU_DEBUG ON )
219
+ set (Boost_USE_DEBUG_LIBS ON )
220
+ set (Boost_USE_DEBUG_RUNTIME ON )
254
221
else ()
255
- set (ICU_DEBUG ON )
256
- set (Boost_USE_DEBUG_LIBS OFF )
257
- set (Boost_USE_DEBUG_RUNTIME OFF )
222
+ set (ICU_DEBUG ON )
223
+ set (Boost_USE_DEBUG_LIBS OFF )
224
+ set (Boost_USE_DEBUG_RUNTIME OFF )
258
225
endif ()
259
226
260
227
if (${NJ} )
261
- find_package (Boost ${BV} REQUIRED COMPONENTS system chrono date_time filesystem locale program_options thread ${BREGEX} )
228
+ find_package (Boost ${BV} REQUIRED COMPONENTS system chrono date_time filesystem locale program_options thread ${BREGEX} )
262
229
else ()
263
- find_package (Boost ${BV} REQUIRED COMPONENTS system chrono date_time filesystem json locale program_options thread ${BREGEX} )
230
+ find_package (Boost ${BV} REQUIRED COMPONENTS system chrono date_time filesystem json locale program_options thread ${BREGEX} )
264
231
endif ()
265
232
266
233
find_package (ICU 60.0 REQUIRED COMPONENTS dt in io tu uc )
267
234
find_package (Iconv REQUIRED )
268
235
269
- if (${NO_CURL} MATCHES "1" )
270
- # be nice is NOT worked for me, but ...
271
- message ("-- straight" )
272
- else ()
273
- # https://cmake.org/cmake/help/latest/module/FindCURL.html
274
- message ("-- CuRLy" )
275
- set (CURL_USE_STATIC_LIBS OFF )
276
- find_package (CURL REQUIRED FILE HTTP HTTPS SSL )
236
+ if (NOT DEFINED ${NO_CURL} )
237
+ # https://cmake.org/cmake/help/latest/module/FindCURL.html
238
+ set (CURL_USE_STATIC_LIBS OFF )
239
+ find_package (CURL REQUIRED FILE HTTP HTTPS SSL )
277
240
endif ()
278
241
279
242
# better to list the build files in one place (here) rather than litter all the source directories with a gadzillion untidy wee files
@@ -417,6 +380,7 @@ if (${CMAKE_BUILD_TYPE} MATCHES "Debug")
417
380
target_compile_options (ssc PRIVATE "-g;-O0;-fvisibility=hidden;-fvisibility-inlines-hidden;-Wall;-Wextra;-Wno-dangling-else;-Wno-write-strings;-Wno-deprecated-declarations" ${IMPLICITFALL} ${NOINDENTLIE} ${TEMPLATEDEPTH} )
418
381
endif ()
419
382
else ()
383
+ message ("-- release" )
420
384
target_compile_definitions (ssc-test PRIVATE NDEBUG )
421
385
target_compile_definitions (ssc PRIVATE NDEBUG )
422
386
target_compile_options (ssc-test PRIVATE "-fvisibility=hidden;-fvisibility-inlines-hidden;-Wall;-Wextra;-Wno-dangling-else;-Wno-write-strings;-Wno-unused-result;-Wno-unused-parameter;-Wno-deprecated-declarations" ${IMPLICITFALL} ${NOINDENTLIE} )
@@ -430,9 +394,7 @@ target_link_libraries (ssc PRIVATE Boost::system)
430
394
target_link_libraries (ssc PRIVATE Boost::chrono )
431
395
target_link_libraries (ssc PRIVATE Boost::date_time )
432
396
target_link_libraries (ssc PRIVATE Boost::filesystem )
433
- if (${NJ} )
434
- # it'd be nice is NOT worked for me, but ...
435
- else ()
397
+ if (NOT DEFINED ${NJ} )
436
398
message ("-- jsonic" )
437
399
target_link_libraries (ssc PRIVATE Boost::json )
438
400
endif ()
@@ -442,24 +404,27 @@ target_link_libraries (ssc PRIVATE Boost::thread)
442
404
target_link_libraries (ssc PRIVATE pthread )
443
405
target_link_libraries (ssc PRIVATE ${ICU_LIBRARIES} )
444
406
445
- if (${NO_CURL} MATCHES "1" )
446
- # it'd be nice if NOT worked for me, but ...
447
- else ()
448
- target_link_libraries (ssc PRIVATE ${CURL_LIBRARIES} )
407
+ if (NOT DEFINED ${NO_CURL} )
408
+ target_link_libraries (ssc PRIVATE ${CURL_LIBRARIES} )
449
409
endif ()
450
410
451
- install (TARGETS ssc DESTINATION ${D} )
452
- install (FILES ${CMAKE_CURRENT_SOURCE_DIR} /README.txt ${CMAKE_CURRENT_SOURCE_DIR} /gen.txt ${CMAKE_CURRENT_SOURCE_DIR} /LICENCE.txt ${CMAKE_CURRENT_SOURCE_DIR} /LICENSE.txt ${CMAKE_CURRENT_SOURCE_DIR} /usage.txt DESTINATION ${DOCU} )
411
+ if (NOT DEFINED NOSPELL )
412
+ find_library (HUN NAMES "libhunspell-${HV} " "hunspell-${HV} " "libhunspell" "hunspell-${HV} " HINTS ${LB} PATH_SUFFIXES "/hunspell" DOC "hunspell-${HV} " REQUIRED )
413
+ message ("-- hunspell: " ${HUN} )
414
+ target_link_libraries (ssc PRIVATE ${HUN} )
415
+ endif ()
416
+
417
+ install (TARGETS ssc DESTINATION ${D} CONFIGURATIONS ${CFT} )
418
+ install (FILES ${CMAKE_CURRENT_SOURCE_DIR} /README.txt ${CMAKE_CURRENT_SOURCE_DIR} /gen.txt ${CMAKE_CURRENT_SOURCE_DIR} /LICENCE.txt ${CMAKE_CURRENT_SOURCE_DIR} /LICENSE.txt ${CMAKE_CURRENT_SOURCE_DIR} /usage.txt DESTINATION ${DOCU} CONFIGURATIONS ${CFT} )
453
419
454
420
# uninstall target ( https://gitlab.kitware.com/cmake/community/-/wikis/FAQ#can-i-do-make-uninstall-with-cmake )
455
421
if (NOT TARGET uninstall )
456
422
configure_file (
457
- "${CMAKE_CURRENT_SOURCE_DIR } /cmake_uninstall.cmake.in"
458
- "${CMAKE_CURRENT_BINARY_DIR } /cmake_uninstall.cmake"
423
+ "${TEA } /cmake_uninstall.cmake.in"
424
+ "${TEA } /cmake_uninstall.cmake"
459
425
IMMEDIATE @ONLY )
460
-
461
426
add_custom_target (uninstall
462
- COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR } /cmake_uninstall.cmake )
427
+ COMMAND ${CMAKE_COMMAND} -P ${TEA } /cmake_uninstall.cmake )
463
428
endif ()
464
429
465
430
enable_testing ()
0 commit comments