forked from jerryscript-project/iotjs
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
77 lines (62 loc) · 1.99 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
# Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
cmake_minimum_required(VERSION 2.8)
project(IOTJS C)
set(IOTJS_VERSION_MAJOR 0)
set(IOTJS_VERSION_MINOR 1)
# Do a few default checks
if(NOT DEFINED PLATFORM_DESCRIPTOR)
message(FATAL_ERROR "No PLATFORM_DESCRIPTOR specified (format: <arch>-<os>)")
endif()
string(REPLACE "-" ";" PLATFORM_ARGS ${PLATFORM_DESCRIPTOR})
if(NOT DEFINED TARGET_OS)
list(GET PLATFORM_ARGS 1 TARGET_OS)
message(
"TARGET_OS not specified, using '${TARGET_OS}' from PLATFORM_DESCRIPTOR")
endif()
string(TOUPPER "${TARGET_OS}" TARGET_OS)
if(NOT CMAKE_BUILD_TYPE)
message("CMAKE_BUILD_TYPE was not set! Configuring for Debug build!")
set(CMAKE_BUILD_TYPE Debug)
elseif("${CMAKE_BUILD_TYPE}" STREQUAL "Release")
message("CMAKE_BUILD_TYPE was set to Release, switching to MinSizeRel")
set(CMAKE_BUILD_TYPE MinSizeRel)
endif()
if(NOT DEFINED BUILD_LIB_ONLY)
set(BUILD_LIB_ONLY OFF)
endif()
if(NOT DEFINED ENABLE_SNAPSHOT)
message("Snapshot mode force enabled")
set(ENABLE_SNAPSHOT ON)
endif()
if(NOT DEFINED ENABLE_LTO)
message("LTO force disabled")
set(ENABLE_LTO OFF)
endif()
set(ROOT_DIR ${CMAKE_SOURCE_DIR})
# Common compile flags
set(CFLAGS_COMMON
-Wall
-Wextra
-Werror
-Wno-unused-parameter
-Wsign-conversion
-std=gnu99
)
include(ExternalProject)
# Include external projects
include(cmake/jerry.cmake)
include(cmake/http-parser.cmake)
include(cmake/libtuv.cmake)
include(cmake/iotjs.cmake)