updating cmake modules
This commit is contained in:
47
cmake/FetchCAres.cmake
Normal file
47
cmake/FetchCAres.cmake
Normal file
@@ -0,0 +1,47 @@
|
||||
include(FetchContent)
|
||||
|
||||
if(NOT C_ARES_VERSION)
|
||||
set(C_ARES_VERSION "cares-1_17_2")
|
||||
endif()
|
||||
|
||||
message(STATUS "Fetching and configuring c-ares version ${C_ARES_VERSION}")
|
||||
|
||||
set(FETCHCONTENT_QUIET TRUE)
|
||||
|
||||
set(CARES_BUILD_TESTS OFF CACHE INTERNAL "")
|
||||
set(CARES_BUILD_CONTAINER_TESTS OFF CACHE INTERNAL "")
|
||||
set(CARES_BUILD_TOOLS OFF CACHE INTERNAL "")
|
||||
|
||||
if(STATIC_CARES)
|
||||
set(CARES_SHARED OFF CACHE INTERNAL "")
|
||||
set(CARES_STATIC ON CACHE INTERNAL "")
|
||||
set(CARES_STATIC_PIC ON CACHE INTERNAL "")
|
||||
else()
|
||||
set(CARES_SHARED ON CACHE INTERNAL "")
|
||||
set(CARES_STATIC OFF CACHE INTERNAL "")
|
||||
set(CARES_STATIC_PIC OFF CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(
|
||||
c-ares GIT_REPOSITORY https://github.com/c-ares/c-ares.git GIT_TAG ${C_ARES_VERSION} GIT_PROGRESS TRUE OVERRIDE_FIND_PACKAGE
|
||||
)
|
||||
FetchContent_MakeAvailable(c-ares)
|
||||
|
||||
add_custom_target(
|
||||
c-ares-symbolic-link
|
||||
DEPENDS c-ares
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_SOURCE_DIR}/src/c-ares-libs
|
||||
# Note that ${CMAKE_SOURCE_DIR}/src/c-ares-libs/c-ares does not have a '/' at the end, this is intentional!
|
||||
# If a '/' is placed at the end, the symlink will try create the link inside src/c-ares-libs/c-ares/ folder
|
||||
# Without a '/', it will create a symlink called kperf inside ${CMAKE_SOURCE_DIR}/src/c-ares-libs/c-ares
|
||||
COMMAND ${CMAKE_COMMAND} -E create_symlink ${c-ares_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/src/c-ares-libs/c-ares
|
||||
COMMENT "Creates a kperf symlink inside tangram source folder"
|
||||
)
|
||||
|
||||
add_custom_target(
|
||||
clean-c-ares
|
||||
COMMAND ${CMAKE_COMMAND} -E remove_directory ${CMAKE_SOURCE_DIR}/src/c-ares-libs
|
||||
COMMENT "Remove c-ares-libs folder"
|
||||
)
|
||||
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_SOURCE_DIR}/src/c-ares-libs)
|
||||
|
||||
@@ -1,15 +1,45 @@
|
||||
include(FetchContent)
|
||||
|
||||
if(NOT CURL_VERSION)
|
||||
set(CURL_VERSION "curl_8_6_0")
|
||||
if(NOT LIBCURL_VERSION)
|
||||
set(LIBCURL_VERSION "curl-8_8_0")
|
||||
endif()
|
||||
|
||||
set(FETCHCONTENT_QUIET FALSE)
|
||||
FetchContent_Declare(
|
||||
libcurl
|
||||
GIT_REPOSITORY https://github.com/curl/curl.git
|
||||
GIT_TAG ${CURL_VERSION}
|
||||
GIT_PROGRESS TRUE
|
||||
OVERRIDE_FIND_PACKAGE)
|
||||
find_package(CURL QUIET)
|
||||
if(CURL_FOUND)
|
||||
message(STATUS "cURL version ${CURL_VERSION_STRING} was found in your system.")
|
||||
else()
|
||||
message(STATUS "cURL was not found in your system. Fetching and configuring cURL version ${LIBCURL_VERSION}")
|
||||
|
||||
FetchContent_MakeAvailable(libcurl)
|
||||
set(FETCHCONTENT_QUIET TRUE)
|
||||
set(BUILD_MISC_DOCS OFF CACHE INTERNAL "")
|
||||
set(ENABLE_CURL_MANUAL OFF CACHE INTERNAL "")
|
||||
set(BUILD_TESTING OFF CACHE INTERNAL "")
|
||||
set(CURL_DISABLE_INSTALL ON CACHE INTERNAL "")
|
||||
set(BUILD_LIBCURL_DOCS OFF CACHE INTERNAL "")
|
||||
|
||||
set(BUILD_SHARED_LIBS ON CACHE INTERNAL "")
|
||||
set(BUILD_CURL_EXE OFF CACHE INTERNAL "")
|
||||
set(BUILD_STATIC_CURL OFF CACHE INTERNAL "")
|
||||
set(BUILD_STATIC_LIBS OFF CACHE INTERNAL "")
|
||||
|
||||
if(STATIC_CURL)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
|
||||
set(BUILD_STATIC_LIBS ON CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
if(BUILD_CURL_BIN)
|
||||
if(STATIC_CURL)
|
||||
set(BUILD_STATIC_CURL ON CACHE INTERNAL "")
|
||||
else()
|
||||
set(BUILD_CURL_EXE ON CACHE INTERNAL "")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(
|
||||
CURL
|
||||
GIT_REPOSITORY https://github.com/curl/curl.git
|
||||
GIT_TAG ${LIBCURL_VERSION}
|
||||
GIT_PROGRESS TRUE
|
||||
OVERRIDE_FIND_PACKAGE)
|
||||
FetchContent_MakeAvailable(CURL)
|
||||
endif()
|
||||
|
||||
@@ -4,12 +4,33 @@ if(NOT JSONC_VERSION)
|
||||
set(JSONC_VERSION "json-c-0.17-20230812")
|
||||
endif()
|
||||
|
||||
set(FETCHCONTENT_QUIET FALSE)
|
||||
FetchContent_Declare(
|
||||
jsonc
|
||||
GIT_REPOSITORY https://github.com/json-c/json-c.git
|
||||
GIT_TAG ${JSONC_VERSION}
|
||||
GIT_PROGRESS TRUE
|
||||
OVERRIDE_FIND_PACKAGE)
|
||||
find_package(json-c QUIET CONFIG)
|
||||
if(json-c_FOUND)
|
||||
message(STATUS "json-c version ${json-c_VERSION} was found in your system.")
|
||||
else()
|
||||
message(STATUS "json-c was not found in your system. Fetching and configuring json-c version ${JSONC_VERSION}")
|
||||
|
||||
FetchContent_MakeAvailable(jsonc)
|
||||
set(FETCHCONTENT_QUIET TRUE)
|
||||
|
||||
if(STATIC_JSONC)
|
||||
set(BUILD_SHARED_LIBS OFF CACHE INTERNAL "")
|
||||
set(BUILD_STATIC_LIBS ON CACHE INTERNAL "")
|
||||
else()
|
||||
set(BUILD_SHARED_LIBS ON CACHE INTERNAL "")
|
||||
set(BUILD_STATIC_LIBS OFF CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
# Hack to install JSON C headers where we want
|
||||
set(CMAKE_INSTALL_PREFIX ${FETCHCONTENT_BASE_DIR}/json-c-install/ CACHE INTERNAL "" FORCE)
|
||||
set(json-c_INSTALL_DIR ${CMAKE_INSTALL_PREFIX})
|
||||
|
||||
FetchContent_Declare(
|
||||
json-c GIT_REPOSITORY https://github.com/json-c/json-c.git GIT_TAG ${JSONC_VERSION} GIT_PROGRESS TRUE OVERRIDE_FIND_PACKAGE
|
||||
)
|
||||
FetchContent_MakeAvailable(json-c)
|
||||
add_custom_target(
|
||||
json-c-install DEPENDS json-c COMMAND ${CMAKE_COMMAND} --install ${json-c_BINARY_DIR} --prefix=${json-c_INSTALL_DIR}
|
||||
COMMENT "Installing json-c"
|
||||
)
|
||||
|
||||
endif()
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
include(ExternalProject)
|
||||
|
||||
set(OPENSSL_SOURCE_DIR ${CMAKE_CURRENT_BINARY_DIR}/openssl-src)
|
||||
set(OPENSSL_INSTALL_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set(OPENSSL_INCLUDE_DIR ${OPENSSL_SOURCE_DIR}/include)
|
||||
set(OPENSSL_LIBRARY_SUFFIX "so")
|
||||
|
||||
if(CMAKE_BUILD_TYPE STREQUAL "Debug" OR CMAKE_BUILD_TYPE STREQUAL "RelWithDebInfo")
|
||||
set(OPENSSL_CONFIGURE_COMMAND ${OPENSSL_SOURCE_DIR}/config -d)
|
||||
else()
|
||||
set(OPENSSL_CONFIGURE_COMMAND ${OPENSSL_SOURCE_DIR}/config)
|
||||
endif()
|
||||
|
||||
if(NOT OPENSSL_VERSION)
|
||||
set(OPENSSL_VERSION "OpenSSL_1_1_1w")
|
||||
endif()
|
||||
|
||||
ExternalProject_Add(
|
||||
OpenSSL
|
||||
SOURCE_DIR ${OPENSSL_SOURCE_DIR}
|
||||
GIT_REPOSITORY https://github.com/openssl/openssl.git
|
||||
GIT_TAG ${OPENSSL_VERSION}
|
||||
GIT_SHALLOW TRUE
|
||||
UPDATE_DISCONNECTED TRUE
|
||||
USES_TERMINAL_DOWNLOAD TRUE
|
||||
USES_TERMINAL_CONFIGURE TRUE
|
||||
USES_TERMINAL_BUILD TRUE
|
||||
BUILD_IN_SOURCE TRUE
|
||||
CONFIGURE_COMMAND ${OPENSSL_CONFIGURE_COMMAND} --prefix=${OPENSSL_INSTALL_DIR} --openssldir=${OPENSSL_INSTALL_DIR}
|
||||
BUILD_COMMAND make
|
||||
TEST_COMMAND ""
|
||||
INSTALL_COMMAND make install_sw
|
||||
INSTALL_DIR ${OPENSSL_SOURCE_DIR})
|
||||
|
||||
file(MAKE_DIRECTORY ${OPENSSL_INCLUDE_DIR})
|
||||
|
||||
add_library(OpenSSL::SSL STATIC IMPORTED GLOBAL)
|
||||
set_property(TARGET OpenSSL::SSL PROPERTY IMPORTED_LOCATION ${OPENSSL_INSTALL_DIR}/lib/libssl.${OPENSSL_LIBRARY_SUFFIX})
|
||||
set_property(TARGET OpenSSL::SSL PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIR})
|
||||
add_dependencies(OpenSSL::SSL OpenSSL)
|
||||
|
||||
add_library(OpenSSL::Crypto STATIC IMPORTED GLOBAL)
|
||||
set_property(TARGET OpenSSL::Crypto PROPERTY IMPORTED_LOCATION ${OPENSSL_INSTALL_DIR}/lib/libcrypto.${OPENSSL_LIBRARY_SUFFIX})
|
||||
|
||||
set_property(TARGET OpenSSL::Crypto PROPERTY INTERFACE_INCLUDE_DIRECTORIES ${OPENSSL_INCLUDE_DIR})
|
||||
add_dependencies(OpenSSL::Crypto OpenSSL)
|
||||
|
||||
set(ENV{OpenSSL_DIR} ${OPENSSL_INSTALL_DIR})
|
||||
set(ENV{OpenSSL_INCLUDE_DIR} ${OPENSSL_INCLUDE_DIR})
|
||||
set(ENV{OpenSSL_LIBRARIES}
|
||||
${OPENSSL_INSTALL_DIR}/lib/libssl.${OPENSSL_LIBRARY_SUFFIX};${OPENSSL_INSTALL_DIR}/lib/libcrypto.${OPENSSL_LIBRARY_SUFFIX})
|
||||
@@ -1,15 +0,0 @@
|
||||
include(FetchContent)
|
||||
|
||||
if(NOT PAHO_MQTT_C_VERSION)
|
||||
set(PAHO_MQTT_C_VERSION "v1.3.13")
|
||||
endif()
|
||||
|
||||
set(FETCHCONTENT_QUIET FALSE)
|
||||
FetchContent_Declare(
|
||||
paho_mqtt_c
|
||||
GIT_REPOSITORY https://github.com/eclipse/paho.mqtt.c.git
|
||||
GIT_TAG ${PAHO_MQTT_C_VERSION}
|
||||
GIT_PROGRESS TRUE
|
||||
OVERRIDE_FIND_PACKAGE)
|
||||
|
||||
FetchContent_MakeAvailable(paho_mqtt_c)
|
||||
34
cmake/FetchPahoMqttC.cmake
Normal file
34
cmake/FetchPahoMqttC.cmake
Normal file
@@ -0,0 +1,34 @@
|
||||
include(FetchContent)
|
||||
|
||||
if(NOT PAHO_MQTT_C_VERSION)
|
||||
set(PAHO_MQTT_C_VERSION "v1.3.13")
|
||||
endif()
|
||||
|
||||
find_package(eclipse-paho-mqtt-c QUIET)
|
||||
if(eclipse-paho-mqtt-c_FOUND)
|
||||
message(STATUS "Paho MQTT C version ${eclipse-paho-mqtt-c_VERSION} was found in your system.")
|
||||
else()
|
||||
message(
|
||||
STATUS
|
||||
"Paho MQTT C was not found in your system. Fetching and configuring eclipse-paho-mqtt-c version ${PAHO_MQTT_C_VERSION}"
|
||||
)
|
||||
|
||||
set(FETCHCONTENT_QUIET TRUE)
|
||||
set(PAHO_WITH_SSL TRUE CACHE INTERNAL "")
|
||||
set(PAHO_HIGH_PERFORMANCE TRUE CACHE INTERNAL "")
|
||||
set(PAHO_ENABLE_TESTING FALSE CACHE INTERNAL "")
|
||||
|
||||
if(STATIC_PAHO)
|
||||
set(PAHO_BUILD_SHARED FALSE CACHE INTERNAL "")
|
||||
set(PAHO_BUILD_STATIC TRUE CACHE INTERNAL "")
|
||||
else()
|
||||
set(PAHO_BUILD_SHARED TRUE CACHE INTERNAL "")
|
||||
set(PAHO_BUILD_STATIC FALSE CACHE INTERNAL "")
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(
|
||||
eclipse-paho-mqtt-c GIT_REPOSITORY https://github.com/eclipse/paho.mqtt.c.git GIT_TAG ${PAHO_MQTT_C_VERSION}
|
||||
GIT_PROGRESS TRUE OVERRIDE_FIND_PACKAGE
|
||||
)
|
||||
FetchContent_MakeAvailable(eclipse-paho-mqtt-c)
|
||||
endif()
|
||||
Reference in New Issue
Block a user