forked from clever-lang/clever
-
Notifications
You must be signed in to change notification settings - Fork 1
/
environment.cmake
69 lines (57 loc) · 2.21 KB
/
environment.cmake
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#
# Clever programming language
# Copyright (c) 2011-2013 Clever Team
#
# environment.cmake - Platform/Compiler-related configuration
#
# Platform checks
# ---------------------------------------------------------------------------
if(WIN32)
set(CLEVER_SOURCES ${CLEVER_SOURCES} win32/dirent.h win32/win32.cc win32/win32.h)
add_definitions(-DCLEVER_WIN32)
endif()
if(APPLE)
add_definitions(-DCLEVER_APPLE)
endif()
if(CYGWIN)
add_definitions(-DCLEVER_CYGWIN)
endif()
if(MSVC)
add_definitions(-DCLEVER_MSVC)
add_definitions(-DCLEVER_MSVC_VERSION=${MSVC_VERSION})
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
add_definitions(-D_ITERATOR_DEBUG_LEVEL=0)
endif()
if(HAIKU)
add_definitions(-DCLEVER_HAIKU)
endif()
if("${CMAKE_CXX_COMPILER}" MATCHES "clang(\\+\\+)?$")
set(CMAKE_COMPILER_IS_CLANGXX 1)
endif()
# Build environment
# ---------------------------------------------------------------------------
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
message(STATUS "Building in debug mode. Use -DCMAKE_BUILD_TYPE=Release to change")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "/DWIN32 /D_WINDOWS /Zm1000 /EHsc- /GR-")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /W1 /wd4503")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} /Zi /D_DEBUG /DCLEVER_DEBUG /MDd")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /O2 /DNDEBUG /MD")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -std=c++98 -fno-rtti -fno-exceptions")
if(ENABLE_WPADDED)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wpadded")
else()
message(STATUS "Use -DENABLE_WPADDED=1 to enable padding messages")
endif()
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-inline -ggdb -D_DEBUG -DCLEVER_DEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O2 -DNDEBUG")
set(CMAKE_CXX_FLAGS_DEVEL "${CMAKE_CXX_FLAGS_DEBUG} -O0 -Wextra -Wno-unused-parameter -Wno-variadic-macros")
set(CMAKE_CXX_FLAGS_DEVEL "${CMAKE_CXX_FLAGS_DEVEL} -pedantic -fverbose-asm -finstrument-functions")
set(CMAKE_CXX_FLAGS_DEVEL "${CMAKE_CXX_FLAGS_DEVEL} -fno-omit-frame-pointer -fstack-protector")
if(CMAKE_COMPILER_IS_CLANGXX)
#set(CMAKE_CXX_FLAGS_DEVEL "${CMAKE_CXX_FLAGS_DEVEL} -Werror=gnu -DCLEVER_NOGNU")
endif()
endif()