Skip to content

CMake option to disable tests compilation #25

Open
@01e9

Description

@01e9

First of all thank you for making this library installable. I use External_Project_Add() for all libraries, it compiles the library in an isolated environment and installs it in the specified directory (if you are interested in more details I can explain).

What I want is a way to disable tests when building the library.

Wrap this block in an if

# gtest
enable_testing()
add_subdirectory(googletest)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/googletest/googletest/include)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
# Tests
add_subdirectory(tests)
# Benchmark
add_subdirectory(benchmark)

like this

https://github.com/Microsoft/GSL/blob/5cbde3008aa43a9c5f6c219ee15b8388336d4433/CMakeLists.txt#L71-L75

then I will be able to control that block with -DENABLE_TESTS=ON/OFF

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions