# SpongeBobTruthOrSquare - ReXGlue Recompiled Project
#
# The SDK package provides rexglue_project and the rexglue_setup_* functions.

cmake_minimum_required(VERSION 3.25)
project(SpongeBobTruthOrSquare LANGUAGES CXX)

set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (REXSDK_DIR)
  add_subdirectory("${REXSDK_DIR}" rexglue-sdk)
else ()
  find_package(rexglue 0.11.0 REQUIRED CONFIG)
endif ()
rexglue_project(SpongeBobTruthOrSquare OUTPUT_DIR generated/default)

# Host sources. src/main.cpp stays on the executable.
set(SPONGEBOBTRUTHORSQUARE_HOST_SOURCES src/SpongeBobTruthOrSquare_hooks.cpp)

# OBJECT and never STATIC, an archive drops the REX_EXPORT symbols.
add_library(SpongeBobTruthOrSquare_common OBJECT ${SPONGEBOBTRUTHORSQUARE_HOST_SOURCES})
rexglue_setup_host_library(SpongeBobTruthOrSquare_common)

if (WIN32)
  enable_language(RC)
  set(SPONGEBOBTRUTHORSQUARE_ICON_RC "${CMAKE_CURRENT_BINARY_DIR}/app_icon.rc")
  configure_file(src/app_icon.rc.in "${SPONGEBOBTRUTHORSQUARE_ICON_RC}" @ONLY)
  add_executable(SpongeBobTruthOrSquare WIN32 src/main.cpp "${SPONGEBOBTRUTHORSQUARE_ICON_RC}")
else ()
  add_executable(SpongeBobTruthOrSquare src/main.cpp)
endif ()

rexglue_setup_target(SpongeBobTruthOrSquare)
target_link_libraries(SpongeBobTruthOrSquare PRIVATE SpongeBobTruthOrSquare_common)
