cmake_minimum_required(VERSION 3.15) project(mesytec-mnode LANGUAGES C CXX) set(MESYTEC_MNODE_MAIN_PROJECT OFF) if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR) set(MESYTEC_MNODE_MAIN_PROJECT ON) endif() list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) set(CMAKE_EXPORT_COMPILE_COMMANDS ON) ## Create binaries in the root of the build directory set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) set(CMAKE_VERBOSE_MAKEFILE ON CACHE BOOL "ON") set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) option(MNODE_BUILD_TESTS "Build mnode test binaries" ${MESYTEC_MNODE_MAIN_PROJECT}) if (MNODE_BUILD_TESTS) find_package(GTest CONFIG QUIET) if (NOT GTest_FOUND) include(FetchContent) FetchContent_Declare(googletest URL https://github.com/google/googletest/archive/refs/tags/v1.15.2.zip) # For Windows: Prevent overriding the parent project's compiler/linker settings set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) FetchContent_MakeAvailable(googletest) endif() message("-- mnode: Building tests") include(CTest) enable_testing() endif() include(FetchContent) FetchContent_Declare(pybind11 GIT_REPOSITORY https://github.com/pybind/pybind11 GIT_TAG v2.13.6) FetchContent_GetProperties(pybind11) if(NOT pybind11_POPULATED) FetchContent_Populate(pybind11) add_subdirectory(${pybind11_SOURCE_DIR} ${pybind11_BINARY_DIR}) endif() include(CMakeRC) cmrc_add_resource_library(mnode-resources ALIAS mnode::resources NAMESPACE mnode::resources data/vme_base_configs.json data/vme_module_data_sources.json ) add_subdirectory(external) add_subdirectory(proto) add_subdirectory(src)