Skip to content

Commit

Permalink
cmake: Conditionally build the unit tests.
Browse files Browse the repository at this point in the history
This allows to skip building the unit tests and avoids the dependency
on gtest when doing so.
  • Loading branch information
orbea committed Dec 8, 2018
1 parent f510f6e commit 1327772
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ option(ENABLE_HEADLESS "Enables running Dolphin as a headless variant" OFF)
option(ENABLE_ALSA "Enables ALSA sound backend" ON)
option(ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON)
option(ENABLE_LLVM "Enables LLVM support, for disassembly" ON)
option(ENABLE_TESTS "Enables building the unit tests" ON)
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence, show the current game on Discord" ON)

# Maintainers: if you consider blanket disabling this for your users, please
Expand Down Expand Up @@ -720,8 +721,12 @@ include_directories("${PROJECT_BINARY_DIR}/Source/Core")
########################################
# Unit testing.
#
message(STATUS "Using static gtest from Externals")
add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL)
if(ENABLE_TESTS)
message(STATUS "Using static gtest from Externals")
add_subdirectory(Externals/gtest EXCLUDE_FROM_ALL)
else()
message(STATUS "Unit tests are disabled")
endif()

########################################
# Process Dolphin source now that all setup is complete
Expand Down
5 changes: 4 additions & 1 deletion Source/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ add_subdirectory(Core)
if (ANDROID)
add_subdirectory(Android/jni)
endif()
add_subdirectory(UnitTests)

if (ENABLE_TESTS)
add_subdirectory(UnitTests)
endif()

if (DSPTOOL)
add_subdirectory(DSPTool)
Expand Down

0 comments on commit 1327772

Please sign in to comment.