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

Read project version from version.hpp #167

Merged
merged 3 commits into from
Apr 15, 2019
Merged

Read project version from version.hpp #167

merged 3 commits into from
Apr 15, 2019

Conversation

pleroux0
Copy link
Contributor

Modifies CMakeLists.txt to determine the version from the version.hpp file to avoid duplication.

Some relevant discussion in #166

@uilianries
Copy link
Member

Why not creating version.hpp by PEGTL version in CMakeLists.txt?

Reading a file and extracting the version by regex looks much complex than using the recommended cmake flow (cmake tutorial).

@coveralls
Copy link

coveralls commented Apr 15, 2019

Coverage Status

Coverage remained the same at 100.0% when pulling 6111025 on pleroux0:master into 51dbee8 on taocpp:master.

@pleroux0
Copy link
Contributor Author

That is also an option, but someone still has to check it into the repository. In a pure CMake project, it can reside in the build directory like generated files usually do (just as in the tutorial).

It makes sense to me having the version.hpp as the source of truth so that it can be used as pure header only library (just copy the sources).

@d-frey
Copy link
Member

d-frey commented Apr 15, 2019

I like this patch as it seems "simple" and straight-forward to me.

  • version.hpp is the single source of truth.
  • If someone uses CMake, CMakeLists.txt takes the version from the above file.
  • If someone does not use CMake, it still works out-of-the-box.
  • No extra step (manual/automated) to sync two files.

Am I missing any downside?

@d-frey
Copy link
Member

d-frey commented Apr 15, 2019

Why not creating version.hpp by PEGTL version in CMakeLists.txt?

Reading a file and extracting the version by regex looks much complex than using the recommended cmake flow (cmake tutorial).

The only problem with the CMake flow is that it assumes CMake is used. The PEGTL simply doesn't enforce users (even Colin and me) to use CMake. Support for CMake is nice, being forced to use it is... not so nice. Maybe I'm old-school, but as long as there is no downside to Paul's approach, I tend to merge the PR soon. :)

@d-frey d-frey self-assigned this Apr 15, 2019
@uilianries
Copy link
Member

oh, I see. I have to agree, your approach sounds better since this project doesn't require cmake.

Thank you @d-frey @pleroux0

@d-frey d-frey merged commit c5d158f into taocpp:master Apr 15, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging this pull request may close these issues.

4 participants