From 1a1b68dfed4fc23873bd3f93cafb7eae6aa3b64b Mon Sep 17 00:00:00 2001 From: hoijui Date: Sun, 2 Dec 2018 10:49:14 +0100 Subject: [PATCH] CMake: Fail-fast if the used CMake version is too old for our Boost version --- CMakeLists.txt | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6e2a1f9125..05af4bdf83 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -65,10 +65,18 @@ add_definitions(-DENABLE_CGAL) # NOTE FindCGAL.cmake resets the BOOST_* and Boost_* variables, # because it looks for Boost itself, so it has to be called # before we look for our own required boost libraries. -find_package(Boost 1.36 REQUIRED COMPONENTS filesystem system thread regex program_options QUIET) +set(BOOST_DIRECTLY_REQUIRED_LIBRARIES filesystem system thread regex program_options) +find_package(Boost 1.36 REQUIRED COMPONENTS ${BOOST_DIRECTLY_REQUIRED_LIBRARIES} QUIET) message(STATUS "Boost: ${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") include_directories(${Boost_INCLUDE_DIRS}) +# Check if boost dependency libraries have been found too +list(LENGTH BOOST_DIRECTLY_REQUIRED_LIBRARIES BOOST_DIRECTLY_REQUIRED_LIBRARIES_LENGTH) +list(LENGTH Boost_LIBRARIES Boost_LIBRARIES_LENGTH) +if(Boost_LIBRARIES_LENGTH EQUAL BOOST_DIRECTLY_REQUIRED_LIBRARIES_LENGTH) + message(FATAL_ERROR "No dependent Boost libraries found. Your CMake (${CMAKE_VERSION}) version might be too old for the version of boost you are using (${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}). In that case, you should have received warnings above of the type: 'Imported targets not available for Boost version ${Boost_VERSION}'") +endif() + find_package(HarfBuzz 0.9.19 REQUIRED QUIET) message(STATUS "Harfbuzz: ${HARFBUZZ_VERSION}") include_directories(${HARFBUZZ_INCLUDE_DIRS})