rvthtool/cmake/options.cmake
David Korth 27ba56c693 [cmake] Backport more changes from rom-properties.
Changes include:
- Add RelWithDebugInfo flags.
- Add NixOS handling.
- Add ENABLE_WERROR.
- Add more warning flags.
- Add "-fprofile-update=atomic" for code coverage.
- Fix DT_RELR.
- Enable C++ assertions for libstdc++ and libc++.
2025-05-21 18:14:39 -04:00

55 lines
1.8 KiB
CMake

# Build options.
OPTION(ENABLE_WERROR "Treat all compile warnings as errors. (Enable for development!)" OFF)
# Enable UDEV on Linux
IF(UNIX AND NOT APPLE)
OPTION(ENABLE_UDEV "Enable UDEV for the 'query' command." ON)
ELSE()
SET(ENABLE_UDEV OFF CACHE INTERNAL "Enable UDEV for the 'query' command." FORCE)
ENDIF()
# Enable D-Bus for DockManager / Unity API
IF(UNIX AND NOT APPLE)
OPTION(ENABLE_DBUS "Enable D-Bus support for DockManager / Unity API." 1)
ELSE(UNIX AND NOT APPLE)
SET(ENABLE_DBUS 0)
ENDIF(UNIX AND NOT APPLE)
# Link-time optimization
# FIXME: Not working in clang builds and Ubuntu's gcc...
IF(MSVC)
SET(LTO_DEFAULT ON)
ELSE()
SET(LTO_DEFAULT OFF)
ENDIF()
OPTION(ENABLE_LTO "Enable link-time optimization in release builds." ${LTO_DEFAULT})
# Split debug information into a separate file
# FIXME: macOS `strip` shows an error:
# error: symbols referenced by indirect symbol table entries that can't be stripped in: [library]
IF(APPLE)
OPTION(SPLIT_DEBUG "Split debug information into a separate file." OFF)
ELSE(APPLE)
OPTION(SPLIT_DEBUG "Split debug information into a separate file." ON)
ENDIF(APPLE)
# Install the split debug file
OPTION(INSTALL_DEBUG "Install the split debug files." ON)
IF(INSTALL_DEBUG AND NOT SPLIT_DEBUG)
# Cannot install debug files if we're not splitting them.
SET(INSTALL_DEBUG OFF CACHE INTERNAL "Install the split debug files." FORCE)
ENDIF(INSTALL_DEBUG AND NOT SPLIT_DEBUG)
# Qt version
SET(QT_VERSION 5 CACHE STRING "Qt version to use. (default is 5)")
SET_PROPERTY(CACHE QT_VERSION PROPERTY STRINGS 5 6)
# Translations
OPTION(ENABLE_NLS "Enable NLS using Qt's built-in localization system." ON)
# Special handling for NixOS
IF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
OPTION(ENABLE_NIXOS "Enable special handling for NixOS builds." OFF)
ENDIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")