From e9432ac1ca1af977005f5e0db880452c448fecbb Mon Sep 17 00:00:00 2001 From: Lion Kortlepel Date: Tue, 3 Nov 2020 11:48:42 +0100 Subject: [PATCH] add WIN32 and UNIX specific cmake instructions --- CMakeLists.txt | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 858b422..040bfca 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,25 @@ cmake_minimum_required(VERSION 3.10) project(Server) set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -fmax-errors=1 -Wconversion") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DDEBUG") + +if (UNIX) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic") + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Og -g") + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -s") +elseif (WIN32) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W3 /permissive-") +endif () + +find_package(Boost 1.71.0 REQUIRED COMPONENTS system thread) file(GLOB source_files "src/*.cpp" "src/*/*.cpp" "include/*.h" "include/*/*.h" "include/*.hpp" "include/*/*.hpp") -add_executable(${PROJECT_NAME} ${source_files}) -target_include_directories(${PROJECT_NAME} PUBLIC $) -set_target_properties(${PROJECT_NAME} PROPERTIES OUTPUT_NAME "BeamMP-Server") -target_link_libraries(${PROJECT_NAME} curl lua5.3 z pthread stdc++fs) +add_executable(BeamMP-Server ${source_files}) + +target_include_directories(BeamMP-Server PUBLIC $ ${Boost_INCLUDE_DIRS}) + +if (UNIX) + target_link_libraries(BeamMP-Server curl lua5.3 krb5 z pthread stdc++fs ${Boost_LINK_DIRS}) +elseif (WIN32) + target_link_libraries(BeamMP-Server libcurl_a urlmon ws2_32 lua53 zlibstatic ${Boost_LINK_DIRS}) +endif ()