From 089d5f41b72540fb05cb1a6b4a27dc5bf2cae423 Mon Sep 17 00:00:00 2001 From: Niko Mauno Date: Sun, 29 Sep 2024 12:00:00 +0000 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 51fc76d..97f650b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,12 +40,8 @@ if(NOT MSVC) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall") 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() +# Define __FILENAME__ +set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__FILENAME__=__FILE__")