cmake_minimum_required(VERSION 3.10) project(dropshell VERSION 1.0.0 LANGUAGES CXX) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Configure version information string(TIMESTAMP CURRENT_YEAR "%Y") string(TIMESTAMP CURRENT_MONTH "%m") string(TIMESTAMP CURRENT_DAY "%d") set(PROJECT_VERSION "${CURRENT_YEAR}.${CURRENT_MONTH}.${CURRENT_DAY}") string(TIMESTAMP RELEASE_DATE "%Y-%m-%d") # Configure version.hpp file configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/src/version.hpp.in" "${CMAKE_CURRENT_BINARY_DIR}/src/version.hpp" @ONLY ) # Find required packages find_package(Boost REQUIRED COMPONENTS program_options filesystem system) find_package(Curses REQUIRED) find_package(TBB REQUIRED) # Auto-detect source files file(GLOB_RECURSE SOURCES "src/*.cpp") file(GLOB_RECURSE HEADERS "src/*.hpp") # Add executable add_executable(dropshell ${SOURCES}) # Set include directories target_include_directories(dropshell PRIVATE src ${CMAKE_CURRENT_BINARY_DIR}/src ${CURSES_INCLUDE_DIRS} ) # Link libraries target_link_libraries(dropshell PRIVATE Boost::program_options Boost::filesystem Boost::system ${CURSES_LIBRARIES} TBB::tbb ) # Install targets install(TARGETS dropshell RUNTIME DESTINATION bin ) # Create symbolic link 'ds' pointing to 'dropshell' install(CODE " message(STATUS \"Creating symlink: ds -> dropshell\") execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink \${CMAKE_INSTALL_PREFIX}/bin/dropshell \${CMAKE_INSTALL_PREFIX}/bin/ds ) ") # Install completion script install(FILES src/dropshell-completion.bash DESTINATION /etc/bash_completion.d RENAME dropshell ) # Create a symlink for the completion script to work with 'ds' command install(CODE " message(STATUS \"Creating completion script symlink for 'ds'\") execute_process( COMMAND ${CMAKE_COMMAND} -E create_symlink /etc/bash_completion.d/dropshell /etc/bash_completion.d/ds ) ") # Create pre-install script to clean old templates install(CODE " message(STATUS \"Removing old template files...\") execute_process(COMMAND rm -rf /opt/dropshell/templates) ") # Install templates with pre-install script install(DIRECTORY templates/ DESTINATION /opt/dropshell/templates )