Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Showcase insertion of CMake variables via configure_file() #85

Closed
avitase opened this issue Feb 14, 2023 · 3 comments
Closed

Showcase insertion of CMake variables via configure_file() #85

avitase opened this issue Feb 14, 2023 · 3 comments

Comments

@avitase
Copy link

avitase commented Feb 14, 2023

Occasionally, I have to use CMake variables inside my C/C++ files. A canonical way to get access to these variables is to parse the file via configure_file(); however, I find it non-trivial to insert this into the existing template. What about showcasing this by, for example, returning CMAKE_PROJECT_NAME instead of hard coding the name here. Another common use case is to return the project version as a string.

@friendlyanon
Copy link
Owner

I don't think that's necessary. There are examples that use the function, such as this one.

I would prefer to keep things minimal as a baseline and put interesting things in the wiki as an example.

This might also be better as a discussion rather than an issue I think.

@avitase
Copy link
Author

avitase commented Feb 15, 2023

Does this example still work for multi-configs scenarios? For example this line looks outdated: https://github.com/friendlyanon/generate-opaque-structs/blob/218bd01cbdaf038d6ddf89bc4f9715ce4de7a782/CMakeLists.txt#L45

@friendlyanon
Copy link
Owner

There is nothing outdated there. I don't understand. configure_file's output happens at configure time, regardless of the config.

Repository owner locked and limited conversation to collaborators Feb 15, 2023
@friendlyanon friendlyanon converted this issue into discussion #87 Feb 15, 2023

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants