forked from bog2k3/boglfw
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
50 lines (40 loc) · 1.27 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
44
45
46
47
48
49
50
cmake_minimum_required(VERSION 3.13)
project(FossCppFw)
if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(MACOSX TRUE)
endif()
if(WIN32)
message("Detected platform: Windows")
set(CMAKE_CXX_GLAGS "${CMAKE_CXX_FLAGS} -D__WIN32__ -mthreads")
elseif(MACOSX)
message("Detected platform: MacOSX (Darwin)")
link_directories("/usr/local/lib")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__MACOSX__")
else()
message("Detected platform: Unix-like")
endif()
include_directories(src)
# add sources
file(GLOB_RECURSE headers src/*.h)
file(GLOB_RECURSE sources src/*.c src/*.cpp)
add_library(${PROJECT_NAME} ${headers} ${sources})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DENABLE_PERF_PROFILING")
if(MACOSX)
target_compile_options(${PROJECT_NAME} PUBLIC -Duint=unsigned)
endif()
# add platform specific libraries here
if(WIN32)
target_compile_options(${PROJECT_NAME} PUBLIC -Duint=unsigned
-DWIN32_LEAN_AND_MEAN # Don't include all the unused junk from the windows headers
-D_WIN32_WINNT=0x0601 # Target windows 7 for ASIO
-DWIN32
)
endif()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
target_compile_options(${PROJECT_NAME} PUBLIC
-Wall -Werror=return-type -Wfatal-errors
-std=c++17
)
if(NOT MACOSX)
target_compile_options(${PROJECT_NAME} PUBLIC -march=x86-64)
endif()