cmake_minimum_required(VERSION 3.10) project(CrowHTMX) set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) # Allow selection of build type if not set if(NOT CMAKE_BUILD_TYPE) set(CMAKE_BUILD_TYPE Debug CACHE STRING "Choose the type of build." FORCE) endif() # Supported build types set(SUPPORTED_BUILD_TYPES Debug Release RelWithDebInfo MinSizeRel) if(NOT CMAKE_BUILD_TYPE IN_LIST SUPPORTED_BUILD_TYPES) message(FATAL_ERROR "Unsupported build type: ${CMAKE_BUILD_TYPE}") endif() # Copy 'static' and 'templates' directories to build directory file(GLOB_RECURSE STATIC_FILES "${CMAKE_SOURCE_DIR}/static/*") file(GLOB_RECURSE TEMPLATE_FILES "${CMAKE_SOURCE_DIR}/templates/*") foreach(file IN LISTS STATIC_FILES) file(RELATIVE_PATH rel_path "${CMAKE_SOURCE_DIR}" "${file}") configure_file("${file}" "${CMAKE_BINARY_DIR}/${rel_path}" COPYONLY) endforeach() foreach(file IN LISTS TEMPLATE_FILES) file(RELATIVE_PATH rel_path "${CMAKE_SOURCE_DIR}" "${file}") configure_file("${file}" "${CMAKE_BINARY_DIR}/${rel_path}" COPYONLY) endforeach() # Use Crow from system include (installed via yay -S crow + asio) include_directories(/usr/include) add_executable(app src/main.cpp src/htmx/HtmxTable.cpp src/htmx/HtmxTable.h src/systemd.cpp src/systemd.h src/json.hpp src/htmx/HtmxTableRow.cpp src/htmx/HtmxTableRow.h src/htmx/HtmxObject.cpp src/htmx/HtmxObject.h src/htmx_helper.cpp src/htmx_helper.h src/json_settings.cpp src/json_settings.h src/json.hpp) target_link_libraries(app pthread) # Optional: Print build type at configuration time message(STATUS "Configuring build type: ${CMAKE_BUILD_TYPE}")