summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorRomain Forlot <romain.forlot@iot.bzh>2018-04-18 11:49:42 +0200
committerRomain Forlot <romain.forlot@iot.bzh>2018-12-13 14:12:02 +0100
commitb8f8b83fde488ca637a57af0d369b0a7ec38465f (patch)
tree3c571586728a39906bf14fa64b0fd5af18b9876e /CMakeLists.txt
parent40a5f980d11b9f54ecd595c692e814a9655d6221 (diff)
Make CURL Wrapping functions optional
Search CURL package in your system and add it if found. This will add a libcurl to be linked with the target. Change-Id: Ie4a720fd11de97abead7a92a7fb18b5c8af21ec5 Signed-off-by: Romain Forlot <romain.forlot@iot.bzh>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt32
1 files changed, 22 insertions, 10 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5e1eb90..94a4cae 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -23,9 +23,10 @@
PROJECT_TARGET_ADD(afb-helpers)
set(CMAKE_AUTOMOC ON)
- set(AFB_HELPERS_SRCS curl-wrap.c escape.c wrap-json.c filescan-utils.c)
+ set(AFB_HELPERS_SRCS wrap-json.c filescan-utils.c escape.c)
option(AFB_HELPERS_QTWSCLIENT "Enable the Qt's websocket client to Application Framework Binders" OFF)
+ find_package(CURL)
if (AFB_HELPERS_QTWSCLIENT)
message(STATUS "Qt's WebSocket AFB Client: Enabled!")
@@ -35,7 +36,14 @@ set(CMAKE_AUTOMOC ON)
message(STATUS "Qt's WebSocket AFB Client: Disabled!")
endif()
- # Define targets
+ if (CURL_FOUND)
+ message(STATUS "CURL wrapping helpers: Enabled!")
+ set(AFB_HELPERS_SRCS ${AFB_HELPERS_SRCS} curl-wrap.c)
+ else()
+ message(STATUS "CURL wrapping helpers: Disabled!")
+ endif()
+
+ # Define targets
ADD_LIBRARY(${TARGET_NAME} STATIC ${AFB_HELPERS_SRCS})
if (AFB_HELPERS_QTWSCLIENT)
@@ -43,13 +51,17 @@ set(CMAKE_AUTOMOC ON)
qt5_use_modules(${TARGET_NAME} WebSockets)
endif()
- # Library properties
- SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
- OUTPUT_NAME ${TARGET_NAME}
- )
+ if (CURL_FOUND)
+ target_link_libraries(${TARGET_NAME} curl)
+ endif()
+
+ # Library properties
+ SET_TARGET_PROPERTIES(${TARGET_NAME} PROPERTIES
+ OUTPUT_NAME ${TARGET_NAME}
+ )
- # Define target includes
- TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
- PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
- )
+ # Define target includes
+ TARGET_INCLUDE_DIRECTORIES(${TARGET_NAME}
+ PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
+ )