Update Iot.js
[platform/upstream/iotjs.git] / CMakeLists.txt
1 # Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain a copy of the License at
6 #
7 #     http://www.apache.org/licenses/LICENSE-2.0
8 #
9 # Unless required by applicable law or agreed to in writing, software
10 # distributed under the License is distributed on an "AS IS" BASIS
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 cmake_minimum_required(VERSION 2.8)
16
17 project(IOTJS C)
18
19 set(IOTJS_VERSION_MAJOR 0)
20 set(IOTJS_VERSION_MINOR 1)
21
22 # Do a few default checks
23 if(NOT DEFINED PLATFORM_DESCRIPTOR)
24   message(FATAL_ERROR "No PLATFORM_DESCRIPTOR specified (format: <arch>-<os>)")
25 endif()
26
27 string(REPLACE "-" ";" PLATFORM_ARGS ${PLATFORM_DESCRIPTOR})
28 if(NOT DEFINED TARGET_OS)
29   list(GET PLATFORM_ARGS 1 TARGET_OS)
30   message(
31     "TARGET_OS not specified, using '${TARGET_OS}' from PLATFORM_DESCRIPTOR")
32 endif()
33 string(TOUPPER "${TARGET_OS}" TARGET_OS)
34
35 if(NOT CMAKE_BUILD_TYPE)
36   message("CMAKE_BUILD_TYPE was not set! Configuring for Debug build!")
37   set(CMAKE_BUILD_TYPE Debug)
38 endif()
39
40 if(NOT DEFINED BUILD_LIB_ONLY)
41   set(BUILD_LIB_ONLY OFF)
42 endif()
43
44 if(NOT DEFINED ENABLE_SNAPSHOT)
45   message("Snapshot mode force enabled")
46   set(ENABLE_SNAPSHOT ON)
47 endif()
48
49 if(NOT DEFINED ENABLE_LTO)
50   message("LTO force disabled")
51   set(ENABLE_LTO OFF)
52 endif()
53
54 set(ROOT_DIR ${CMAKE_SOURCE_DIR})
55
56 # Common compile flags
57 set(CFLAGS_COMMON
58   -Wall
59   -Wextra
60   -Werror
61   -Wno-unused-parameter
62   -std=gnu99
63 )
64
65 include(ExternalProject)
66
67 # Include external projects
68 include(cmake/jerry.cmake)
69 include(cmake/http-parser.cmake)
70 include(cmake/libtuv.cmake)
71
72 include(cmake/iotjs.cmake)
73