| # Licensed to the Apache Software Foundation (ASF) under one |
| # or more contributor license agreements. See the NOTICE file |
| # distributed with this work for additional information |
| # regarding copyright ownership. The ASF licenses this file |
| # to you 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 3.14) |
| project(service) |
| |
| AUX_SOURCE_DIRECTORY(src DIR_SRCS) |
| add_executable(service ${DIR_SRCS}) |
| |
| set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -Wall ") |
| set(CMAKE_BUILD_TYPE Debug) |
| include_directories(include) |
| |
| find_package(OpenSSL REQUIRED) |
| if(OPENSSL_FOUND) |
| set(HTTPLIB_IS_USING_OPENSSL TRUE) |
| endif() |
| |
| target_link_libraries(service PUBLIC |
| $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::SSL> |
| $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:OpenSSL::Crypto>) |
| |
| target_compile_definitions(service PUBLIC |
| $<$<BOOL:${HTTPLIB_IS_USING_OPENSSL}>:CPPHTTPLIB_OPENSSL_SUPPORT> |
| ) |
| |
| include(FetchContent) |
| FetchContent_Declare(httplib GIT_REPOSITORY https://github.com/yhirose/cpp-httplib.git |
| GIT_TAG d92c31446687cfa336a6332b1015b4fe289fbdec) # The commit hash for 0.11.1 |
| FetchContent_MakeAvailable(httplib) |
| target_link_libraries(service PRIVATE httplib::httplib) |