cmake_minimum_required(VERSION 3.15)
project(CGVirtualMonitorVNCClient VERSION 1.0 LANGUAGES C)

# Usual install spot
list(APPEND CMAKE_MODULE_PATH "$ENV{HOME}/.local/lib/cmake")
# Environment-provided hint
if(DEFINED "$ENV{FXSDK_PATH}")
  list(APPEND CMAKE_MODULE_PATH "$ENV{FXSDK_PATH}/lib/cmake")
endif()

find_package(PkgConfig REQUIRED)
find_package(LibFxlink 2.9 REQUIRED)

pkg_check_modules(libvncclient REQUIRED libvncclient IMPORTED_TARGET)
pkg_check_modules(sdl2 REQUIRED sdl2 IMPORTED_TARGET)

add_executable(cgvm_vnc src/main.c)
target_compile_options(cgvm_vnc PRIVATE -g)
set_target_properties(cgvm_vnc PROPERTIES
  RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}")
target_link_libraries(cgvm_vnc PRIVATE
  PkgConfig::libvncclient PkgConfig::sdl2 LibFxlink::LibFxlink)
