From 11305c8d170a078f9a7d6416276cefd88b790208 Mon Sep 17 00:00:00 2001 From: Alexandru Ardelean Date: Thu, 9 Jul 2026 16:58:29 +0300 Subject: [PATCH] build: do not embed the build directory in the binary monkey, cfl, ctraces and cmetrics define __FILENAME__/__CMT_FILENAME__ via a GNU Make expression that only the Make generator expands; under Ninja the literal string, including the absolute ${CMAKE_SOURCE_DIR}, is baked into every object file. Use plain __FILE__ as the Windows branch already does, and drop the then-identical conditional. Signed-off-by: Alexandru Ardelean --- lib/cfl/CMakeLists.txt | 6 +----- lib/cmetrics/CMakeLists.txt | 6 +----- lib/ctraces/CMakeLists.txt | 6 +----- lib/monkey/CMakeLists.txt | 6 +++--- 4 files changed, 6 insertions(+), 18 deletions(-) diff --git a/lib/cfl/CMakeLists.txt b/lib/cfl/CMakeLists.txt index 93a189936ec..83bdb3b9726 100644 --- a/lib/cfl/CMakeLists.txt +++ b/lib/cfl/CMakeLists.txt @@ -41,11 +41,7 @@ if(NOT MSVC) endif() # Define __FILENAME__ consistently across Operating Systems -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$$(subst ${CMAKE_SOURCE_DIR}/,,$$(abspath $$<))\"'") -else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") -endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") diff --git a/lib/cmetrics/CMakeLists.txt b/lib/cmetrics/CMakeLists.txt index d7da71a795b..3e0a656c58c 100644 --- a/lib/cmetrics/CMakeLists.txt +++ b/lib/cmetrics/CMakeLists.txt @@ -61,11 +61,7 @@ if(NOT MSVC) endif() # Define __CMT_FILENAME__ consistently across Operating Systems -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__CMT_FILENAME__='\"$$(subst ${CMAKE_SOURCE_DIR}/,,$$(abspath $$<))\"'") -else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__CMT_FILENAME__=__FILE__") -endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__CMT_FILENAME__=__FILE__") # Configuration options option(CMT_DEV "Enable development mode" No) diff --git a/lib/ctraces/CMakeLists.txt b/lib/ctraces/CMakeLists.txt index bb2c54fa6d8..709bac0edc6 100644 --- a/lib/ctraces/CMakeLists.txt +++ b/lib/ctraces/CMakeLists.txt @@ -31,11 +31,7 @@ set(CTR_VERSION_PATCH 1) set(CTR_VERSION_STR "${CTR_VERSION_MAJOR}.${CTR_VERSION_MINOR}.${CTR_VERSION_PATCH}") # Define __FILENAME__ consistently across Operating Systems -if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Windows") - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$$(subst ${CMAKE_SOURCE_DIR}/,,$$(abspath $$<))\"'") -else() - set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") -endif() +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") # Configuration options option(CTR_DEV "Enable development mode" No) diff --git a/lib/monkey/CMakeLists.txt b/lib/monkey/CMakeLists.txt index 3dc1ef28a01..365551d0763 100644 --- a/lib/monkey/CMakeLists.txt +++ b/lib/monkey/CMakeLists.txt @@ -15,11 +15,11 @@ include(GNUInstallDirs) # Set default compiler options if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -Wextra") -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__='\"$$(subst ${CMAKE_SOURCE_DIR}/,,$$(abspath \$$<))\"'") -else() -set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") endif() +# Define __FILENAME__ consistently across Operating Systems +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__") + # Monkey Version set(MK_VERSION_MAJOR 1) set(MK_VERSION_MINOR 8)