|
| 1 | +# CMakeList.txt : CMake project for OpenDAQHistorianFB, include source and define |
| 2 | +# project specific logic here. |
| 3 | +# |
| 4 | +set(CMAKE_POLICY_VERSION_MINIMUM 3.5) |
| 5 | +cmake_minimum_required(VERSION 3.25) |
| 6 | + |
| 7 | +set(REPO_NAME mqtt_module) |
| 8 | +set(REPO_OPTION_PREFIX MQTT_MODULE) |
| 9 | + |
| 10 | +project (${REPO_NAME} CXX) |
| 11 | + |
| 12 | +# Enable Hot Reload for MSVC compilers if supported. |
| 13 | +if (POLICY CMP0141) |
| 14 | + cmake_policy(SET CMP0141 NEW) |
| 15 | + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<IF:$<AND:$<C_COMPILER_ID:MSVC>,$<CXX_COMPILER_ID:MSVC>>,$<$<CONFIG:Debug,RelWithDebInfo>:EditAndContinue>,$<$<CONFIG:Debug,RelWithDebInfo>:ProgramDatabase>>") |
| 16 | +endif() |
| 17 | + |
| 18 | +if (POLICY CMP0135) |
| 19 | + cmake_policy(SET CMP0135 NEW) |
| 20 | +endif() |
| 21 | + |
| 22 | +if (POLICY CMP0077) |
| 23 | + cmake_policy(SET CMP0077 NEW) |
| 24 | +endif() |
| 25 | + |
| 26 | + |
| 27 | +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) |
| 28 | +list(APPEND CMAKE_MESSAGE_CONTEXT ${REPO_NAME}) |
| 29 | +set(CMAKE_MESSAGE_CONTEXT_SHOW ON CACHE BOOL "Show CMake message context") |
| 30 | + |
| 31 | +list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake") |
| 32 | + |
| 33 | +option(OPENDAQ_DEVICE_EXAMPLE_ENABLE_EXAMPLE_APPS "Enable building example applications" OFF) |
| 34 | + |
| 35 | +include(CommonUtils) |
| 36 | +setup_repo(${REPO_OPTION_PREFIX}) |
| 37 | + |
| 38 | +if(OPENDAQ_DEVICE_EXAMPLE_ENABLE_EXAMPLE_APPS) |
| 39 | + set(DAQMODULES_REF_DEVICE_MODULE ON CACHE BOOL "" FORCE) |
| 40 | +endif() |
| 41 | + |
| 42 | + |
| 43 | +find_package(OpenSSL REQUIRED) |
| 44 | +if (OPENSSL_FOUND) |
| 45 | + message(STATUS "Found OpenSSL ${OPENSSL_VERSION}") |
| 46 | +else() |
| 47 | + message(STATUS "OpenSSL Not Found") |
| 48 | +endif() |
| 49 | + |
| 50 | +add_subdirectory(external) |
| 51 | +add_subdirectory(mqtt_streaming_protocol) |
| 52 | +add_subdirectory(mqtt_streaming_server_module) |
| 53 | + |
| 54 | +if(OPENDAQ_DEVICE_EXAMPLE_ENABLE_EXAMPLE_APPS) |
| 55 | + message(STATUS "Example applications have been enabled") |
| 56 | + add_subdirectory(examples) |
| 57 | +endif() |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +# Set CPack variables |
| 62 | +set(CPACK_COMPONENTS_ALL RUNTIME) |
| 63 | +set(CPACK_PROJECT_NAME ${PROJECT_NAME}) |
| 64 | +set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) |
| 65 | +set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) |
| 66 | +set(CPACK_OUTPUT_FILE_PREFIX "${CMAKE_BINARY_DIR}/package") |
| 67 | + |
| 68 | +# Set the CPack generator based on the platform |
| 69 | +if (WIN32) |
| 70 | + set(CPACK_GENERATOR "ZIP") |
| 71 | +elseif (UNIX AND NOT APPLE) |
| 72 | + cmake_host_system_information(RESULT DISTRO_ID QUERY DISTRIB_ID) |
| 73 | + cmake_host_system_information(RESULT DISTRO_VERSION_ID QUERY DISTRIB_VERSION_ID) |
| 74 | + set(CPACK_SYSTEM_NAME "${DISTRO_ID}${DISTRO_VERSION_ID}") |
| 75 | + set(CPACK_GENERATOR "TGZ") |
| 76 | +endif() |
| 77 | + |
| 78 | +# Include CPack for packaging |
| 79 | +include(CPack) |
0 commit comments