#1557 [CMake] Add all flags by default!
Metadata
Property | Value |
---|---|
Reported by | Dominic Kempf (dominic.r.kempf@gmail.com) |
Reported at | Jan 23, 2015 10:19 |
Type | Feature Request |
Version | 2.4 [autotools] |
Operating System | Unspecified / All |
Last edited by | Steffen Müthing (steffen.muething@iwr.uni-heidelberg.de) |
Last edited at | Apr 15, 2015 14:14 |
Closed by | Steffen Müthing (steffen.muething@iwr.uni-heidelberg.de) |
Closed at | Apr 15, 2015 14:14 |
Closed in version | Unknown |
Resolution | Implemented |
Comment | I fixed up the remaining rough corners and merged the branches in |
21f3e89 (dune-common) 62c9313 (dune-grid)
I also backported the changes to the release branches (that was easy because I could simply do a fast-forward ;-) ) |
Description
Dear Dune,
on the developer meeting in Berlin, Markus has proposed to greatly simplify the buildsystem, by adding all flags to all targets by default. Similarly all targets should be linked to all found libraries. Looking into the traffic on the mailing list, such feature would be of great use to our users. Not adding flags and thus not enabling a found package is our number one error source.
I have looked into the technicalities of realizing this in cmake. Markus did not take any actions yet, because he was puzzled by the fact that the command link_libraries, which one would use for the implementation, is deprecated. I have found http://www.cmake.org/pipermail/cmake/2009-April/028439.html which states that originally the command was "discouraged" instead of "deprecated". So, the command will NOT be remove in a future release and we can use it.
I have implemented the feature. It does the following
- It further splits the ALL_PKG_FLAGS into definitions, includes and libraries.
- It introduces a macro dune_enable_all_packages() which can be called from the project root CMakeLists.txt in order to add the all flags to the directory properties (and thus to all targets in it and its subdirectories). This done through the commands add_definitions, include_directories and link_libraries.
- It modifies the duneproject script to ask on whether to autoenable all packages (default = yes)
This way, we are completely backwards compatible (the core modules dont even need to use it, this is something for application modules). Calling any add_dune_*_flags macros despite the feature being turned on is not harmful. The only package which cannot conceptionally be handled by this mechanism is alberta, you would still have to use the macro there.
I would love to see enough testing of the feature to maybe get it into 2.4. Removing these pitfalls from the build system as soon as possible would be great service to users and developers alike.