Skip to content

Commit

Permalink
Add BUILD_TESTS option
Browse files Browse the repository at this point in the history
  • Loading branch information
benvenutti committed Aug 19, 2024
1 parent ae2840c commit 88ae8ca
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
25 changes: 17 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,23 @@ project(
LANGUAGES CXX
)

option(BUILD_TESTS "Build tests" ON)

# 3rd party dependencies:

find_package(Qt6 6.5 COMPONENTS Widgets REQUIRED)

include(FetchContent)
if(BUILD_TESTS)
include(FetchContent)

FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.1
)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.0.1
)

FetchContent_MakeAvailable(Catch2)
FetchContent_MakeAvailable(Catch2)
endif()

# build settings:

Expand All @@ -31,6 +35,12 @@ set(CXX_STANDARD_REQUIRED ON)
set(CXX_EXTENSIONS OFF)
set(CMAKE_CXX_FLAGS_RELEASE -O3)

# testing:

if(BUILD_TESTS)
enable_testing()
endif()

# compiler's warning messages:

if(MSVC)
Expand All @@ -49,6 +59,5 @@ endif()

# subdirectories:

enable_testing()
add_subdirectory(model)
add_subdirectory(app-qtwidget)
4 changes: 3 additions & 1 deletion model/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,6 @@ target_include_directories(

# tests:

add_subdirectory(tests)
if(BUILD_TESTS)
add_subdirectory(tests)
endif()

0 comments on commit 88ae8ca

Please sign in to comment.