From 52a5cbe7cf16e2f8a1e95b6adfe91d8074ff47c3 Mon Sep 17 00:00:00 2001 From: wmayer Date: Mon, 13 Aug 2018 12:00:09 +0200 Subject: [PATCH] Improve error report about missing boost components --- CMakeLists.txt | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2446e27624..77a37448d2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -603,8 +603,9 @@ endif() SET(_boost_TEST_VERSIONS ${Boost_ADDITIONAL_VERSIONS}) + set (BOOST_COMPONENTS filesystem program_options regex signals system thread) find_package(Boost ${BOOST_MIN_VERSION} - COMPONENTS filesystem program_options regex signals system thread REQUIRED) + COMPONENTS ${BOOST_COMPONENTS} REQUIRED) if(UNIX AND NOT APPLE) # Boost.Thread 1.67+ headers reference pthread_condattr_* @@ -612,15 +613,19 @@ endif() endif() IF(NOT Boost_FOUND) - MESSAGE(FATAL_ERROR "========================================\n" - "boost not found, install the components:\n" - " * filesystem\n" - " * program_options\n" - " * regex\n" - " * signals\n" - " * system\n" - " * thread\n" - "========================================\n") + set (NO_BOOST_COMPONENTS) + foreach (comp ${BOOST_COMPONENTS}) + string(TOUPPER ${comp} uppercomp) + if (NOT Boost_${uppercomp}_FOUND) + list(APPEND NO_BOOST_COMPONENTS ${comp}) + endif() + endforeach() + MESSAGE(FATAL_ERROR "=============================================\n" + "Required components:\n" + " ${BOOST_COMPONENTS}\n" + "Not found, install the components:\n" + " ${NO_BOOST_COMPONENTS}\n" + "=============================================\n") ENDIF(NOT Boost_FOUND) # -------------------------------- XercesC --------------------------------