xmake set binary name

To set the binary name in xmake for a C++ project, follow these steps:

  1. Open the xmake.lua configuration file in the root directory of your project.

  2. Use the set_targetdir function to specify the output directory for the compiled binaries. For example: lua set_targetdir("$(buildir)/$(mode)")

  3. Use the add_rules function to add the C++ language rules. For example: lua add_rules("mode.debug", "mode.release")

  4. Use the add_target function to define the target, and within it, set the binary name using the set_targetname function. For example: lua add_target("myapp") set_targetname("custom_name") add_files("src/*.cpp")

Replace "myapp" with your target name and "custom_name" with the desired binary name.

  1. Save the xmake.lua file.

  2. Run the xmake build command to compile your C++ project with the specified binary name. bash xmake

The compiled binary will be generated with the specified name in the target directory.