From ba1b65f4a20566405c53d4ded90b483ec9aa7d09 Mon Sep 17 00:00:00 2001 From: _ov4 Date: Tue, 13 Oct 2026 03:51:54 +0000 Subject: feat: require explicit execution mode and gate external running Require PATH or NONE at configure time. Reject -r before writing output when lli is unavailable or execution is disabled. Co-Authored-By: Claude Fable 5.1 --- CMakeLists.txt | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'CMakeLists.txt') diff --git a/CMakeLists.txt b/CMakeLists.txt index e63860b..b2cead4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,12 @@ cmake_minimum_required(VERSION 3.13) project(cps_compiler) +set(CPSC_RUN_MODE "" CACHE STRING "Execution mode: PATH or NONE (required)") +set_property(CACHE CPSC_RUN_MODE PROPERTY STRINGS PATH NONE) +if(NOT CPSC_RUN_MODE MATCHES "^(PATH|NONE)$") + message(FATAL_ERROR "Specify -DCPSC_RUN_MODE=PATH or -DCPSC_RUN_MODE=NONE") +endif() + find_package(LLVM REQUIRED CONFIG) message(STATUS "Found LLVM ${LLVM_PACKAGE_VERSION}") message(STATUS "Using LLVMConfig.cmake in: ${LLVM_DIR}") @@ -33,9 +39,10 @@ add_library(CPSCodeGen lib/CodeGen/FileHandler.cc ) -llvm_map_components_to_libnames(llvm_libs core support native irreader) +llvm_map_components_to_libnames(llvm_libs core support) add_executable(cpsc tools/driver/main.cc) +target_compile_definitions(cpsc PRIVATE CPSC_RUN_${CPSC_RUN_MODE}) target_link_libraries(cpsc CPSCodeGen CPSParser -- cgit v1.3.1-4-g156e