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.
This commit is contained in:
2026-06-17 13:05:13 +03:00
parent 50ed32b7dc
commit cc265fb95d
+1
View File
@@ -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