Skip to content
New issue

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

Calling project() does not work in certain scopes #54

Closed
amc522 opened this issue May 5, 2015 · 3 comments
Closed

Calling project() does not work in certain scopes #54

amc522 opened this issue May 5, 2015 · 3 comments

Comments

@amc522
Copy link
Contributor

amc522 commented May 5, 2015

In premake 4 I was doing something like the following:

for i, platform in ipairs(solution().platforms) do
    configuration {platform}
        targetdir ("build/" .. platform .. "/" .. project().name)
end

Now in premake 5, I get the following error when trying to call project():

Error: no project in scope

project().name still works everywhere else. It only seems to be a problem when I am iterating over the list of platforms or configurations from the solution object. I have also replaced my configuration call with filter.

Also, is there a better or more preferred way, in premake 5, to iterate over platforms and configurations?

@tvandijck
Copy link
Contributor

With the introduction of tokens you can just remove that entire loop and just do:

targetdir "build/%{cfg.platform}/%{prj.name}"

should result in exactly the same project setup.

@amc522
Copy link
Contributor Author

amc522 commented May 5, 2015

That! I like that! Exactly the functionality I was looking for. Thanks.

@tvandijck
Copy link
Contributor

more on tokens here: https://github.com/premake/premake-core/wiki/Tokens

@amc522 amc522 closed this as completed May 6, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants