From 82d9a31407772690adfe5c4782ef23788b29c904 Mon Sep 17 00:00:00 2001
From: Mathieu Faverge <mathieu.faverge@inria.fr>
Date: Wed, 4 Apr 2018 10:46:43 +0200
Subject: [PATCH] Add ctest configuration

---
 CMakeLists.txt    | 11 ++++++++---
 CTestConfig.cmake | 41 +++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 3 deletions(-)
 create mode 100644 CTestConfig.cmake

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ae3465f..8d79c727 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,10 +29,18 @@ if ( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})
     message(FATAL_ERROR "Submodule cmake_morse not initialized - run `git submodule update --init`")
   endif()
 
+  ## Executable and tests
+  enable_testing()
+  include(CTest)
+
 else()
   set( BUILD_SUBPROJECT ON )
 endif()
 
+# Define a subproject name fr ctest
+set(CMAKE_DIRECTORY_LABELS spm)
+set(CTEST_LABELS_FOR_SUBPROJECTS spm)
+
 if ( PASTIX_INT64 )
   set( SPM_INT64 ${PASTIX_INT64} )
 else()
@@ -222,8 +230,5 @@ add_documented_files(
   src/spm_integers.c
   )
 
-## Executable and tests
-enable_testing()
-include(CTest)
 # Testing executables
 add_subdirectory(tests)
diff --git a/CTestConfig.cmake b/CTestConfig.cmake
new file mode 100644
index 00000000..2bf4e3a1
--- /dev/null
+++ b/CTestConfig.cmake
@@ -0,0 +1,41 @@
+## This file should be placed in the root directory of your project.
+## Then modify the CMakeLists.txt file in the root directory of your
+## project to incorporate the testing dashboard.
+## # The following are required to uses Dart and the Cdash dashboard
+##   ENABLE_TESTING()
+##   INCLUDE(CTest)
+set(CTEST_PROJECT_NAME "spm")
+set(CTEST_NIGHTLY_START_TIME "00:00:00 GMT")
+
+set(CTEST_DROP_METHOD "http")
+set(CTEST_DROP_SITE "cdash.inria.fr")
+set(CTEST_DROP_LOCATION "/CDash/submit.php?project=pastix")
+set(CTEST_DROP_SITE_CDASH TRUE)
+
+#--------------------------------------------------------------------
+# BUILDNAME variable construction
+# This variable will be used to set the build name which will appear
+# on the Pastix dashboard http://cdash.inria.fr/CDash/
+#--------------------------------------------------------------------
+# Start with the short system name, e.g. "Linux", "FreeBSD" or "Windows"
+if(NOT BUILDNAME)
+
+  set(BUILDNAME "${CMAKE_SYSTEM_NAME}")
+
+  # Add i386 or amd64
+  if(CMAKE_SIZEOF_VOID_P EQUAL 8)
+    set(BUILDNAME "${BUILDNAME}-amd64")
+  else()
+    set(BUILDNAME "${BUILDNAME}-i386")
+  endif()
+
+  # Add compiler name
+  get_filename_component(CMAKE_C_COMPILER_NAME ${CMAKE_C_COMPILER} NAME)
+  set(BUILDNAME "${BUILDNAME}-${CMAKE_C_COMPILER_NAME}")
+
+  # Add the build type, e.g. "Debug, Release..."
+  if(CMAKE_BUILD_TYPE)
+    set(BUILDNAME "${BUILDNAME}-${CMAKE_BUILD_TYPE}")
+  endif(CMAKE_BUILD_TYPE)
+
+endif()
-- 
GitLab