-
Notifications
You must be signed in to change notification settings - Fork 173
/
CMakeLists.txt
547 lines (462 loc) · 21.7 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules)
cmake_minimum_required (VERSION 3.0.2)
project (far2l)
set(APP_NAME "far2l")
set(APP_IDENTIFIER "com.far2l")
set(CPACK_PACKAGE_NAME "far2l")
string(ASCII 27 Esc)
set(ColorNormal "${Esc}[m")
set(ColorRed "${Esc}[1;31m")
include(GNUInstallDirs)
# just to force reconfigure if packaging/version changed
configure_file(${CMAKE_SOURCE_DIR}/packaging/version ${CMAKE_BINARY_DIR}/packaging/version @ONLY)
# reconfigure in case .git directory changed to update version correctly
IF(EXISTS ${CMAKE_SOURCE_DIR}/.git)
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS ${CMAKE_SOURCE_DIR}/.git)
endif()
file(READ "${CMAKE_SOURCE_DIR}/packaging/version" VERSION)
string(REGEX REPLACE "[\r\n\t ]$" "" VERSION "${VERSION}")
string(REGEX REPLACE "^([0-9]+)\\..*" "\\1" VERSION_MAJOR "${VERSION}")
string(REGEX REPLACE "^[0-9]+\\.([0-9]+).*" "\\1" VERSION_MINOR "${VERSION}")
string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.(.*)" "\\1" VERSION_PATCH "${VERSION}")
if("${VERSION_MAJOR}" STREQUAL "" OR "${VERSION_MAJOR}" STREQUAL "${VERSION}"
OR "${VERSION_MINOR}" STREQUAL "" OR "${VERSION_MINOR}" STREQUAL "${VERSION}"
OR "${VERSION_PATCH}" STREQUAL "" OR "${VERSION_PATCH}" STREQUAL "${VERSION}")
message(FATAL_ERROR "${ColorRed}packaging/version is corrupted, please write actual X.Y.Z version into it.${ColorNormal}")
endif()
find_package(Git)
if(GIT_FOUND)
execute_process(COMMAND "${GIT_EXECUTABLE}" describe --tag
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_TAG
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
if(NOT "${GIT_TAG}" STREQUAL "v_${VERSION}")
if(GIT_FOUND)
if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/.git)
execute_process(COMMAND "${GIT_EXECUTABLE}" show --no-patch --format=%ci HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
string(SUBSTRING ${GIT_DATE} 0 10 GIT_DATE)
execute_process(COMMAND "${GIT_EXECUTABLE}" rev-parse --short HEAD
WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}"
OUTPUT_VARIABLE GIT_HASH
OUTPUT_STRIP_TRAILING_WHITESPACE)
endif()
endif()
if(NOT "${GIT_DATE}" STREQUAL "")
message(STATUS "git date: ${GIT_DATE}")
set(VERSION_PATCH "${VERSION_PATCH}-${GIT_DATE}")
endif()
if(NOT "${GIT_HASH}" STREQUAL "")
message(STATUS "git hash: ${GIT_HASH}")
set(VERSION_PATCH "${VERSION_PATCH}-${GIT_HASH}")
else()
message(WARNING "git information unavailable, assuming its a build from v_${VERSION}")
endif()
endif()
set(VERSION_PATCH "${VERSION_PATCH}-beta")
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_EXTENSIONS OFF)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()
message(STATUS "Build Type: ${CMAKE_BUILD_TYPE} Version: ${VERSION}")
if(NOT DEFINED CMAKE_INSTALL_PREFIX)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(CMAKE_INSTALL_PREFIX "/usr/local")
elseif (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
set(CMAKE_INSTALL_PREFIX "/usr/local")
else()
set(CMAKE_INSTALL_PREFIX "/usr")
endif()
endif()
##############################
if (NOT DEFINED TESTING)
set(TESTING "NO")
endif()
if (NOT DEFINED USEWX)
set(USEWX "YES")
endif()
if (NOT DEFINED UNRAR)
set(UNRAR "bundled")
endif()
# EACP disabled by default for now as FAR's GetCodePageInfo rejects all multibyte charsets due to BUGBUG.
# Uncomment EACP-stuff here when that will be fixed. See https://github.com/elfmz/far2l/issues/1179
#if (NOT DEFINED EACP)
# set(EACP "YES")
#endif()
if (NOT DEFINED LEGACY)
# TODO: default it to NO somewhere in 2022, after all obsolete settings
# registry-upgrade-to-ini stuff will be safe to remove
set(LEGACY "YES")
elseif(FARFTP)
set(LEGACY "YES")
message(STATUS "Force-enable LEGACY due to enabled FARFTP")
endif()
#if (NOT EACP)
# message(STATUS "${ColorRed}Building without East Asian codepages support due to EACP=${EACP}${ColorNormal}")
#endif()
# set(RM rm) actually not needed: use $(CMAKE_COMMAND) -E remove
if(MUSL)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__MUSL__")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__MUSL__")
endif()
if(TAR_LIMITED_ARGS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__TAR_LIMITED_ARGS__")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__TAR_LIMITED_ARGS__")
endif()
if(${CMAKE_VERSION} VERSION_LESS "3.1.0")
message("Please consider to switch to newer CMake")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -fPIC -Wno-unused-function -D_FILE_OFFSET_BITS=64") # -fsanitize=address
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -std=c99 -fPIC -Wno-unused-function -D_FILE_OFFSET_BITS=64") # -fsanitize=address
set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(CMAKE_C_FLAGS_RELEASE "-O2")
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(APP_DIR ${CMAKE_BINARY_DIR}/install)
set(INSTALL_DIR ${APP_DIR}/${APP_NAME}.app/Contents/MacOS)
set(EXECUTABLE_NAME ${APP_NAME})
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ffunction-sections -fdata-sections")
set(INSTALL_DIR ${CMAKE_BINARY_DIR}/install)
set(EXECUTABLE_NAME far2l)
if (NOT CMAKE_CXX_COMPILER_ID MATCHES "Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--gc-sections")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wl,--gc-sections")
endif()
endif()
if (CMAKE_SYSTEM_NAME MATCHES "CYGWIN")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=600")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D_GNU_SOURCE -D_BSD_SOURCE -D_XOPEN_SOURCE=600")
message(STATUS "Running under cygwin, wow!")
endif()
if (CMAKE_SYSTEM_NAME MATCHES "Haiku")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GNU_SOURCE -D_DEFAULT_SOURCE -Wno-attributes")
endif()
set(CMAKE_CXX_VISIBILITY_PRESET hidden)
set(CMAKE_C_VISIBILITY_PRESET hidden)
if (LEGACY)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DWINPORT_REGISTRY")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DWINPORT_REGISTRY")
message(STATUS "Enabling registry support due to enabled LEGACY")
else()
message(STATUS "LEGACY is not enabled, your old registry settings will be forgotten, if any")
endif()
if(CMAKE_VERSION VERSION_GREATER "3.3")
cmake_policy(SET CMP0063 NEW)
cmake_policy(SET CMP0057 NEW)
endif()
include_directories(utils/include)
add_subdirectory (WinPort)
add_subdirectory (utils)
add_subdirectory (far2l)
if (NOT ${USEWX})
message(STATUS "Building without GUI/wxWidgets backend due to USEWX=${USEWX}")
else()
message(STATUS "Building with GUI/wxWidgets backend")
if (${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD")
if (DEFINED wxWidgets_CONFIG_EXECUTABLE)
message(STATUS "Using pre-defined wx config: ${wxWidgets_CONFIG_EXECUTABLE}")
elseif(EXISTS "/usr/local/bin/wxgtk3u-3.2-config")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk3u-3.2-config")
set(wxWidgets_wxrc_EXECUTABLE "/usr/local/bin/wxrc-gtk3u-3.2")
message(STATUS "Using known location of wx-config 3.2")
elseif(EXISTS "/usr/local/bin/wxgtk3u-3.1-config")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk3u-3.1-config")
set(wxWidgets_wxrc_EXECUTABLE "/usr/local/bin/wxrc-gtk3u-3.1")
message(STATUS "Using known location of wx-config 3.1")
elseif (EXISTS "/usr/local/bin/wxgtk3u-3.0-config")
set(wxWidgets_CONFIG_EXECUTABLE "/usr/local/bin/wxgtk3u-3.0-config")
set(wxWidgets_wxrc_EXECUTABLE "/usr/local/bin/wxrc-gtk3u-3.0")
message(STATUS "Using known location of wx-config 3.0")
else()
message(STATUS "No wxgtk3u-3.*-config in expected locations")
endif()
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
if (EXISTS "/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.2/bin/wx-config")
# MacPorts
set(wxWidgets_CONFIG_EXECUTABLE "/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.2/bin/wx-config")
set(wxWidgets_wxrc_EXECUTABLE "/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.2/bin/wxrc")
message(STATUS "Using known location of wx-config 3.2")
elseif (EXISTS "/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.1/bin/wx-config")
# MacPorts
set(wxWidgets_CONFIG_EXECUTABLE "/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.1/bin/wx-config")
set(wxWidgets_wxrc_EXECUTABLE "/opt/local/Library/Frameworks/wxWidgets.framework/Versions/wxWidgets/3.1/bin/wxrc")
message(STATUS "Using known location of wx-config 3.1")
else()
message(STATUS "No wx-config in expected locations")
endif()
endif()
add_subdirectory(WinPort/src/Backend/WX)
endif()
if (NOT DEFINED TTYX)
find_package(X11)
if(X11_FOUND)
message(STATUS "Building with TTY X11 extensions due to X11 found")
add_subdirectory(WinPort/src/Backend/TTY/TTYX)
else()
message(STATUS "Building without TTY X11 extensions due to X11 not found")
endif()
elseif (TTYX)
message(STATUS "Building with TTY X11 extensions due to TTYX=${TTYX}")
add_subdirectory(WinPort/src/Backend/TTY/TTYX)
else()
message(STATUS "Building without TTY X11 extensions due to TTYX=${TTYX}")
endif()
##############################
# plugins directives
if (NOT DEFINED ALIGN OR ALIGN)
message(STATUS "ALIGN plugin enabled")
add_subdirectory (align)
else()
message(STATUS "${ColorRed}ALIGN plugin disabled due to ALIGN=${ALIGN}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/align/plug/align.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED AUTOWRAP OR AUTOWRAP)
message(STATUS "AUTOWRAP plugin enabled")
add_subdirectory (autowrap)
else()
message(STATUS "${ColorRed}AUTOWRAP plugin disabled due to AUTOWRAP=${AUTOWRAP}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/autowrap/plug/autowrap.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED CALC OR CALC)
message(STATUS "CALC plugin enabled")
add_subdirectory (calc)
else()
message(STATUS "${ColorRed}CALC plugin disabled due to CALC=${CALC}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/calc/plug/calc.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED COLORER OR COLORER)
message(STATUS "COLORER plugin enabled")
add_subdirectory (colorer)
else()
message(STATUS "${ColorRed}COLORER plugin disabled due to COLORER=${COLORER}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/colorer/plug/colorer.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED COMPARE OR COMPARE)
message(STATUS "COMPARE plugin enabled")
add_subdirectory (compare)
else()
message(STATUS "${ColorRed}COMPARE plugin disabled due to COMPARE=${COMPARE}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/compare/plug/compare.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED DRAWLINE OR DRAWLINE)
message(STATUS "DRAWLINE plugin enabled")
add_subdirectory (drawline)
else()
message(STATUS "${ColorRed}DRAWLINE plugin disabled due to DRAWLINE=${DRAWLINE}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/drawline/plug/drawline.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED EDITCASE OR EDITCASE)
message(STATUS "EDITCASE plugin enabled")
add_subdirectory (editcase)
else()
message(STATUS "${ColorRed}EDITCASE plugin disabled due to EDITCASE=${EDITCASE}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/editcase/plug/editcase.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED EDITORCOMP OR EDITORCOMP)
message(STATUS "EDITORCOMP plugin enabled")
add_subdirectory (editorcomp)
else()
message(STATUS "${ColorRed}EDITORCOMP plugin disabled due to EDITORCOMP=${EDITORCOMP}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/editorcomp/plug/editorcomp.far-plug-wide)
" COMPONENT system)
endif()
if (DEFINED FARFTP AND FARFTP)
message(STATUS "FARFTP plugin enabled (obsolete)")
add_subdirectory (FARStdlib)
add_subdirectory (farftp)
else()
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/farftp/plug/farftp.far-plug-mb)
" COMPONENT system)
endif()
if (NOT DEFINED FILECASE OR FILECASE)
message(STATUS "FILECASE plugin enabled")
add_subdirectory (filecase)
else()
message(STATUS "${ColorRed}FILECASE plugin disabled due to FILECASE=${FILECASE}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/filecase/plug/filecase.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED INCSRCH OR INCSRCH)
message(STATUS "INCSRCH plugin enabled")
add_subdirectory (incsrch)
else()
message(STATUS "${ColorRed}Building without <INCSRCH> plugin due to INCSRCH=${INCSRCH}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/incsrch/plug/incsrch.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED INSIDE OR INSIDE)
message(STATUS "INSIDE plugin enabled")
add_subdirectory (inside)
else()
message(STATUS "${ColorRed}INSIDE plugin disabled due to INSIDE=${INSIDE}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/inside/plug/inside.far-plug-mb)
" COMPONENT system)
endif()
if (NOT DEFINED MULTIARC OR MULTIARC)
message(STATUS "MULTIARC plugin enabled")
find_package(PkgConfig REQUIRED)
pkg_search_module(LibArchive QUIET libarchive)
if(NOT LibArchive_FOUND)
# workaround for MacOS brew's/macports' libarchive
if(IS_DIRECTORY "/usr/local/opt/libarchive/include")
set(LibArchive_INCLUDE_DIR "/usr/local/opt/libarchive/include")
set(LibArchive_LIBRARY "/usr/local/opt/libarchive/lib/libarchive.dylib")
elseif(EXISTS "/opt/local/lib/libarchive.dylib")
set(LibArchive_LIBRARY "/opt/local/lib/libarchive.dylib")
endif()
find_package(LibArchive)
if(NOT LibArchive_FOUND)
message(WARNING "${ColorRed}libarchive not found, multiarc will have weaker archives support. Its recommended to install libarchive-dev and reconfigure far2l.${ColorNormal}")
endif()
endif()
pkg_search_module(PCRE QUIET libpcre)
if(NOT PCRE_FOUND)
message(WARNING "${ColorRed}libpcre not found, multiarc will have no regexp support in custom archive format descriptions. Install libpcre and reconfigure far2l if you need that functionality.${ColorNormal}")
endif()
add_subdirectory (multiarc)
else()
message(STATUS "${ColorRed}MULTIARC plugin disabled due to MULTIARC=${MULTIARC}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/multiarc/plug/multiarc.far-plug-mb)
" COMPONENT system)
endif()
if (NOT DEFINED NETROCKS OR NETROCKS)
message(STATUS "NETROCKS plugin enabled")
find_package(OpenSSL)
if(OPENSSL_FOUND)
message(STATUS "OpenSSL found -> enjoy FTPS support in NetRocks")
else()
message(WARNING "${ColorRed}OpenSSL not found, NetRocks will not have FTPS protocol support. Install libssl-dev if you want FTPS protocol available in NetRocks.${ColorNormal}")
endif(OPENSSL_FOUND)
find_package(LibSSH 0.5.0)
if(LIBSSH_FOUND)
message(STATUS "libssh found -> enjoy SFTP support in NetRocks")
else()
message(WARNING "${ColorRed}libssh not found, NetRocks will not have SFTP protocol support. Install libssh-dev if you want SFTP protocol available in NetRocks.${ColorNormal}")
endif(LIBSSH_FOUND)
find_package(Libsmbclient)
if(LIBSMBCLIENT_FOUND)
message(STATUS "libsmbclient found -> enjoy SMB support in NetRocks")
else()
message(WARNING "${ColorRed}libsmbclient not found, NetRocks will not have SMB protocol support. Install libsmbclient-dev if you want SMB protocol available in NetRocks.${ColorNormal}")
endif(LIBSMBCLIENT_FOUND)
find_package(LibNfs)
if(LIBNFS_FOUND)
message(STATUS "libnfs found -> enjoy NFS support in NetRocks")
else()
message(WARNING "${ColorRed}libnfs not found, NetRocks will not have NFS protocol support. Install libnfs-dev if you want NFS protocol available in NetRocks.${ColorNormal}")
endif(LIBNFS_FOUND)
find_package(LibNEON)
if(LIBNEON_FOUND)
message(STATUS "libneon found -> enjoy WebDav support in NetRocks")
else()
message(WARNING "${ColorRed}libneon not found, NetRocks will not have WebDav protocol support. Install libneon*-dev if you want WebDav protocol available in NetRocks.${ColorNormal}")
endif(LIBNEON_FOUND)
add_subdirectory (NetRocks)
else()
message(STATUS "${ColorRed}NETROCKS plugin disabled due to NETROCKS=${NETROCKS}${ColorNormal}")
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/NetRocks/plug/NetRocks.far-plug-wide)
" COMPONENT system)
endif()
if (DEFINED PYTHON AND PYTHON)
message(STATUS "PYTHON plugin with interpreter from virtualenv enabled")
add_subdirectory (python)
# Copy this explicitly cuz generic copier command excludes 'far2l'
install(DIRECTORY "${INSTALL_DIR}/Plugins/python/plug/far2l"
DESTINATION "lib/far2l/Plugins/python/plug/" USE_SOURCE_PERMISSIONS
COMPONENT base FILES_MATCHING
PATTERN "*")
install(DIRECTORY "${INSTALL_DIR}/Plugins/python/plug/plugins"
DESTINATION "lib/far2l/Plugins/python/plug/" USE_SOURCE_PERMISSIONS
COMPONENT base FILES_MATCHING
PATTERN "*")
else()
message(STATUS "${ColorRed}PYTHON plugin disabled, use -DPYTHON=yes if you need it${ColorNormal}")
install(CODE "
execute_process(COMMAND rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/python/plug/python.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED SIMPLEINDENT OR SIMPLEINDENT)
message(STATUS "SIMPLEINDENT plugin enabled")
add_subdirectory (SimpleIndent)
else()
message(STATUS "${ColorRed}SIMPLEINDENT plugin disabled due to SIMPLEINDENT=${SIMPLEINDENT}${ColorNormal}")
install(CODE "
execute_process(COMMAND rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/SimpleIndent/plug/SimpleIndent.far-plug-wide)
" COMPONENT system)
endif()
if (NOT DEFINED TMPPANEL OR TMPPANEL)
message(STATUS "TMPPANEL plugin enabled")
add_subdirectory (tmppanel)
else()
message(STATUS "${ColorRed}TMPPANEL plugin disabled due to TMPPANEL=${TMPPANEL}${ColorNormal}")
install(CODE "
execute_process(COMMAND rm -f ${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/tmppanel/plug/tmppanel.far-plug-wide)
" COMPONENT system)
endif()
##############################
# common install directives
add_subdirectory (packaging)
add_subdirectory(man)
add_subdirectory(bash-completion)
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(FIXUP_SCRIPT packaging/osx/FixupBundle.cmake)
configure_file(${FIXUP_SCRIPT}.in ${PROJECT_BINARY_DIR}/${FIXUP_SCRIPT} @ONLY)
install(DIRECTORY ${APP_DIR}/${APP_NAME}.app DESTINATION . USE_SOURCE_PERMISSIONS COMPONENT app EXCLUDE_FROM_ALL)
install(SCRIPT ${PROJECT_BINARY_DIR}/${FIXUP_SCRIPT} COMPONENT app EXCLUDE_FROM_ALL)
endif()
install(PROGRAMS "${INSTALL_DIR}/${EXECUTABLE_NAME}" DESTINATION "bin" RENAME far2l COMPONENT base)
install(DIRECTORY "${INSTALL_DIR}/" DESTINATION "lib/far2l" USE_SOURCE_PERMISSIONS COMPONENT base FILES_MATCHING
PATTERN "colorer/base" EXCLUDE
PATTERN "far2l_gui.so"
PATTERN "far2l_ttyx.broker"
PATTERN "plug/*.far-plug-*"
PATTERN "plug/*.broker"
)
install(DIRECTORY "${INSTALL_DIR}/" DESTINATION "share/far2l" USE_SOURCE_PERMISSIONS COMPONENT base FILES_MATCHING
PATTERN "${EXECUTABLE_NAME}" EXCLUDE
PATTERN "far2ledit" EXCLUDE
PATTERN "far2l_*" EXCLUDE
PATTERN "*.far-plug-*" EXCLUDE
PATTERN "*.broker" EXCLUDE
PATTERN "python/plug/python" EXCLUDE
PATTERN "*"
)
# setup some symlinks and remove deprecated stuff from previous installation
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../bin/far2l ${PROJECT_BINARY_DIR}/far2l/far2l_askpass)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink ../../bin/far2l ${PROJECT_BINARY_DIR}/far2l/far2l_sudoapp)
execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink far2l ${PROJECT_BINARY_DIR}/far2l/far2ledit)
install(FILES "${PROJECT_BINARY_DIR}/far2l/far2l_askpass" DESTINATION "lib/far2l" COMPONENT system)
install(FILES "${PROJECT_BINARY_DIR}/far2l/far2l_sudoapp" DESTINATION "lib/far2l" COMPONENT system)
install(FILES "${PROJECT_BINARY_DIR}/far2l/far2ledit" DESTINATION "bin" COMPONENT base)
install(CODE "
execute_process(COMMAND ${CMAKE_COMMAND} -E remove -f \"\${CMAKE_INSTALL_PREFIX}/lib/far2l/Plugins/objinfo/plug/objinfo.far-plug-mb\")
" COMPONENT system)