rum/CMakeLists.txt

38 lines
1015 B
CMake
Raw Normal View History

2023-12-04 16:40:14 +00:00
cmake_minimum_required(VERSION 3.25)
project(Rum VERSION 1.0)
# compiler setup
set(CMAKE_CXX_COMPILER "clang++")
2023-12-05 17:58:39 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Werror") # warnings
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++2b") # std c++23
2023-12-04 16:40:14 +00:00
2023-12-05 17:58:39 +00:00
if (STATIC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -static") # static
endif()
2023-12-04 16:40:14 +00:00
2023-12-05 17:58:39 +00:00
if (DEBUG)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g") # debug symbols
endif()
2023-12-04 16:40:14 +00:00
2023-12-05 17:58:39 +00:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2") # optimisations
2023-12-04 16:40:14 +00:00
# IDE setup (clangd)
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
file(GLOB_RECURSE SOURCES "${CMAKE_SOURCE_DIR}/src/*.cpp")
add_executable(server.bin ${SOURCES})
target_include_directories(server.bin PRIVATE "${CMAKE_SOURCE_DIR}/inc")
add_custom_target(run
COMMAND $<TARGET_FILE:server.bin>
DEPENDS server.bin
COMMENT "Running server.bin"
2023-12-05 17:58:39 +00:00
)
add_custom_target(docker
COMMAND docker build -t dowerx/rum:${CMAKE_PROJECT_VERSION} ..
COMMENT "Building docker image"
2023-12-04 16:40:14 +00:00
)