cpp-rest-sdk-client.cmake-lists.mustache Maven / Gradle / Ivy
#
# {{{appName}}}
# {{{appDescription}}}
#
# The version of the OpenAPI document: 1.0.0
#
# https://openapi-generator.tech
#
# NOTE: Auto generated by OpenAPI Generator (https://openapi-generator.tech).
cmake_minimum_required (VERSION 2.8)
#PROJECT's NAME
project(CppRestOpenAPIClient)
set(CMAKE_VERBOSE_MAKEFILE ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
# THE LOCATION OF OUTPUT BINARIES
set(CMAKE_LIBRARY_DIR ${PROJECT_SOURCE_DIR}/lib)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# BUILD TYPE
message("A ${CMAKE_BUILD_TYPE} build configuration is detected")
if (UNIX)
message(STATUS "Building client library for Linux/Unix")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC -Wall -Wno-unused-variable")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -Wall -Wno-unused-variable")
set(cpprestsdk_DIR /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/cmake/)
find_package(cpprestsdk REQUIRED)
find_package(Boost REQUIRED)
else()
message(STATUS "Building client library for Windows")
find_package(cpprestsdk REQUIRED)
find_package(Boost REQUIRED)
find_package(pthreads REQUIRED)
endif()
# Manually set the cpprestsdk paths when not using package manager
#set(CPPREST_INCLUDE_DIR ${CPPREST_ROOT}/include)
#set(CPPREST_LIBRARY_DIR ${CPPREST_ROOT}/lib)
#include_directories(${CPPREST_INCLUDE_DIR})
#link_directories(${CPPREST_LIBRARY_DIR})
#SUPPORTING FILES
set(SUPPORTING_FILES "ApiClient" "ApiConfiguration" "ApiException" "HttpContent" "IHttpBody" "JsonBody" "ModelBase" "MultipartFormData" "Object")
#SOURCE FILES
file(GLOB SOURCE_FILES "api/*" "model/*")
add_library(${PROJECT_NAME} ${SUPPORTING_FILES} ${SOURCE_FILES})
target_include_directories(
${PROJECT_NAME} PRIVATE
${Boost_INCLUDE_DIRS}
${CMAKE_CURRENT_SOURCE_DIR}/model
${CMAKE_CURRENT_SOURCE_DIR}/api
)
target_link_directories(
${PROJECT_NAME} PRIVATE
${Boost_LIBRARY_DIRS}
)
if (UNIX)
target_link_libraries(${PROJECT_NAME} PRIVATE cpprest pthread ${Boost_LIBRARIES} crypto)
else()
target_link_libraries(${PROJECT_NAME} PRIVATE cpprestsdk::cpprest ${pthreads_LIBRARIES} ${Boost_LIBRARIES} bcrypt)
endif()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 14)
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD_REQUIRED ON)