mirror of
https://github.com/obgm/libcoap.git
synced 2026-12-05 20:02:19 +03:00
CMakeLists.txt: Handle Proxy configurations and existing built coap.h
This commit is contained in:
1 parent
da539d85ad
commit
e234acae9f
2 files changed
+24
-2
No files matched your search
+17
-2
@@ -327,8 +327,14 @@ else()
|
||||
endif()
|
||||
|
||||
if(${ENABLE_PROXY_CODE})
|
||||
set(COAP_PROXY_SUPPORT "1")
|
||||
message(STATUS "compiling with proxy support")
|
||||
if(${ENABLE_CLIENT_MODE} AND ${ENABLE_SERVER_MODE})
|
||||
set(COAP_PROXY_SUPPORT "1")
|
||||
message(STATUS "compiling with proxy support")
|
||||
else()
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"Both ENABLE_CLIENT_MODE and ENABLE_SERVER_MODE need to be set for ENABLE_PROXY_CODE")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "compiling without proxy support")
|
||||
endif()
|
||||
@@ -716,6 +722,15 @@ else(ENABLE_TCP)
|
||||
set(COAP_DISABLE_TCP 1)
|
||||
endif(ENABLE_TCP)
|
||||
|
||||
# Get rid of any previously built coap.h now that it is provided
|
||||
if(NOT "${CMAKE_CURRENT_LIST_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
|
||||
if(EXISTS ${CMAKE_CURRENT_BINARY_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h)
|
||||
message(
|
||||
FATAL_ERROR
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/include/coap${LIBCOAP_API_VERSION}/coap.h exists and needs to be deleted")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# creates config header file in build directory
|
||||
configure_file(${CMAKE_CURRENT_LIST_DIR}/cmake_coap_config.h.in
|
||||
${CMAKE_CURRENT_BINARY_DIR}/coap_config.h)
|
||||
|
||||
@@ -18,6 +18,13 @@
|
||||
#if COAP_PROXY_SUPPORT
|
||||
#include <stdio.h>
|
||||
|
||||
#if COAP_CLIENT_SUPPORT == 0
|
||||
#error For Proxy support, COAP_CLIENT_SUPPORT must be set
|
||||
#endif
|
||||
#if COAP_SERVER_SUPPORT == 0
|
||||
#error For Proxy support, COAP_SERVER_SUPPORT must be set
|
||||
#endif
|
||||
|
||||
#ifdef _WIN32
|
||||
#define strcasecmp _stricmp
|
||||
#define strncasecmp _strnicmp
|
||||
|
||||
Reference in new issue
Block a user