From cc265fb95d5783ad449467cac3edd9a1ad5dc720 Mon Sep 17 00:00:00 2001 From: Gregory Lirent Date: Wed, 17 Jun 2026 13:05:13 +0300 Subject: [PATCH] Build position-independent objects (-fPIC) Set CMAKE_POSITION_INDEPENDENT_CODE so the static library's objects are PIC and stay linkable into a shared object; the host executables build as PIE. The mingw-cross guest is unaffected - position-independence is a no-op for Windows PE targets. --- CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f3ba1e3..16be044 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(vmi-engine C) set(CMAKE_C_STANDARD 17) # generation B uses no C23 feature set(CMAKE_C_STANDARD_REQUIRED ON) set(CMAKE_C_EXTENSIONS ON) # deliberate: strnlen (POSIX) + void* arithmetic (GNU) +set(CMAKE_POSITION_INDEPENDENT_CODE ON) # -fPIC on all objects: static lib stays linkable into a shared object option(VMIE_LTO "Enable LTO" OFF) # build-only; shipped default is -O2, no LTO