cmake_minimum_required(VERSION 3.21)
project(extension_fixture LANGUAGES CXX)
get_filename_component(GUFO_ROOT "${CMAKE_CURRENT_LIST_DIR}/../../.." ABSOLUTE)
# Reuse the production targets; they intentionally resolve their source root
# through PROJECT_SOURCE_DIR, as in the root build.
set(PROJECT_SOURCE_DIR "${GUFO_ROOT}")
include("${GUFO_ROOT}/cmake/CompilerCache.cmake")
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(WIN32)
  # This standalone project does not inherit the root project's definitions.
  # Public platform headers must not introduce windows.h's min/max macros.
  add_compile_definitions(NOMINMAX WIN32_LEAN_AND_MEAN PSAPI_VERSION=2)
endif()
option(GUFO_ENABLE_WARNINGS "Enable fixture compiler warnings" ON)
option(GUFO_ENABLE_SANITIZERS "Enable fixture sanitizers" OFF)
if(GUFO_ENABLE_WARNINGS)
  if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC")
    add_compile_options(/W4)
  elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
    add_compile_options(-Wall -Wextra -Wpedantic)
  endif()
endif()
if(GUFO_ENABLE_SANITIZERS AND CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
  add_compile_options(-fsanitize=address,undefined -fno-omit-frame-pointer)
  add_link_options(-fsanitize=address,undefined)
endif()
find_package(Threads REQUIRED)
find_package(OpenSSL REQUIRED COMPONENTS Crypto)
include(CTest)
add_subdirectory("${GUFO_ROOT}/src/core/platform" platform)
add_subdirectory("${GUFO_ROOT}/src/ext" runtime)
set(GUFO_EXTENSION_FIXTURE ON)
add_subdirectory("${GUFO_ROOT}/tests/extensions" extensions)
