aboutsummaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt49
1 files changed, 32 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0bef602..fd662ec 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,40 +1,52 @@
# target_compile_features has been introduced in that version
-cmake_minimum_required (VERSION 3.1)
-project (sdn VERSION 0.1 LANGUAGES CXX)
+cmake_minimum_required (VERSION 3.1...3.27)
+project (sdn VERSION 1.1 LANGUAGES CXX)
if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU")
set (CMAKE_CXX_FLAGS
"${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-misleading-indentation -pedantic")
endif ()
-# Since we use a language with slow compilers, let's at least use a fast linker
-execute_process (COMMAND ${CMAKE_CXX_COMPILER} -fuse-ld=gold -Wl,--version
- ERROR_QUIET OUTPUT_VARIABLE ld_version)
-if ("${ld_version}" MATCHES "GNU gold")
- set (CMAKE_EXE_LINKER_FLAGS "-fuse-ld=gold ${CMAKE_EXE_LINKER_FLAGS}")
-endif ()
-
find_package (PkgConfig REQUIRED)
-pkg_check_modules (NCURSESW QUIET ncursesw)
+pkg_check_modules (ACL libacl)
+pkg_check_modules (NCURSESW ncursesw)
+if (NOT NCURSESW_FOUND)
+ find_library (NCURSESW_LIBRARIES NAMES ncursesw)
+ find_path (NCURSESW_INCLUDE_DIRS ncurses.h PATH_SUFFIXES ncurses)
+endif ()
add_executable (${PROJECT_NAME} ${PROJECT_NAME}.cpp)
-target_include_directories (${PROJECT_NAME} PUBLIC ${NCURSESW_INCLUDE_DIRS})
-target_link_libraries (${PROJECT_NAME} PUBLIC ${NCURSESW_LIBRARIES} acl)
+target_include_directories (${PROJECT_NAME}
+ PUBLIC ${NCURSESW_INCLUDE_DIRS} ${ACL_INCLUDE_DIRS})
+target_link_directories (${PROJECT_NAME}
+ PUBLIC ${NCURSESW_LIBRARY_DIRS} ${ACL_LIBRARY_DIRS})
+target_link_libraries (${PROJECT_NAME}
+ PUBLIC ${NCURSESW_LIBRARIES} ${ACL_LIBRARIES})
target_compile_features (${PROJECT_NAME} PUBLIC cxx_std_14)
target_compile_definitions (${PROJECT_NAME} PUBLIC
- -DPROJECT_NAME=\"${PROJECT_NAME}\" -DPROJECT_VERSION=\"${PROJECT_VERSION}\")
+ PROJECT_NAME=\"${PROJECT_NAME}\" PROJECT_VERSION=\"${PROJECT_VERSION}\")
+if (MSYS)
+ target_compile_definitions (${PROJECT_NAME} PUBLIC _GNU_SOURCE)
+endif ()
+
+add_executable (${PROJECT_NAME}-mc-ext ${PROJECT_NAME}-mc-ext.cpp)
+target_compile_features (${PROJECT_NAME}-mc-ext PUBLIC cxx_std_17)
include (GNUInstallDirs)
-install (TARGETS ${PROJECT_NAME} DESTINATION ${CMAKE_INSTALL_BINDIR})
-install (PROGRAMS ${PROJECT_NAME}-install DESTINATION ${CMAKE_INSTALL_BINDIR})
-install (FILES sdn.1 sdn-install.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
+# sdn-mc-ext should be in libexec, but we prefer it in PATH.
+install (TARGETS sdn sdn-mc-ext
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
+install (PROGRAMS sdn-install sdn-open sdn-view sdn-edit
+ DESTINATION ${CMAKE_INSTALL_BINDIR})
+install (FILES sdn.1 sdn-install.1 sdn-open.1 sdn-view.1 sdn-edit.1
+ DESTINATION ${CMAKE_INSTALL_MANDIR}/man1)
install (FILES LICENSE DESTINATION ${CMAKE_INSTALL_DOCDIR})
set (CPACK_PACKAGE_DESCRIPTION_SUMMARY "Directory navigator")
set (CPACK_PACKAGE_VENDOR "Premysl Eric Janouch")
set (CPACK_PACKAGE_CONTACT "Přemysl Eric Janouch <p@janouch.name>")
set (CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/LICENSE")
-set (CPACK_GENERATOR "TGZ;ZIP")
+set (CPACK_GENERATOR "TGZ")
set (CPACK_PACKAGE_FILE_NAME
"${PROJECT_NAME}-${PROJECT_VERSION}-${CMAKE_SYSTEM_NAME}-${CMAKE_SYSTEM_PROCESSOR}")
set (CPACK_PACKAGE_INSTALL_DIRECTORY "${PROJECT_NAME}-${PROJECT_VERSION}")
@@ -42,5 +54,8 @@ set (CPACK_SOURCE_GENERATOR "TGZ;ZIP")
set (CPACK_SOURCE_IGNORE_FILES "/\\\\.git;/build;/CMakeLists.txt.user")
set (CPACK_SOURCE_PACKAGE_FILE_NAME "${PROJECT_NAME}-${PROJECT_VERSION}")
+set (CPACK_DEBIAN_PACKAGE_RECOMMENDS "mc")
+set (CPACK_DEBIAN_PACKAGE_SECTION "utils")
+
set (CPACK_SET_DESTDIR TRUE)
include (CPack)