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

[BUG] CMakeLists.txt source files and header files do not print as list #29

Closed
nhanders opened this issue Oct 4, 2021 · 3 comments
Closed
Assignees
Labels
acknowledged The issue is being worked on bug Something isn't working fixed Bug has been fixed and the fix tested

Comments

@nhanders
Copy link
Contributor

nhanders commented Oct 4, 2021

Describe the bug
In the projects CMakeLists.txt, there are calls to:

  • verbose_message(${sources})
  • verbose_message(${exe_sources})
  • verbose_message(${headers})

where the variables are lists set in SourcesAndHeaders.cmake.

However, when the messages are displayed in the console, only the first file is displayed in the list. E.g. if you have multiple sources, only the first file will be displayed.

To Reproduce
Steps to reproduce the behavior:

  1. Add multiple source files or header files
  2. Build

Expected behavior
Should display all the values in a list.

@nhanders nhanders added the bug Something isn't working label Oct 4, 2021
@nhanders
Copy link
Contributor Author

nhanders commented Oct 4, 2021

Here are some possible solutions:

Solution 1

I found a pretty trivial solution on SO.

Instead of:
verbose_message(${sources})
Enclose the variable in inverted commas:
verbose_message("${sources}")

This isn't perfect since it doesn't print with delimiters (despite what the SO post says), but instead prints it as one long string.

Solution 2

Print each item in the list with a foreach statement:

foreach(source IN LISTS headers)
  verbose_message("* ${source}")
endforeach()

I'm in favour of solution 2. It is verbose, but since I'm using the verbose_message command, I'm wanting a verbose output.

I will create a PR for this when I get a moment this week.

@filipdutescu filipdutescu self-assigned this Oct 4, 2021
@filipdutescu filipdutescu added the acknowledged The issue is being worked on label Oct 4, 2021
@filipdutescu
Copy link
Owner

Hello! Thank you a lot for submitting this issue. I was also working with the second solution, as, for me, it seems like the better of the two. With a check before so we don't go through the foreach loop if verbose messaging is toggled off.

I would also like to extend my gratitude for your kindness of wishing to submit a PR. Since I have some free time at the moment, I will make the fix now, but, please, feel free to submit any PRs you would wish and I will look over them. Once I push the commit I will let you know, so you can confirm it fixes it on your end as well.

@filipdutescu
Copy link
Owner

Done, pushed the fix. Please confirm it works, whenever you can, or reopen if it doesn't. Thanks again!

@filipdutescu filipdutescu added the fixed Bug has been fixed and the fix tested label Oct 4, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
acknowledged The issue is being worked on bug Something isn't working fixed Bug has been fixed and the fix tested
Projects
None yet
Development

No branches or pull requests

2 participants