From 53ea40e431cff0915e103576a9ea43ab036f1ccf Mon Sep 17 00:00:00 2001 From: Dirk Vanden Boer Date: Tue, 3 Oct 2023 14:06:22 +0200 Subject: [PATCH] Call enable_testing if needed --- .github/workflows/vcpkg-build.yml | 2 +- CMakeLists.txt | 60 ++++++++++++++++--------------- 2 files changed, 33 insertions(+), 29 deletions(-) diff --git a/.github/workflows/vcpkg-build.yml b/.github/workflows/vcpkg-build.yml index ae97caa4..2112e8a6 100644 --- a/.github/workflows/vcpkg-build.yml +++ b/.github/workflows/vcpkg-build.yml @@ -28,7 +28,7 @@ jobs: run: sudo apt-get install nasm openssl ninja-build autoconf-archive - name: Install osx dependencies if: ${{ matrix.cfg.os == 'macos-latest' }} - run: brew install nasm ninja automake autoconf libtool autoconf-archive + run: brew install nasm ninja automake autoconf autoconf-archive - name: Cache vcpkg binary id: cache-vcpkg-bin uses: actions/cache@v3 diff --git a/CMakeLists.txt b/CMakeLists.txt index 373de15e..120d4adb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,6 +3,32 @@ include(CMakePackageConfigHelpers) include(CheckIncludeFileCXX) include(CheckCXXSourceCompiles) +option(INFRA_LOGGING "Enable logging functionality" OFF) +option(INFRA_GDAL "Enable gdal wrapper for reading gis data" OFF) +cmake_dependent_option(INFRA_EMBED_GDAL_DATA "Embed the required gdal data files in the binary" OFF "INFRA_GDAL" OFF) +option(INFRA_LICENSE_MANAGER "Enable the license management functionality" OFF) +option(INFRA_XML "Enable xml config reader" OFF) +option(INFRA_TBB "Enable the tbb functionality" OFF) +option(INFRA_NUMERIC "Enable the numeric utility classes" OFF) +option(INFRA_CHARSET "Enable the character set utility classes" OFF) +option(INFRA_PROCESS "Enable the process utility classes" OFF) +option(INFRA_DATABASE "Build the database utility classes" OFF) +option(INFRA_DATABASE_SQLITE "Build the database sqlite utility classes" OFF) +option(INFRA_DATABASE_POSTGRES "Build the database postgresql utility classes" OFF) +option(INFRA_HASHING "Build with hashing support" OFF) +option(INFRA_COMPRESSION "Build with compression support" OFF) +option(INFRA_COMPRESSION_ZSTD "Enable zstd compression support" OFF) +option(INFRA_ENABLE_TESTS "Build the unit tests" OFF) +option(INFRA_ENABLE_TEST_UTILS "Build the unit test utilities" ${INFRA_ENABLE_TESTS}) +option(INFRA_ENABLE_BENCHMARKS "Build the micro benchmarks" OFF) +option(INFRA_ENABLE_DOCUMENTATION "Build the documentation" OFF) +option(INFRA_CLI_PROGRESS "Build the cli progress utility classes" OFF) +option(INFRA_UI_COMPONENTS "Enable the generic qt ui components" OFF) +option(INFRA_INSTALL_DEVELOPMENT_FILES "Install the infra development files (headers/libs)" ${INFRA_IS_TOPLEVEL}) +cmake_dependent_option(INFRA_UI_COMPONENTS_XLSX_EXPORT "Enable exporing qt item models to excel" OFF "INFRA_UI_COMPONENTS" OFF) +cmake_dependent_option(INFRA_UI_COMPONENTS_QML "Qml ui components" OFF "INFRA_UI_COMPONENTS;INFRA_GDAL" OFF) +cmake_dependent_option(INFRA_UI_COMPONENTS_LOCATION "Location related qt ui components" OFF "INFRA_UI_COMPONENTS;INFRA_GDAL;INFRA_UI_COMPONENTS_QML" OFF) + string(COMPARE EQUAL "${CMAKE_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}" INFRA_IS_TOPLEVEL) if(INFRA_IS_TOPLEVEL) @@ -12,6 +38,10 @@ if(INFRA_IS_TOPLEVEL) set(CMAKE_CXX_STANDARD 17) endif() + if(INFRA_ENABLE_TESTS) + enable_testing() + endif() + set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_EXPORT_COMPILE_COMMANDS 1) @@ -21,8 +51,8 @@ if(INFRA_IS_TOPLEVEL) ) include(GNUInstallDirs) - set (LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}) - set (EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) + set(LIBRARY_OUTPUT_PATH ${CMAKE_BINARY_DIR}) + set(EXECUTABLE_OUTPUT_PATH ${CMAKE_BINARY_DIR}) message(STATUS "Toplevel infra build C++${CMAKE_CXX_STANDARD}") set(CMAKE_REQUIRED_FLAGS ${CMAKE_CXX17_STANDARD_COMPILE_OPTION}) @@ -40,32 +70,6 @@ if(INFRA_IS_TOPLEVEL) endif() endif() -option(INFRA_LOGGING "Enable logging functionality" OFF) -option(INFRA_GDAL "Enable gdal wrapper for reading gis data" OFF) -cmake_dependent_option(INFRA_EMBED_GDAL_DATA "Embed the required gdal data files in the binary" OFF "INFRA_GDAL" OFF) -option(INFRA_LICENSE_MANAGER "Enable the license management functionality" OFF) -option(INFRA_XML "Enable xml config reader" OFF) -option(INFRA_TBB "Enable the tbb functionality" OFF) -option(INFRA_NUMERIC "Enable the numeric utility classes" OFF) -option(INFRA_CHARSET "Enable the character set utility classes" OFF) -option(INFRA_PROCESS "Enable the process utility classes" OFF) -option(INFRA_DATABASE "Build the database utility classes" OFF) -option(INFRA_DATABASE_SQLITE "Build the database sqlite utility classes" OFF) -option(INFRA_DATABASE_POSTGRES "Build the database postgresql utility classes" OFF) -option(INFRA_HASHING "Build with hashing support" OFF) -option(INFRA_COMPRESSION "Build with compression support" OFF) -option(INFRA_COMPRESSION_ZSTD "Enable zstd compression support" OFF) -option(INFRA_ENABLE_TESTS "Build the unit tests" OFF) -option(INFRA_ENABLE_TEST_UTILS "Build the unit test utilities" ${INFRA_ENABLE_TESTS}) -option(INFRA_ENABLE_BENCHMARKS "Build the micro benchmarks" OFF) -option(INFRA_ENABLE_DOCUMENTATION "Build the documentation" OFF) -option(INFRA_CLI_PROGRESS "Build the cli progress utility classes" OFF) -option(INFRA_UI_COMPONENTS "Enable the generic qt ui components" OFF) -option(INFRA_INSTALL_DEVELOPMENT_FILES "Install the infra development files (headers/libs)" ${INFRA_IS_TOPLEVEL}) -cmake_dependent_option(INFRA_UI_COMPONENTS_XLSX_EXPORT "Enable exporing qt item models to excel" OFF "INFRA_UI_COMPONENTS" OFF) -cmake_dependent_option(INFRA_UI_COMPONENTS_QML "Qml ui components" OFF "INFRA_UI_COMPONENTS;INFRA_GDAL" OFF) -cmake_dependent_option(INFRA_UI_COMPONENTS_LOCATION "Location related qt ui components" OFF "INFRA_UI_COMPONENTS;INFRA_GDAL;INFRA_UI_COMPONENTS_QML" OFF) - check_include_file_cxx(charconv HAVE_CHARCONV_HEADER) check_cxx_source_compiles("