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