Postmodern CMake was an experiment in adopting a Blaze-derived pattern for defining CMake targets. We thought it was a pretty successful first effort.
It's also a joke. Because "Modern CMake" was picking up some well deserved steam when we were authoring this. And I thought a literary pun would make for a good library name. (And jokes are always funnier explained.)
The short of it is,
include(postmodern_cmake)
as a module (modifyingCMAKE_MODULE_PATH
as necessary) in your CMakeLists.txt file.
Bonus points if you alsoinclude(postmodern_cmake.test)
.- Author a set of
targets.cmake
files. Basically every directory that contains compilable code should contain a targets.cmake. - Define one or more target per
targets.cmake
file with thepm_autotarget
(orpm_target
) function. - Add
pm_parse_targets
to your CMakeLists.txt to Find and parse the targets.cmake file set. This function will recursively search the given directory for targets.cmake files, andinclude
each of them as a means to load the defined targets into the current project.
If you'd like to start digging into the guts of this library, you should start with pm_autotargets.cmake first, then pm_parse_arguments.cmake. It flows from there. As much as a CMake library "flows," anyway.
For an example of this library in action, take a look at a targets.cmake from our nonstd library.