diff --git a/CMakeLists.txt b/CMakeLists.txt index be0fa47..b2d4992 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,9 +9,13 @@ if(TARGET evmc) return() endif() -option(EVMC_TESTING "Build EVMC tests and test tools" OFF) -option(EVMC_EXAMPLES "Build EVMC examples" ${EVMC_TESTING}) -option(HUNTER_ENABLED "Enable Hunter package manager support" "${EVMC_TESTING}") +option(EVMC_TESTING "Build EVMC examples, tests and test tools (i.e. everything)" OFF) +option(EVMC_TEST_TOOLS "Build EVMC test tools" ${EVMC_TESTING}) +if(EVMC_TESTING OR EVMC_TEST_TOOLS) + set(hunter_and_examples_required TRUE) +endif() +option(EVMC_EXAMPLES "Build EVMC examples" ${hunter_and_examples_required}) +option(HUNTER_ENABLED "Enable Hunter package manager support" ${hunter_and_examples_required}) include(cmake/cable/bootstrap.cmake) include(CableBuildType) @@ -20,7 +24,7 @@ include(CableToolchains) include(CMakePackageConfigHelpers) include(GNUInstallDirs) -if(EVMC_TESTING) +if(HUNTER_ENABLED) set(HUNTER_CONFIGURATION_TYPES Release CACHE STRING "Build type of Hunter packages") include(HunterGate) include(HunterConfig) @@ -49,10 +53,13 @@ add_subdirectory(lib) if(EVMC_TESTING) enable_testing() +endif() + +if(EVMC_TESTING OR EVMC_TEST_TOOLS) add_subdirectory(test) endif() -if(EVMC_EXAMPLES OR EVMC_TESTING) +if(EVMC_TESTING OR EVMC_EXAMPLES) add_subdirectory(examples) endif() diff --git a/appveyor.yml b/appveyor.yml index 8ecc172..c94014e 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -24,7 +24,7 @@ before_build: if ($env:GENERATOR) { if (!(test-path build)) { mkdir build } cd build - cmake -Wno-dev -G "$env:GENERATOR" .. -DBUILD_SHARED_LIBS=ON -DEVMC_EXAMPLES=ON -DEVMC_TESTING=ON -DCMAKE_INSTALL_PREFIX=C:\install + cmake -Wno-dev -G "$env:GENERATOR" .. -DBUILD_SHARED_LIBS=ON -DEVMC_TESTING=ON -DCMAKE_INSTALL_PREFIX=C:\install } build_script: diff --git a/circle.yml b/circle.yml index d47ebbc..e3f66b0 100644 --- a/circle.yml +++ b/circle.yml @@ -35,7 +35,7 @@ jobs: - run: name: "Configure" working_directory: ~/build - command: cmake ../project -DCMAKE_INSTALL_PREFIX=~/install -DBUILD_SHARED_LIBS=ON -DEVMC_EXAMPLES=ON -DEVMC_TESTING=ON $CMAKE_OPTIONS + command: cmake ../project -DCMAKE_INSTALL_PREFIX=~/install -DBUILD_SHARED_LIBS=ON -DEVMC_TESTING=ON $CMAKE_OPTIONS - run: name: "Build" command: cmake --build ~/build diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 9d162db..08d3fd4 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,6 +1,6 @@ # EVMC: Ethereum Client-VM Connector API. # Copyright 2019 The EVMC Authors. -# Licensed under the Apache License, Version 2.0. See the LICENSE file. +# Licensed under the Apache License, Version 2.0. hunter_add_package(GTest) find_package(GTest CONFIG REQUIRED) @@ -11,6 +11,9 @@ if(NOT CMAKE_CXX_STANDARD) set(CMAKE_C_EXTENSIONS OFF) endif() -add_subdirectory(integration) -add_subdirectory(unittests) +if(EVMC_TESTING) + add_subdirectory(integration) + add_subdirectory(unittests) +endif() + add_subdirectory(vmtester)