CMake: expose BUILD_TESTNG option, rename LOGGER to ENABLE_LOGGER

This commit is contained in:
Louis Gombert 2024-04-29 21:52:42 +02:00
parent 3bdbdc196f
commit 0b41a1b963
2 changed files with 8 additions and 7 deletions

View File

@ -11,7 +11,8 @@ project(Descent3
)
option(FORCE_COLORED_OUTPUT "Always produce ANSI-colored compiler warnings/errors (GCC/Clang only; esp. useful with ninja)." OFF)
option(LOGGER "Enable logging to the terminal" OFF)
option(ENABLE_LOGGER "Enable logging to the terminal" OFF)
option(BUILD_TESTING "Enable testing. Requires GTest." OFF)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
@ -23,9 +24,9 @@ if(FORCE_COLORED_OUTPUT)
set(CMAKE_COLOR_DIAGNOSTICS ON)
else()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options (-fdiagnostics-color=always)
add_compile_options(-fdiagnostics-color=always)
elseif(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options (-fcolor-diagnostics)
add_compile_options(-fcolor-diagnostics)
endif()
endif()
endif()
@ -134,7 +135,7 @@ add_compile_definitions($<$<CONFIG:Debug>:_DEBUG>)
find_package(ZLIB REQUIRED)
if(LOGGER)
if(ENABLE_LOGGER)
message("Enabling Logging")
add_compile_definitions(LOGGER)
endif()

View File

@ -37,14 +37,14 @@ setx PATH=%VCPKG_ROOT%;%PATH%
Build Descent 3:
```sh
cmake --preset win -D LOGGER=[ON|OFF]
cmake --preset win -D ENABLE_LOGGER=[ON|OFF]
cmake --build --preset win --config [Debug|Release]
```
#### Building - MacOS
```sh
brew bundle install
cmake --preset mac -D LOGGER=[ON|OFF]
cmake --preset mac -D ENABLE_LOGGER=[ON|OFF]
cmake --build --preset mac --config [Debug|Release]
```
@ -53,7 +53,7 @@ cmake --build --preset mac --config [Debug|Release]
sudo dpkg --add-architecture i386
sudo apt update
sudo apt install -y --no-install-recommends ninja-build cmake g++ libsdl1.2-dev libsdl-image1.2-dev libncurses-dev libxext6:i386 zlib1g-dev
cmake --preset linux -D LOGGER=[ON|OFF]
cmake --preset linux -D ENABLE_LOGGER=[ON|OFF]
cmake --build --preset linux --config [Debug|Release]
```