]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Testsuite: Fix globbing command for all-headers tests, cleanup code 133/head
authorMatthias Maier <tamiko@kyomu.43-1.org>
Wed, 3 Sep 2014 22:07:11 +0000 (00:07 +0200)
committerMatthias Maier <tamiko@kyomu.43-1.org>
Wed, 3 Sep 2014 22:58:55 +0000 (00:58 +0200)
Turns out that globbing together a full path and manually extracting
relative paths is not the best idea. Clean up this mess by using
FILE(GLOB_RECURSE [base path] [...]) that produces nice relative paths.

tests/all-headers/CMakeLists.txt

index fd8c9995ba627aaa17dea720140f440b6be9e189..28e16c84212e9f47b062bf86a730fae19b46d40d 100644 (file)
@@ -1,7 +1,7 @@
 ## ---------------------------------------------------------------------
 ## $Id$
 ##
-## Copyright (C) 2013 by the deal.II authors
+## Copyright (C) 2013 - 2014 by the deal.II authors
 ##
 ## This file is part of the deal.II library.
 ##
@@ -29,23 +29,20 @@ INCLUDE(${DEAL_II_TARGET_CONFIG})
 
 SET(_category all-headers)
 
-FILE(GLOB_RECURSE _header ${DEAL_II_SOURCE_DIR}/include/deal.II/*.h)
-
-FOREACH(_full_file ${_header})
-  GET_FILENAME_COMPONENT(_file ${_full_file} NAME)
-
-  # TODO: A more sophisticated way to get the relative include path:
-  GET_FILENAME_COMPONENT(_path ${_full_file} PATH)
-  GET_FILENAME_COMPONENT(_path ${_path} NAME)
-  IF("${_path}" STREQUAL "std_cxx11")
-    SET(_path "base/std_cxx11")
-  ENDIF()
+#
+# Glob together all header files and strip SOURCE_DIR/include/deal.II to
+# get a correct relative path:
+#
+FILE(GLOB_RECURSE _headers ${DEAL_II_SOURCE_DIR}/include/deal.II/
+  ${DEAL_II_SOURCE_DIR}/include/deal.II/*.h
+  )
 
+FOREACH(_header ${_headers})
   FOREACH(_build ${DEAL_II_BUILD_TYPES})
     STRING(TOLOWER ${_build} _build_lowercase)
 
-    SET(_test ${_category}/${_path}/${_file}.${_build_lowercase})
-    STRING(REGEX REPLACE "\\/" "-" _target ${_path}/${_file}.${_build_lowercase})
+    SET(_test ${_category}/${_header}.${_build_lowercase})
+    STRING(REGEX REPLACE "\\/" "-" _target ${_header}.${_build_lowercase})
 
     # Respect TEST_PICKUP_REGEX:
     IF( "${TEST_PICKUP_REGEX}" STREQUAL "" OR
@@ -76,7 +73,7 @@ FOREACH(_full_file ${_header})
         INCLUDE_DIRECTORIES "${DEAL_II_INCLUDE_DIRS}"
         )
       SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
-        COMPILE_DEFINITIONS HEADER=<deal.II/${_path}/${_file}>
+        COMPILE_DEFINITIONS HEADER=<deal.II/${_header}>
         )
 
       ADD_CUSTOM_TARGET(${_target}.build

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.