I wrote up a GitHub repository to show and highlight what I believe are the 2 biggest problems with cache variables in CMake.
The problems are illustrated in markdown, and SSCC’s are provided as well.
1.) The Default Parameter Issue
2.) The Loitering cache variable problem
I believe it’s possible to fix both of these issues without breaking the API or introducing new policies.
While these issues don’t often cause problems for smaller projects, they can really cause headaches at larger companies where the primary method of building the code is using add_subdirectory
.
I realize it’s often good practice to present 1 problem at a time but I feel like presenting both problems together might offer a more cohesive easy to maintain solution. Since the problems are so intertwined.
I’d appreciate any thoughts or feedback.