From 0a7ca31247014d90a8794537b05e8fa564251192 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Leclercq?= Date: Tue, 7 May 2024 22:03:41 +0200 Subject: [PATCH] Fix booleans in env config --- xmake/modules/package/tools/cmake.lua | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/xmake/modules/package/tools/cmake.lua b/xmake/modules/package/tools/cmake.lua index 0bd963751ce..36f0b704a50 100644 --- a/xmake/modules/package/tools/cmake.lua +++ b/xmake/modules/package/tools/cmake.lua @@ -786,11 +786,21 @@ function _get_envs_for_default_flags(package, configs, opt) local envs = {} local default_flags = _get_default_flags(package, configs, buildtype, opt) if default_flags then - envs[format("CMAKE_CXX_FLAGS_%s", buildtype)] = (not opt.cxxflags and not opt.cxflags) and default_flags.cxxflags - envs[format("CMAKE_C_FLAGS_%s", buildtype)] = (not opt.cflags and not opt.cxflags) and default_flags.cflags - envs[format("CMAKE_EXE_LINKER_FLAGS_%s", buildtype)] = not opt.ldflags and default_flags.ldflags - envs[format("CMAKE_STATIC_LINKER_FLAGS_%s", buildtype)] = not opt.arflags and default_flags.arflags - envs[format("CMAKE_SHARED_LINKER_FLAGS_%s", buildtype)] = not opt.shflags and default_flags.shflags + if not opt.cxxflags and not opt.cxflags then + envs[format("CMAKE_CXX_FLAGS_%s", buildtype)] = default_flags.cxxflags + end + if not opt.cflags and not opt.cxflags then + envs[format("CMAKE_C_FLAGS_%s", buildtype)] = default_flags.cflags + end + if not opt.ldflags then + envs[format("CMAKE_EXE_LINKER_FLAGS_%s", buildtype)] = default_flags.ldflags + end + if not opt.arflags then + envs[format("CMAKE_STATIC_LINKER_FLAGS_%s", buildtype)] = default_flags.arflags + end + if not opt.shflags then + envs[format("CMAKE_SHARED_LINKER_FLAGS_%s", buildtype)] = default_flags.shflags + end end return envs end