34 lines
1.2 KiB
CMake
34 lines
1.2 KiB
CMake
# Shared build options and warning policy for the plot project.
|
|
#
|
|
# Included by the top-level CMakeLists.txt; every subdirectory target is
|
|
# expected to run plot_apply_warnings(<target>) so the core stays warning-clean
|
|
# under -Wall -Wextra -Wpedantic -Wconversion -Wshadow.
|
|
|
|
if(CMAKE_VERSION VERSION_LESS 3.24)
|
|
message(FATAL_ERROR "plot requires CMake 3.24 or newer (found ${CMAKE_VERSION})")
|
|
endif()
|
|
|
|
# Adapters and examples pull in third-party SDKs, so they default to OFF; the
|
|
# core library and its tests build on a bare toolchain.
|
|
option(PLOT_BUILD_TESTS "Build the plot test suite" ON)
|
|
option(PLOT_BUILD_EXAMPLES "Build the example programs" OFF)
|
|
option(PLOT_BUILD_GLFW "Build the GLFW adapter and demo" OFF)
|
|
option(PLOT_BUILD_IMGUI "Build the Dear ImGui adapter and demo" OFF)
|
|
option(PLOT_BUILD_QT6 "Build the Qt6 adapter and demo" OFF)
|
|
option(PLOT_BUILD_GTK4 "Build the GTK4 adapter and demo" OFF)
|
|
|
|
# Apply the project warning set to a first-party target. Warnings are never
|
|
# suppressed per file.
|
|
function(plot_apply_warnings target)
|
|
if(MSVC)
|
|
target_compile_options(${target} PRIVATE /W4 /permissive-)
|
|
else()
|
|
target_compile_options(${target} PRIVATE
|
|
-Wall
|
|
-Wextra
|
|
-Wpedantic
|
|
-Wconversion
|
|
-Wshadow)
|
|
endif()
|
|
endfunction()
|