build: refine cmake for testbed

This commit is contained in:
skypjack
2025-04-11 18:27:25 +02:00
parent 55fb754614
commit c66f116449
2 changed files with 10 additions and 9 deletions

View File

@@ -313,29 +313,27 @@ endif()
# Tests and testbed
option(ENTT_BUILD_TESTBED "Enable building testbed." OFF)
option(ENTT_BUILD_TESTING "Enable building tests." OFF)
option(ENTT_BUILD_TESTBED "Enable building testbed." OFF)
if(ENTT_BUILD_TESTBED OR ENTT_BUILD_TESTING)
if(ENTT_BUILD_TESTING OR ENTT_BUILD_TESTBED)
set(ENTT_ID_TYPE std::uint32_t CACHE STRING "Type of identifiers to use for tests and testbed")
set(ENTT_CXX_STD cxx_std_17 CACHE STRING "C++ standard revision to use for tests and testbed")
# Testbed goes first because otherwise SDL gets confused with EnTT tests
if(ENTT_BUILD_TESTBED)
add_subdirectory(testbed)
endif()
# Tests and tesetbed do not work together because SDL gets confused with EnTT tests
if(ENTT_BUILD_TESTING)
option(ENTT_FIND_GTEST_PACKAGE "Enable finding gtest package." OFF)
option(ENTT_BUILD_BENCHMARK "Build benchmark." OFF)
option(ENTT_BUILD_EXAMPLE "Build examples." OFF)
option(ENTT_BUILD_LIB "Build lib tests." OFF)
option(ENTT_BUILD_SNAPSHOT "Build snapshot test with Cereal." OFF)
include(CTest)
enable_testing()
add_subdirectory(test)
elseif(ENTT_BUILD_TESTBED)
add_subdirectory(testbed)
endif()
endif()

View File

@@ -11,6 +11,9 @@ FetchContent_Declare(
GIT_SHALLOW 1
)
option(SDL_STATIC "Enable SDL static library" ON)
option(SDL_SHARED "Disable SDL shared library" OFF)
FetchContent_MakeAvailable(SDL3)
# Fetch ImGui