diff options
| author | Garrett D'Amore <garrett@damore.org> | 2020-11-16 20:44:29 -0800 |
|---|---|---|
| committer | Garrett D'Amore <garrett@damore.org> | 2020-11-18 21:05:16 -0800 |
| commit | b826bfc171d90f8bde7bd672c0ac14201b8b2742 (patch) | |
| tree | 5c416487f24104e6305a797af31c5e8b1aab99d1 /CMakeLists.txt | |
| parent | cda4885676f009e2e7f2ad5e6c52743efc8b8924 (diff) | |
| download | nng-b826bfc171d90f8bde7bd672c0ac14201b8b2742.tar.gz nng-b826bfc171d90f8bde7bd672c0ac14201b8b2742.tar.bz2 nng-b826bfc171d90f8bde7bd672c0ac14201b8b2742.zip | |
Work for test refactoring.
There are a few major areas in this change.
* CMake options are now located in a common cmake/NNGOptions.cmake
file. This should make it easier for folks to figure out what
the options are, and how they are used.
* Tests are now scoped with their directory name, which should
avoid possible name collisions with test names.
* A number of tests have been either moved or incorporated into
the newer testutil/acutest framework. We are moving away from
my old c-convey framework to something easier to debug.
* We use CMake directories a bit more extensively leading to a much
cleaner CMake structure. It's not complete, but a big step in the
right direction, and a preview of future work.
* Tests are now run with verbose flags, so we get more test results
in the CI/CD logs.
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 47 |
1 files changed, 9 insertions, 38 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e55470b4..bd13b7eb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,12 +29,12 @@ cmake_minimum_required(VERSION 3.13) project(nng C) include(CheckCCompilerFlag) -include(CMakeDependentOption) include(GNUInstallDirs) set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake) include(NNGHelpers) +include(NNGOptions) set(CMAKE_C_STANDARD 99) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) @@ -66,22 +66,9 @@ message(STATUS "Configuring for NNG version ${NNG_ABI_VERSION}") # User-defined options. -option(BUILD_SHARED_LIBS "Build shared library" ${BUILD_SHARED_LIBS}) - -if (CMAKE_CROSSCOMPILING) - set(NNG_NATIVE_BUILD OFF) -else () - set(NNG_NATIVE_BUILD ON) -endif () - -# We only build command line tools and tests if we are not in a -# cross-compile situation. Cross-compiling users who still want to -# build these must enable them explicitly. Some of these switches -# must be enabled rather early as we use their values later. -option(NNG_TESTS "Build and run tests." ${NNG_NATIVE_BUILD}) -option(NNG_TOOLS "Build extra tools." ${NNG_NATIVE_BUILD}) -option(NNG_ENABLE_NNGCAT "Enable building nngcat utility." ${NNG_TOOLS}) -option(NNG_ENABLE_COVERAGE "Enable coverage reporting." OFF) +# This prefix is appended to by subdirectories, so that each test +# gets named based on where it is in the tree. +set(NNG_TEST_PREFIX nng) # Enable access to private APIs for our own use. add_definitions(-DNNG_PRIVATE) @@ -108,16 +95,6 @@ target_compile_definitions(nng_testing PUBLIC NNG_STATIC_LIB NNG_TEST_LIB NNG_PR add_library(nng_private INTERFACE) target_compile_definitions(nng_private INTERFACE NNG_PRIVATE) -# Eliding deprecated functionality can be used to build a slimmed down -# version of the library, or alternatively to test for application -# preparedness for expected feature removals (in the next major release.) -# Applications can also set the NNG_ELIDE_DEPRECATED preprocessor symbol -# before including <nng/nng.h> -- this will prevent declarations from -# being exposed to applications, but it will not affect their ABI -# availability for existing compiled applications. -# Note: Currently this breaks the test suite, so we only do it -# for the public library. -option(NNG_ELIDE_DEPRECATED "Elide deprecated functionality." OFF) if (NNG_ELIDE_DEPRECATED) target_compile_definitions(nng, NNG_ELIDE_DEPRECATED) endif() @@ -137,11 +114,7 @@ if (NOT WIN32) mark_as_advanced(NNG_SETSTACKSIZE) endif () -option(NNG_ENABLE_STATS "Enable statistics" ON) -if (NNG_ENABLE_STATS) - add_definitions(-DNNG_ENABLE_STATS) -endif () -mark_as_advanced(NNG_ENABLE_STATS) +nng_defines_if(NNG_ENABLE_STATS NNG_ENABLE_STATS) if (NNG_RESOLV_CONCURRENCY) add_definitions(-DNNG_RESOLV_CONCURRENCY=${NNG_RESOLV_CONCURRENCY}) @@ -269,6 +242,10 @@ else () set(NNG_PLATFORM_POSIX ON) endif () +if (NNG_ENABLE_TLS) + add_definitions(-DNNG_SUPP_TLS) +endif () + if (NNG_TESTS) enable_testing() set(all_tests, "") @@ -287,12 +264,6 @@ if (NNG_ENABLE_NNGCAT) add_subdirectory(tools/nngcat) endif () -option(NNG_ENABLE_TLS "Enable TLS protocol" OFF) -if (NNG_ENABLE_TLS) - add_definitions(-DNNG_SUPP_TLS) - set(NNG_SUPP_TLS ON) -endif () - add_subdirectory(docs/man) set(CPACK_PACKAGE_NAME ${PROJECT_NAME}) |
