-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
43 lines (35 loc) · 1.15 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# cmake minimum version and project name
cmake_minimum_required(VERSION 3.16)
project(42-webserv C CXX)
# set compiler flags and standard
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 98)
set(FLAGS "-O3 -Wall -Wextra -Werror -pedantic-errors")
# set debug flags on debug build
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
set(CMAKE_CXX_FLAGS_DEBUG "-g -DDEBUG_THROW=1")
# set cmake output directory
set(dir ${CMAKE_CURRENT_SOURCE_DIR})
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${dir}/build)
if (APPLE)
set(CMAKE_C_FLAGS "${FLAGS} -DBUILD_APPLE=1")
set(CMAKE_CXX_FLAGS "${FLAGS} -DBUILD_APPLE=1")
elseif(UNIX)
set(CMAKE_C_FLAGS "${FLAGS} -DBUILD_LINUX=1")
set(CMAKE_CXX_FLAGS "${FLAGS} -DBUILD_LINUX=1")
endif ()
# library files
file(GLOB_RECURSE SOURCE_FILES
${CMAKE_SOURCE_DIR}/src/**.c
${CMAKE_SOURCE_DIR}/src/**.cpp)
file(GLOB_RECURSE HEADER_FILES
${CMAKE_SOURCE_DIR}/src/**.h
${CMAKE_SOURCE_DIR}/src/**.hpp)
# set the include directory
include_directories(src/_includes)
include_directories(src)
# create executable and link the library
add_executable(not-apache ${SOURCE_FILES} ${HEADER_FILES})
target_link_libraries(not-apache pthread)