Benoit
Benoit

Reputation: 165

premake5 How can I generate the projects relative to where the user call premake, and not relative to the premake5.lua file?

I want the workspace and project files generated relative to where the user call premake5, as right now, everything is relative to the premake5.lua location.

I tried to use the location command in my workspace, but I'm unable to find a function that return the folder where the executable is call.

The goal is to mimic what cmake does, without hardcoding anything. So if a user wants to do:

mkdir build 
premake5 --file=../premake5.lua

It should generate all workspace/projects inside the build folder, and not at the root.

Thanks for help.

Upvotes: 1

Views: 1562

Answers (1)

J. Perkins
J. Perkins

Reputation: 4276

See location, _WORKING_DIR, and maybe path.join.

project 'MyProject'
   location(path.join(_WORKING_DIR, 'MyProject'))

Upvotes: 2

Related Questions