Bump CMake minimum to 3.12 and refactor accordingly. #2348
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Must take steps to install a newer cmake for the one Travis matrix case
where the old "trusty" image didn't contain a new enough one. In all
the other CI cases, a new enough cmake was already present.
Get rid of legacy cmake policy directives.
With newer cmake, change many add_definitions to more proper
add_compile_options. Get rid of unnecessary cmake definitions.
Refactor Makefile wrapper with better/standard target names: install,
build, config, etc. And don't replicate code for make vs ninja --
instead, use cmake --build.
Now that CMake 3.12 is the minimum, we can count on any FindFoo.cmake
having its searches automatically include hints for having defined
-DFoo_ROOT=...
or a defined environment variableFoo_ROOT
, withoutour needing to separately define or handle them. This leads to a huge
refactor ond simplification, as well as a normalization of this as the
one true naming convention for dependency location hints (versus a
hodgepodge of FOO_ROOT_DIR, FOOHOME, FOO_PATH, FOO_HOME, and more).
A lot of the repetitive logic of finding dependencies has been
coalesced in new oiio_find_package macro, which wraps the build-in
find_package() with some nicities, including color coded clear status
messages about which deps were found, which optional ones were not,
and which the user disabled.
The crown jewel of this patch is externalpackages.cmake, that's the one
thing to look at if you want to see how much nicer the dependency finding code is.