From 86c8b9523d9117ce6c88c4537dc5e2f55f07b849 Mon Sep 17 00:00:00 2001 From: Niko Mauno Date: Mon, 7 Oct 2024 16:20:14 +0300 Subject: [PATCH] CMakelists.txt: Stop using Make automatic variable CMake Makefile layout generation has changed since version 3.20, ref: https://discourse.cmake.org/t/base-filename-gets-set-to-compiler-depend-ts-after-update-to-cmake-3-20/3075/4 For instance with Yocto framework this approach can lead to QA issue stemming from build host path ending up in generated binary like ERROR: fluentbit-3.1.9-r0 do_package_qa: QA Issue: File /usr/bin/fluent-bit in package fluentbit contains reference to TMPDIR [buildpaths] ERROR: fluentbit-3.1.9-r0 do_package_qa: Fatal QA errors were found, failing task. stemming from $ strings packages-split/fluentbit/usr/bin/fluent-bit ... $(subst /yocto/upstream/build/tmp/work/cortexa57-poky-linux/fluentbit/3.1.9/git/,,$(abspath $<)) ... Signed-off-by: Niko Mauno --- CMakeLists.txt | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6583856..3fb5c55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -60,12 +60,8 @@ if(NOT MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") 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() +# Define __CMT_FILENAME__ +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__CMT_FILENAME__=__FILE__") # Configuration options option(CMT_DEV "Enable development mode" No)