We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
We can check c/c++ functions in target from packages
add_requires("zlib") target("test") set_kind("binary") add_files("src/*.c") add_packages("zlib") on_config(function (target) if target:has_cfuncs("inflate", {includes = "zlib.h"}) then target:add("defines", "HAVE_INFLATE") end end)
We can check c/c++ includes in target from packages
add_requires("zlib") target("test") set_kind("binary") add_files("src/*.c") add_packages("zlib") on_config(function (target) if target:has_cincludes("zlib.h") then target:add("defines", "HAVE_ZLIB_H") end end)
We can check c/c++ types in target from packages
add_requires("zlib") target("test") set_kind("binary") add_files("src/*.c") add_packages("zlib") on_config(function (target) if target:has_ctypes("z_stream", {includes = "zlib.h"}) then target:add("defines", "HAVE_ZSTEAM_T") end end)
We can check c/c++ snippets in target from packages
add_requires("libtins") target("test") set_kind("binary") add_files("src/*.cpp") add_packages("libtins") on_config(function (target) local has_snippet = target:check_cxxsnippets({test = [[ #include <string> using namespace Tins; void test() { std::string name = NetworkInterface::default_interface().name(); printf("%s\n", name.c_str()); } ]]}, {configs = {languages = "c++11"}, includes = {"tins/tins.h"}})) if has_snippet then target:add("defines", "HAS_XXX") end end)
target("test") set_kind("binary") add_files("src/*.cpp") on_config(function (target) if target:has_cxxflags("-fPIC") then target:add("defines", "HAS_PIC") end end)
target("test") set_kind("binary") add_files("src/*.cpp") on_config(function (target) if target:has_features("c_static_assert") then target:add("defines", "HAS_STATIC_ASSERT") end if target:has_features("cxx_constexpr") then target:add("defines", "HAS_CXX_CONSTEXPR") end end)
Now has_features/has_cflags/has_cxxflags are also available in package. We can use it in on_test/on_install
The text was updated successfully, but these errors were encountered:
xmake update -s github:xmake-io/xmake#hasxxx
Sorry, something went wrong.
No branches or pull requests
has_cfuncs/has_cxxfuncs for target
We can check c/c++ functions in target from packages
has_cincludes/has_cxxincludes for target
We can check c/c++ includes in target from packages
has_ctypes/has_cxxtypes for target
We can check c/c++ types in target from packages
has_csnippets/has_cxxsnippets for target
We can check c/c++ snippets in target from packages
has_cflags/has_cxxflags for target/package
has_features for target/package
Now has_features/has_cflags/has_cxxflags are also available in package. We can use it in on_test/on_install
The text was updated successfully, but these errors were encountered: