30 lines
838 B
CMake
30 lines
838 B
CMake
|
cmake_minimum_required(VERSION 3.15)
|
||
|
project(TeaWebDNS)
|
||
|
|
||
|
set(CMAKE_CXX_STANDARD 17)
|
||
|
|
||
|
#Setup the compiler (Cant be done within a function!)
|
||
|
if (MSVC)
|
||
|
set(CompilerFlags
|
||
|
CMAKE_C_FLAGS_DEBUG
|
||
|
CMAKE_C_FLAGS_MINSIZEREL
|
||
|
CMAKE_C_FLAGS_RELEASE
|
||
|
CMAKE_C_FLAGS_RELWITHDEBINFO
|
||
|
CMAKE_CXX_FLAGS_DEBUG
|
||
|
CMAKE_CXX_FLAGS_MINSIZEREL
|
||
|
CMAKE_CXX_FLAGS_RELEASE
|
||
|
CMAKE_CXX_FLAGS_RELWITHDEBINFO
|
||
|
)
|
||
|
foreach(CompilerFlag ${CompilerFlags})
|
||
|
string(REPLACE "/MD" "/MT" ${CompilerFlag} "${${CompilerFlag}}")
|
||
|
endforeach()
|
||
|
else()
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -static-libgcc -static-libstdc++")
|
||
|
endif()
|
||
|
|
||
|
# Require libevent
|
||
|
find_package(Libevent REQUIRED)
|
||
|
include_directories(${LIBEVENT_INCLUDE_DIRS})
|
||
|
|
||
|
add_executable(TeaWebDNS main.cpp src/server.cpp)
|
||
|
target_link_libraries(TeaWebDNS ${LIBEVENT_STATIC_LIBRARIES} pthread)
|