From 0d821cae5ec16d211fe9be88b0deecd76a958384 Mon Sep 17 00:00:00 2001
From: Stephane Del Pino <stephane.delpino44@gmail.com>
Date: Sun, 16 Aug 2020 16:15:37 +0200
Subject: [PATCH] Produce a simple configuration report at CMake invocation

Also removed explicit warnings messages. This warning had a spurious
effects in IDE compilation (counted as compilation warnings for
instance)
---
 CMakeLists.txt           | 45 +++++++++++++++++++++++++++++++++++++---
 cmake/FindParMETIS.cmake | 10 ++++-----
 cmake/PugsDoxygen.cmake  |  6 ++----
 3 files changed, 49 insertions(+), 12 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4197fca78..93e29a96f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -115,6 +115,7 @@ endif()
 
 # checks for MPI
 if (PUGS_ENABLE_MPI MATCHES "^(AUTO|ON)$")
+  set(MPI_DETERMINE_LIBRARY_VERSION TRUE)
   find_package(MPI)
 endif()
 
@@ -126,7 +127,7 @@ if(${MPI_FOUND})
   find_package(ParMETIS)
   if (NOT PARMETIS_LIBRARIES)
     if(PUGS_ENABLE_MPI MATCHES "^AUTO$")
-      message(WARNING "MPI support deactivated: ParMETIS cannot be found!")
+      message(STATUS "MPI support deactivated: ParMETIS cannot be found!")
       unset(MPI_FOUND)
       unset(MPI_CXX_LINK_FLAGS)
       unset(MPI_CXX_LIBRARIES)
@@ -159,7 +160,7 @@ if (CLANG_FORMAT)
     -P ${PUGS_SOURCE_DIR}/cmake/ClangFormatProcess.cmake
     COMMENT "running ${CLANG_FORMAT} ...")
 else ()
-  message(WARNING "clang-format no found!")
+  message(STATUS "clang-format no found!")
 endif()
 
 #------------------------------------------------------
@@ -176,7 +177,7 @@ if (CLAZY_STANDALONE)
     COMMENT "running ${CLAZY_STANDALONE} ..."
     )
 else ()
-  message(WARNING "clazy-standalone no found!")
+  message(STATUS "clazy-standalone no found!")
 endif()
 
 #------------------------------------------------------
@@ -446,3 +447,41 @@ else()
     LIBRARY DESTINATION lib
     ARCHIVE DESTINATION lib)
 endif()
+
+message("")
+message("====== pugs build options ======")
+message(STATUS "version: ${PUGS_VERSION}")
+message(STATUS "build type: ${CMAKE_BUILD_TYPE}")
+message(STATUS "compiler: ${CMAKE_CXX_COMPILER_ID} ${CMAKE_CXX_COMPILER_VERSION}")
+message(STATUS "kokkos devices: ${PUGS_BUILD_KOKKOS_DEVICES}")
+
+if (MPI_FOUND)
+  message(STATUS "MPI: ${MPI_CXX_LIBRARY_VERSION_STRING}")
+else()
+  if(NOT PARMETIS_LIBRARIES)
+    message(STATUS "MPI: deactivated: ParMETIS cannot be found!")
+  else()
+    message(STATUS "MPI: not found!")
+  endif()
+endif()
+
+if(CLANG_FORMAT)
+  message(STATUS "clang-format: ${CLANG_FORMAT}")
+else()
+  message(STATUS "clang-format: not found!")
+endif()
+
+if(CLAZY_STANDALONE)
+  message(STATUS "clazy-standalone: ${CLAZY_STANDALONE}")
+else()
+  message(STATUS "clazy-standalone: no found!")
+endif()
+
+if (DOXYGEN_FOUND)
+  message(STATUS "doxygen: ${DOXYGEN_EXECUTABLE}")
+else()
+  message(STATUS "doxygen: no found!")
+endif()
+
+message("================================")
+message("")
diff --git a/cmake/FindParMETIS.cmake b/cmake/FindParMETIS.cmake
index 382b167fd..71e47b3c0 100644
--- a/cmake/FindParMETIS.cmake
+++ b/cmake/FindParMETIS.cmake
@@ -4,19 +4,19 @@ find_path(PARMETIS_INCLUDE_DIR parmetis.h
   PATH_SUFFIX include parmetis)
 
 if (EXISTS "${PARMETIS_INCLUDE_DIR}/parmetis.h")
-  message("-- Found parmetis.h in ${PARMETIS_INCLUDE_DIR}")
+  message(STATUS "Found parmetis.h in ${PARMETIS_INCLUDE_DIR}")
   find_library(LIB_PARMETIS parmetis)
   if("${LIB_PARMETIS}" STREQUAL "LIB_PARMETIS-NOTFOUND")
-    message(WARNING "Could not find parmetis library")
+    message("** Could not find parmetis library")
   endif()
   find_library(LIB_METIS metis)
   if("${LIB_PARMETIS}" STREQUAL "LIB_METIS-NOTFOUND")
-    message(WARNING "Could not find metis library")
+    message("** Could not find metis library")
   endif()
   set(PARMETIS_LIBRARIES ${LIB_PARMETIS} ${LIB_METIS})
-  message("-- Found parmetis/metis libraries ${PARMETIS_LIBRARIES}")
+  message(STATUS "Found parmetis/metis libraries ${PARMETIS_LIBRARIES}")
 else()
-  message(WARNING "Could not find parmetis.h")
+  message("** Could not find parmetis.h")
 endif()
 
 mark_as_advanced(PARMETIS_INCLUDE_DIR PARMETIS_LIBRARIES)
diff --git a/cmake/PugsDoxygen.cmake b/cmake/PugsDoxygen.cmake
index caa5f1d41..b0bacf92f 100644
--- a/cmake/PugsDoxygen.cmake
+++ b/cmake/PugsDoxygen.cmake
@@ -8,7 +8,7 @@ option(BUILD_DOXYGEN_DOC "Build Doxygen documentation" ON)
 
 # check if Doxygen is installed
 find_package(Doxygen)
-if (DOXYGEN_FOUND)
+if(DOXYGEN_FOUND)
     # set input and output files
     set(DOXYGEN_IN "${PUGS_SOURCE_DIR}/doc/Doxyfile.in")
     set(DOXYGEN_OUT "${PUGS_BINARY_DIR}/Doxyfile")
@@ -26,6 +26,4 @@ if (DOXYGEN_FOUND)
 
     # building doc builds doxygen
     add_custom_target(doc doxygen)
-else (DOXYGEN_FOUND)
-  message("Doxygen need to be installed to generate the doxygen documentation")
-endif (DOXYGEN_FOUND)
+endif()
-- 
GitLab