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
Support CMake system #11
Conversation
I can see that CMake would be useful for building the tests. But what is the purpose of the other CMakeLists.txt file? I mean clipp is a header only library. Don't you just include it in your project and only add the translation units and binary libs to your CMakeLists.txt and CMake will be able to figure out the dependencies on headers itself? |
Yes, that's the quickest way to add single header libraries to a project. But in the long run, it makes it difficult to manage dependencies and follow their updates. Therefore, developers often want to keep external libraries out of their project repositories. For example, I like nlohmann/json, an awesome single-header library, and install it in
I respect your opinion. Let's wait and see coming |
Yeah Niels Lohmann's JSON lib is awesome; I've also used it a couple of times. |
+1 for CMake support for easier dependency management and finding the (interface) library via |
- Replace CMAKE_CXX_STANDARD with target_compile_features() - Require CMake version 3.8 for the meta flag "cxx_std_11" - Export namespace - Support sub_directory(): include_directory, namespace alias - Update version to 1.2.3 - Fix some commands and variables for testing
Thank you @m-waka for the suggestion. Updated |
Now that at least one other person has looked over it and the CMakeLists looks a lot cleaner I think it is ready to be merged. |
This patch enables users to install clipp with CMake:
and use it from other CMake projects:
CMake is also useful for building and executing the tests:
cmake -DBUILD_TESTING=1 -DCMAKE_CXX_COMPILER=g++-8 .. cmake --build . -- -j4 ctest -V
(I have not checked if it works equivalently as
run_tests.py
, though)I am concerned that this PR might conflict with your policy. Please feel free to reject this, and I would be fine to keep it in my branch.