Xmake Version
v3.1.0+19800101
Operating System Version and Architecture
NixOS 26.05 (Yarara) x86_64
Describe Bug
I use add_defines to define myself a public macro to distinguish target OS in my c++ code. However, targets using my library package do not compile with those definitions on.
Expected Behavior
public definitions are inherited from within packaged libs
Project Configuration
Complete example may be found here
https://github.com/bugsnotabunny/comppath
xmake.lua
add_rules("mode.debug", "mode.asan", "mode.tsan", "mode.release", "mode.minsizerel")
option("tests")
set_default(true)
set_showmenu(true)
set_description("Build tests")
option_end()
set_languages("c++20")
set_warnings("all", "extra", "pedantic")
if is_mode("release") then
set_optimize("fastest")
add_defines("NDEBUG")
set_strip("debug")
elseif is_mode("minsizerel") then
set_optimize("smallest")
add_defines("NDEBUG")
set_strip("debug")
else
set_optimize("fast")
end
target("comppath")
set_kind("headeronly")
add_includedirs("include", { public = true })
add_headerfiles("include/(**.hpp)")
set_default(true)
print(get_config("plat"))
if is_plat("android", "appletvos", "applexros", "bsd", "cygwin",
"haiku", "iphoneos", "linux", "macosx", "msys", "watchos") then
add_defines("COMPPATH_PLATFORM_POSIX=1", { public = true })
elseif is_plat("windows") then
add_defines("COMPPATH_PLATFORM_WINDOWS=1", { public = true })
end
target_end()
if has_config("tests") then
add_requires("catch2 v3.10.0", { external = true, configs = { main = false, gmock = false, shared = true } })
end
for _, file in ipairs(os.files("test/cases/**.cpp")) do
local rel_path = path.relative(file, "test/cases")
local name = "test." .. rel_path:gsub("/", "."):sub(1, -5)
target(name)
set_enabled(has_config("tests"))
set_kind("binary")
add_deps("comppath")
add_packages("catch2", { external = true, public = false })
add_files(file)
add_tests("default", { runargs = { "--skip-benchmarks" }, timeout = 120 })
add_tests("norandord", { runargs = { "--skip-benchmarks", "--order=decl" }, timeout = 120 })
target_end()
end
packages/c/comppath
package("comppath")
set_description("comppath - Compile-time reflection over filesystem paths")
set_homepage("https://github.com/bugsnotabunny/comppath")
set_license("MIT")
add_urls("https://github.com/bugsnotabunny/comppath.git")
add_versions("experimental", "master")
add_versions("v0.1.0", "v0.1.0")
set_kind("library", {headeronly = true})
on_install(function (package)
import("package.tools.xmake").install(package, { tests = false })
end)
on_test(function (package)
assert(package:has_cxxincludes("comppath/CompPath.hpp", {configs = {languages = "cxx20"}}))
end)
Additional Information and Error Logs
This is what I get. I get the same results with package generated by xmake package CLI
Same thing as below on github: https://github.com/bugsnotabunny/comppath/actions/runs/33126974505/job/98707326401
banan@nixos [02:54:19] [~/repos/comppath] [master *]
-> % xmake config --project=.github/package_integrity --toolchain=clang --mode=release --comppath-version=experimental -vy
configure
{
kind = static
ccache = true
host = linux
builddir = build
toolchain = clang
mode = release
comppath-version = experimental
ndk_stdcxx = true
plat = linux
arch = x86_64
}
banan@nixos [02:54:22] [~/repos/comppath] [master *]
-> % xmake build --project=.github/package_integrity -vy
[ 23%]: <test> cache compiling.release main.cpp
/nix/store/n6iq0d21wjvl669j4srpppicpx3dc133-clang-wrapper-22.1.8/bin/clang++ -c -Qunused-arguments -m64 -Wall -Wextra -Wpedantic -std=c++20 -isystem /home/banan/.xmake/packages/c/comppath/experimental/fd7980d205a342f79bd86efee86abeb0/include -o ../../build/.objs/test/linux/x86_64/release/main.cpp.o main.cpp
error: main.cpp:6:27: error: no member named 'LEXICALLY_NORMAL' in namespace 'comppath'
6 | static_assert(comppath::LEXICALLY_NORMAL<"some/cool/../dir"> == "some/dir");
| ^~~~~~~~~~~~~~~~
main.cpp:6:64: error: expected expression
6 | static_assert(comppath::LEXICALLY_NORMAL<"some/cool/../dir"> == "some/dir");
| ^
2 errors generated.
Xmake Version
v3.1.0+19800101
Operating System Version and Architecture
NixOS 26.05 (Yarara) x86_64
Describe Bug
I use add_defines to define myself a public macro to distinguish target OS in my c++ code. However, targets using my library package do not compile with those definitions on.
Expected Behavior
public definitions are inherited from within packaged libs
Project Configuration
Complete example may be found here
https://github.com/bugsnotabunny/comppath
xmake.lua
packages/c/comppath
Additional Information and Error Logs
This is what I get. I get the same results with package generated by
xmake packageCLISame thing as below on github: https://github.com/bugsnotabunny/comppath/actions/runs/33126974505/job/98707326401