xmake set binary name
To set the binary name in xmake for a C++ project, follow these steps:
Open the
xmake.lua
configuration file in the root directory of your project.Use the
set_targetdir
function to specify the output directory for the compiled binaries. For example:lua set_targetdir("$(buildir)/$(mode)")
Use the
add_rules
function to add the C++ language rules. For example:lua add_rules("mode.debug", "mode.release")
Use the
add_target
function to define the target, and within it, set the binary name using theset_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.
Save the
xmake.lua
file.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.