first commit
This commit is contained in:
40
CMakeLists.txt
Normal file
40
CMakeLists.txt
Normal file
@@ -0,0 +1,40 @@
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(CrowHTMX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
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 main.cpp)
|
||||
|
||||
target_link_libraries(app pthread)
|
||||
|
||||
# Optional: Print build type at configuration time
|
||||
message(STATUS "Configuring build type: ${CMAKE_BUILD_TYPE}")
|
||||
Reference in New Issue
Block a user