diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 3ae29e4..fb04829 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -48,6 +48,19 @@ add_custom_target(run_createagent ALL add_executable(dropshell ${SOURCES}) add_dependencies(dropshell run_createagent) +# Mark the generated files as GENERATED so CMake knows they'll be created during build +set_source_files_properties( + ${CMAKE_CURRENT_SOURCE_DIR}/src/autogen/_agent-remote.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/autogen/_agent-local.cpp + PROPERTIES GENERATED TRUE +) + +# Explicitly add the generated agent files, as they might not be in the source directory when globbed at the start. +target_sources(dropshell PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR}/src/autogen/_agent-remote.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/src/autogen/_agent-local.cpp +) + # Set include directories # build dir goes first so that we can use the generated version.hpp target_include_directories(dropshell PRIVATE diff --git a/source/make_createagent.sh b/source/make_createagent.sh index aca5f0b..5411a83 100755 --- a/source/make_createagent.sh +++ b/source/make_createagent.sh @@ -14,5 +14,7 @@ if ! command -v dehydrate &> /dev/null; then curl -fsSL https://gitea.jde.nz/public/dehydrate/releases/download/latest/install.sh | bash fi +mkdir -p "${SCRIPT_DIR}/src/autogen" + dehydrate "${SCRIPT_DIR}/agent-remote" "${SCRIPT_DIR}/src/autogen" dehydrate "${SCRIPT_DIR}/agent-local" "${SCRIPT_DIR}/src/autogen"