From db599f8df4ac070322314002b14d22076cdfc6ab Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Franck=20P=C3=A9rignon?= <franck.perignon@imag.fr>
Date: Fri, 18 Mar 2011 18:18:58 +0000
Subject: [PATCH]  previous commit missing files ...

---
 CMake/CMakeListsForTests.cmake           | 24 ++++++++++++++++
 CMake/{Tools.cmake => ParmesTools.cmake} | 35 +++++++++++++++++++++++-
 HySoP/src/interfaces/ppm/ppm_wrapper.hpp |  1 -
 3 files changed, 58 insertions(+), 2 deletions(-)
 create mode 100644 CMake/CMakeListsForTests.cmake
 rename CMake/{Tools.cmake => ParmesTools.cmake} (65%)

diff --git a/CMake/CMakeListsForTests.cmake b/CMake/CMakeListsForTests.cmake
new file mode 100644
index 000000000..ac99db3f2
--- /dev/null
+++ b/CMake/CMakeListsForTests.cmake
@@ -0,0 +1,24 @@
+# -*- cmake -*-
+# This is the test cmake configuration
+# built from @CMAKE_SOURCE_DIR@/cmake/CMakeListsForTests.cmake.in 
+
+# scan the list of test executables
+foreach(_EXE ${_EXE_LIST_${_CURRENT_TEST_DIRECTORY}})
+ 
+  message(STATUS "Adding test suite ${_CURRENT_TEST_DIRECTORY}/${_EXE}")
+  
+  # Create an executable for the current test 
+  add_executable(${_EXE} ${${_EXE}_FSOURCES})
+  
+  # Add a dependency between current test and the main target (i.e. main project)
+  add_dependencies(${_EXE} ${PROJECT_NAME})
+  # link current target test with the same lib as for main project lib
+  target_link_libraries(${_EXE} ${PROJECT_NAME}_shared)
+  target_link_libraries(${_EXE} ${LIBS})
+  
+  # add test for ctest
+  add_test(${_EXE} ${_EXE})
+
+  set_tests_properties(${_EXE} PROPERTIES FAIL_REGULAR_EXPRESSION "FAILURE;Exception;failed;ERROR")
+  
+endforeach(_EXE ${_EXE_LIST_${_CURRENT_TEST_DIRECTORY}})
diff --git a/CMake/Tools.cmake b/CMake/ParmesTools.cmake
similarity index 65%
rename from CMake/Tools.cmake
rename to CMake/ParmesTools.cmake
index 6f4a5654b..b88a4097e 100644
--- a/CMake/Tools.cmake
+++ b/CMake/ParmesTools.cmake
@@ -73,6 +73,39 @@ endmacro(APPEND_Fortran_FLAGS)
 
 # debug
 macro(display V)
-  MESSAGE(STATUS "${V} = ${${V}}")
+  message(STATUS "${V} = ${${V}}")
 endmacro(display V)
 
+# Tests
+macro(begin_test _D)
+  set(_CURRENT_TEST_DIRECTORY ${_D})
+  file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${_D})
+  
+  # create a CMakeLists.txt for the current test in build_dir/test-name
+  # Source = file CMakeListsForTests.cmake. 
+  configure_file(${CMAKE_SOURCE_DIR}/CMake/CMakeListsForTests.cmake 
+    ${CMAKE_CURRENT_BINARY_DIR}/${_CURRENT_TEST_DIRECTORY}/CMakeLists.txt @ONLY)
+ 
+  # init the list of test executables
+  set(_EXE_LIST_${_CURRENT_TEST_DIRECTORY})
+endmacro(begin_test _D)
+
+macro(end_test)
+  # add the subdir corresponding to the current test (i.e. take the new CMakeLists.txt into account)
+  add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/${_CURRENT_TEST_DIRECTORY} ${CMAKE_CURRENT_BINARY_DIR}/${_CURRENT_TEST_DIRECTORY})
+endmacro(end_test)
+
+
+# Declare a new test
+macro(new_test)
+  car(_EXE ${ARGV})
+  cdr(_SOURCES ${ARGV})
+  display(_CURRENT_TEST_DIRECTORY)
+  # Add the current test to the list of all executables
+  list(APPEND _EXE_LIST_${_CURRENT_TEST_DIRECTORY} ${_EXE})
+  # Get the list of sources for the current executable
+  set(${_EXE}_FSOURCES)
+  foreach(_F ${_SOURCES})
+    list(APPEND ${_EXE}_FSOURCES ${CMAKE_CURRENT_SOURCE_DIR}/${_CURRENT_TEST_DIRECTORY}/${_F})
+  endforeach(_F ${_SOURCES})
+endmacro(new_test)  
diff --git a/HySoP/src/interfaces/ppm/ppm_wrapper.hpp b/HySoP/src/interfaces/ppm/ppm_wrapper.hpp
index 500829ce9..518e76b7a 100644
--- a/HySoP/src/interfaces/ppm/ppm_wrapper.hpp
+++ b/HySoP/src/interfaces/ppm/ppm_wrapper.hpp
@@ -5,7 +5,6 @@
 #include"FCMangle.h"
 #include<mpi.h>
 #include <cstring>
-#include "Mesh.hpp"
 
 /** Namespace for ppm functions and subroutines */
 
-- 
GitLab