On Jun 17, 2017, at 1:15 PM, Robert Ramey via Boost
wrote: On 6/17/17 10:30 AM, Niall Douglas via Boost wrote:
So tl;dr; I strongly recommend placing all cmake complexity into runnable scripts which generate .cmake files to be include()d to avoid boilerplate, and keep the CMakeLists.txt etc completely free of any custom macros or functions.
Niall, could you please show how an idiomatic CMakeLists.txt file should, in your opinion, look like, for a run-of-the-mill Boost library? Pick some existing library to illustrate the point, such as for example System, or SmartPtr, or even the simplest one, Assert. Or any other, if you prefer. Sure, though I'm talking really vanilla cmake here. But I guess it will narrow the discussion by demonstrating idiomatic cmake 3. Too much cmake 2 still kicks around. I really wish cmake would kill off cmake2-isms, as in, refuse to use them. According to Jens' https://meetingcpp.com/tl_files/blog/bda/boostdepbargraph.png, System looks the most tractable. I'll see if I can find some hours to do it up, I can guarantee it won't be today nor tomorrow. Maybe tomorrow night after the kids are asleep. Niall
Hmmm - I would be curious if a CMake enthusiast took a look at the Safe Numerics repo and commented on the CMake files listed there. I think its pretty simple and canonical usage of CMake as it relates to a Boost library. The only think I want to change is the existence of some code in a CMake directory which I'll soon eliminate - but all in all it's pretty simple. What would be missing from this for it it to meet expectations of CMake Promotors?
* It should not use global `include_directories`. * Its not necessary to put CMakeLists.txt in every directory with modern cmake. * There is no installation, and there is no support for `find_package(SafeNumerics)` which can provide a cmake target for downstream user to use. Nor does it provide a cmake target for people to use with `add_subdirectory` either. * Tests are always built even when the user sets `BUILD_TESTING` to off. Boost.Hana is much better example of modern cmake.