Merge pull request #235 from Lgt2x/cmake-options

CMake: expose BUILD_TESTNG option, rename LOGGER to ENABLE_LOGGER
This commit is contained in:
Azamat H. Hackimov 2024-05-01 02:02:02 +03:00 committed by GitHub
commit ae03b6fd02
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 7 additions and 6 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)
@ -25,9 +26,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()
@ -136,7 +137,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]
```