added CMake source in XMake

This commit is contained in:
Alexander Popov 2024-04-27 23:56:00 +03:00
parent f2b20118e0
commit 1f76815be0
Signed by: iiiypuk
GPG Key ID: E47FE0AB36CD5ED6

22
code/XMake/CMake.lua Normal file
View File

@ -0,0 +1,22 @@
add_rules("mode.debug", "mode.release")
package("foo")
add_deps("cmake")
set_sourcedir(path.join(os.scriptdir(), "foo"))
on_install(function (package)
local configs = {}
table.insert(configs, "-DCMAKE_BUILD_TYPE=" .. (package:debug() and "Debug" or "Release"))
table.insert(configs, "-DBUILD_SHARED_LIBS=" .. (package:config("shared") and "ON" or "OFF"))
import("package.tools.cmake").install(package, configs)
end)
on_test(function (package)
assert(package:has_cfuncs("add", {includes = "foo.h"}))
end)
package_end()
add_requires("foo")
target("demo")
set_kind("binary")
add_files("src/main.c")
add_packages("foo")