1 # Copyright 2015-present Samsung Electronics Co., Ltd. and other contributors
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
7 # http://www.apache.org/licenses/LICENSE-2.0
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.
15 cmake_minimum_required(VERSION 2.8)
17 if("${TARGET_OS}" MATCHES "NUTTX|TIZENRT")
18 set(HTTPPARSER_NUTTX_ARG -DNUTTX_HOME=${TARGET_SYSTEMROOT})
21 set(DEPS_HTTPPARSER deps/http-parser)
22 set(DEPS_HTTPPARSER_SRC ${ROOT_DIR}/${DEPS_HTTPPARSER}/)
23 ExternalProject_Add(http-parser
24 PREFIX ${DEPS_HTTPPARSER}
25 SOURCE_DIR ${DEPS_HTTPPARSER_SRC}
27 BINARY_DIR ${DEPS_HTTPPARSER}
29 ${CMAKE_COMMAND} -E copy
30 ${CMAKE_BINARY_DIR}/${DEPS_HTTPPARSER}/libhttpparser.a
31 ${CMAKE_BINARY_DIR}/lib/
33 -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
34 -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
35 -DBUILDTYPE=${CMAKE_BUILD_TYPE} # TODO: use CMAKE_BUILD_TYPE in sub-project
36 -DCMAKE_C_FLAGS=${CMAKE_C_FLAGS}
38 ${HTTPPARSER_NUTTX_ARG}
40 add_library(libhttp-parser STATIC IMPORTED)
41 add_dependencies(libhttp-parser http-parser)
42 set_property(TARGET libhttp-parser PROPERTY
43 IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/lib/libhttpparser.a)
44 set_property(DIRECTORY APPEND PROPERTY
45 ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_DIR}/lib/libhttpparser.a)
47 set(HTTPPARSER_INCLUDE_DIR ${DEPS_HTTPPARSER_SRC})