From 1bd7e84bb3421ae76cc31d8f09945e7b3e917543 Mon Sep 17 00:00:00 2001 From: Kimball Thurston Date: Sat, 14 Sep 2019 11:54:14 +1200 Subject: [PATCH] Lower cmake version dependence We can support 3.10 as long as the user isn't requesting a scenario where we need object libraries and we don't build pyilmbase Signed-off-by: Kimball Thurston --- CMakeLists.txt | 15 +++++++++++++-- IlmBase/CMakeLists.txt | 9 ++++++++- 2 files changed, 21 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a52c01da..1ca8ebaa 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,14 @@ # We require this to get object library link library support and # combined python 2 + 3 support -cmake_minimum_required(VERSION 3.12) +if(OPENEXR_BUILD_BOTH_STATIC_SHARED OR ILMBASE_BUILD_BOTH_STATIC_SHARED) + if (${CMAKE_VERSION} VERSION_LESS "3.12.0") + message(FATAL_ERROR "CMake 3.12 or newer is required for object library support when building both static and shared libraries") + endif() + cmake_minimum_required(VERSION 3.12) +else() + cmake_minimum_required(VERSION 3.10) +endif() # Hint: This can be set to enable custom find_package # search paths, probably best to set it when configuring @@ -62,7 +69,11 @@ add_subdirectory(OpenEXR) # is found and warn otherwise? or error out? option(PYILMBASE_ENABLE "Enables configuration of the PyIlmBase module" ON) if(PYILMBASE_ENABLE) - add_subdirectory(PyIlmBase) + if (${CMAKE_VERSION} VERSION_LESS "3.12.0") + message(WARNING ": CMake version ${CMAKE_VERSION} detected, PyIlmBase uses newer features of cmake (>= 3.12), disabling") + else() + add_subdirectory(PyIlmBase) + endif() endif() option(OPENEXR_VIEWERS_ENABLE "Enables configuration of the viewers module" ON) diff --git a/IlmBase/CMakeLists.txt b/IlmBase/CMakeLists.txt index 983e7e20..17651781 100644 --- a/IlmBase/CMakeLists.txt +++ b/IlmBase/CMakeLists.txt @@ -3,7 +3,14 @@ # We require this to get object library link library support and # combined python 2 + 3 support -cmake_minimum_required(VERSION 3.12) +if(ILMBASE_BUILD_BOTH_STATIC_SHARED) + if (${CMAKE_VERSION} VERSION_LESS "3.12.0") + message(FATAL_ERROR "CMake 3.12 or newer is required for object library support when building both static and shared libraries") + endif() + cmake_minimum_required(VERSION 3.12) +else() + cmake_minimum_required(VERSION 3.10) +endif() # we include this first to parse configure.ac and extract the version # numbers