44 lines
1.4 KiB
CMake
44 lines
1.4 KiB
CMake
|
cmake_minimum_required(VERSION 3.30)
|
||
|
project(mmo)
|
||
|
|
||
|
set(CMAKE_CXX_STANDARD 26)
|
||
|
if (MSVC)
|
||
|
add_compile_options(/W4)
|
||
|
add_compile_options(/WX)
|
||
|
add_compile_options(/external:anglebrackets)
|
||
|
add_compile_options(/external:W0)
|
||
|
add_compile_options(/wd4100)
|
||
|
add_compile_options(/wd5050)
|
||
|
add_definitions(-DWIN32_LEAN_AND_MEAN -DVC_EXTRALEAN)
|
||
|
add_compile_definitions(WIN32_LEAN_AND_MEAN NOMINMAX)
|
||
|
else ()
|
||
|
add_compile_options(-Wall)
|
||
|
add_compile_options(-Wextra)
|
||
|
add_compile_options(-Wpedantic)
|
||
|
add_compile_options(-Werror)
|
||
|
endif ()
|
||
|
|
||
|
# function add santizers
|
||
|
function(add_sanitizers target)
|
||
|
if (MSVC)
|
||
|
target_compile_options(${target} PRIVATE /fsanitize=address /fsanitize=fuzzer /Zi)
|
||
|
target_link_options(${target} PRIVATE /fsanitize=address /fsanitize=fuzzer /Zi)
|
||
|
else ()
|
||
|
target_compile_options(${target} PRIVATE -fsanitize=address -fsanitize=fuzzer)
|
||
|
target_link_options(${target} PRIVATE -fsanitize=address -fsanitize=fuzzer)
|
||
|
endif ()
|
||
|
endfunction()
|
||
|
|
||
|
if (DEFINED VCPKG_INSTALLED_DIR)
|
||
|
elseif (DEFINED ENV{VCPKG_ROOT})
|
||
|
include($ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
|
||
|
else ()
|
||
|
message(FATAL_ERROR "VCPKG is not loaded, set VCPKG_ROOT to automatically load it or specify the cmake toolchain")
|
||
|
endif ()
|
||
|
|
||
|
set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||
|
|
||
|
add_subdirectory(common)
|
||
|
#add_subdirectory(client)
|
||
|
#add_subdirectory(server)
|