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

CMakeLists.txt: Make c++11 optional unless building tests #269

Merged

Conversation

emmenlau
Copy link
Contributor

Several minor changes with respect to c++ standard:

  • Changing CMakeLists.txt to make c++11 optional. This is a good idea because SQLiteCpp can support even older compilers. With this change, c++11 becomes requested but the build can proceed if it is not found.
  • When tests are enabled, c++11 becomes mandatory. The user is informed about this setting via cmake output.
  • Allow users to specify other c++ versions via the cmake options: -DCMAKE_CXX_STANDARD="[98, 11, 14, 17, 20]"

Its my understanding that this PR is more generic than #239 because it allows users to manually specify a newer c++ standard, without all the special logic and extra options.

This PR may also supersede #263 since it is more generic than the other PR.

Comments and feedback welcome.

@coveralls
Copy link

coveralls commented Jan 30, 2020

Coverage Status

Coverage remained the same at 100.0% when pulling b5efb40 on BioDataAnalysis:emmenlau_add_simple_cpp11 into adad71b on SRombauts:master.

@SRombauts
Copy link
Owner

Thanks, I'll look into it seriously right away.

There is a change needed though: upcoming SQLiteCpp 3.x definitely requires C++11 and will fail with older compilers.
I have started migrating some code to std::unique_ptr<> with use of move constructors & operatos

CMakeLists.txt Outdated Show resolved Hide resolved
CMakeLists.txt Outdated Show resolved Hide resolved
@emmenlau emmenlau force-pushed the emmenlau_add_simple_cpp11 branch from c3e21d4 to b5efb40 Compare January 30, 2020 12:04
@emmenlau
Copy link
Contributor Author

Dear @SRombauts , the newest PR should respect your suggestions. With these changes, the minimum c++ standard will be 11, but other versions are allowed. If the user selects a lower standard than 11 they will get a warning. c++11 or higher standards can be selected unconditionally, and will always be treated as required, so cmake should fail if the compiler does not support it.

@SRombauts SRombauts self-assigned this Jan 30, 2020
@SRombauts SRombauts merged commit 5fd6b9c into SRombauts:master Jan 30, 2020
@SRombauts
Copy link
Owner

Thanks a lot, I like it!

@emmenlau emmenlau deleted the emmenlau_add_simple_cpp11 branch January 30, 2020 13:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants