cmake_minimum_required(VERSION 3.10)
project(FlowyAdmin)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)

set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

# Add the external library directory
include_directories(external)
include_directories(go)

add_executable(flowy_admin src/main.cpp)

# Link the Go shared library (using an absolute path)
target_link_libraries(flowy_admin "${CMAKE_SOURCE_DIR}/go/libgraphql.dylib")

# Set the RPATH so the executable knows where to find the shared library at runtime.
# Here we embed the absolute path to the 'go' directory.
set_target_properties(flowy_admin PROPERTIES
    BUILD_RPATH "${CMAKE_SOURCE_DIR}/go"
    INSTALL_RPATH "${CMAKE_SOURCE_DIR}/go"
)
