Skip to content

Commit

Permalink
Only build tests and documentation when building as a top-level project
Browse files Browse the repository at this point in the history
  • Loading branch information
madmann91 committed Apr 9, 2024
1 parent b5f61c8 commit 03c5988
Showing 1 changed file with 14 additions and 8 deletions.
22 changes: 14 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
cmake_minimum_required(VERSION 3.16)
cmake_minimum_required(VERSION 3.21)
project(overture VERSION 0.0.1)

option(TEST_DISABLE_FORK "Disable fork() in the testing framework." OFF)
option(ENABLE_COVERAGE "Enable code coverage build type and target." OFF)
option(ENABLE_DOXYGEN "Enable code documentation target via Doxygen." ON)

if (PROJECT_IS_TOP_LEVEL)
option(ENABLE_COVERAGE "Enable code coverage build type and target." OFF)
option(ENABLE_DOXYGEN "Enable code documentation target via Doxygen." ON)

include(cmake/Coverage.cmake)
include(cmake/Doxygen.cmake)
endif()

add_compile_options(
$<$<C_COMPILER_ID:GNU,Clang>:-Wall>
$<$<C_COMPILER_ID:GNU,Clang>:-Wextra>
$<$<C_COMPILER_ID:GNU,Clang>:-pedantic>)

include(cmake/Coverage.cmake)
include(cmake/Doxygen.cmake)
install(
FILES
cmake/Coverage.cmake
Expand All @@ -26,7 +30,9 @@ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE ON)

add_subdirectory(src)

include(CTest)
if (BUILD_TESTING)
add_subdirectory(test)
if (PROJECT_IS_TOP_LEVEL)
include(CTest)
if (BUILD_TESTING)
add_subdirectory(test)
endif()
endif()

0 comments on commit 03c5988

Please sign in to comment.