]> https://gitweb.dealii.org/ - dealii-svn.git/commitdiff
CMAKE: Bugfix, also allow to call DEAL_II_SETUP_TARGET on object libraries
authormaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 15 Sep 2013 15:15:45 +0000 (15:15 +0000)
committermaier <maier@0785d39b-7218-0410-832d-ea1e28bc413d>
Sun, 15 Sep 2013 15:15:45 +0000 (15:15 +0000)
git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@30713 0785d39b-7218-0410-832d-ea1e28bc413d

deal.II/cmake/macros/macro_deal_ii_insource_setup_target.cmake [new file with mode: 0644]
deal.II/cmake/macros/macro_deal_ii_pickup_tests.cmake
deal.II/cmake/macros/macro_deal_ii_setup_target.cmake
tests/all-headers/CMakeLists.txt
tests/build_tests/CMakeLists.txt

diff --git a/deal.II/cmake/macros/macro_deal_ii_insource_setup_target.cmake b/deal.II/cmake/macros/macro_deal_ii_insource_setup_target.cmake
new file mode 100644 (file)
index 0000000..daa070b
--- /dev/null
@@ -0,0 +1,51 @@
+## ---------------------------------------------------------------------
+## $Id$
+##
+## Copyright (C) 2012 - 2013 by the deal.II authors
+##
+## This file is part of the deal.II library.
+##
+## The deal.II library is free software; you can use it, redistribute
+## it, and/or modify it under the terms of the GNU Lesser General
+## Public License as published by the Free Software Foundation; either
+## version 2.1 of the License, or (at your option) any later version.
+## The full text of the license can be found in the file LICENSE at
+## the top level of the deal.II distribution.
+##
+## ---------------------------------------------------------------------
+
+#
+# This file provides an insource version of the DEAL_II_SETUP_TARGET macro.
+#
+# Usage:
+#       DEAL_II_INSOURCE_SETUP_TARGET(target build)
+#
+# This appends necessary include directories, linker flags, compile
+# definitions and the deal.II library link interface to the given target.
+#
+#
+
+MACRO(DEAL_II_INSOURCE_SETUP_TARGET _target _build)
+
+  SET_TARGET_PROPERTIES(${_target} PROPERTIES
+    LINK_FLAGS "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${_build}}"
+    COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}"
+    COMPILE_FLAGS "${DEAL_II_CXX_FLAGS_${_build}}"
+    LINKER_LANGUAGE "CXX"
+    RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/${_test_short}"
+    )
+  SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
+    INCLUDE_DIRECTORIES
+      "${CMAKE_BINARY_DIR}/include"
+      "${CMAKE_SOURCE_DIR}/include"
+      "${CMAKE_SOURCE_DIR}/include/deal.II/"
+    )
+
+GET_PROPERTY(_type TARGET ${_target} PROPERTY TYPE)
+IF(NOT "${_type}" STREQUAL "OBJECT_LIBRARY")
+  TARGET_LINK_LIBRARIES(${_target}
+    ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX}
+    )
+ENDIF()
+
+ENDMACRO()
index 95daf6f6e92f0fd5d615f4235df0a411cc9ae7d8..cf5fdc1bb427e0a4ff2c1de18d1066884ae6ceda 100644 (file)
@@ -15,7 +15,7 @@
 ## ---------------------------------------------------------------------
 
 #
-# A Macro to pick up all tests in a test subdirectory
+# A macro to pick up all tests in a test subdirectory
 #
 # If TEST_PICKUP_REGEX is set, only tests matching the regex will be
 # processed.
index 28b88dd1d09ad93770c160729c46a8e47bafdc49..df0a3a138748c9b309e0df065cae8510ea35ce51 100644 (file)
@@ -121,7 +121,10 @@ MACRO(DEAL_II_SETUP_TARGET _target)
   #
   # Set up the link interface:
   #
-  TARGET_LINK_LIBRARIES(${_target} ${DEAL_II_TARGET})
+  GET_PROPERTY(_type TARGET ${_target} PROPERTY TYPE)
+  IF(NOT "${_type}" STREQUAL "OBJECT_LIBRARY")
+    TARGET_LINK_LIBRARIES(${_target} ${DEAL_II_TARGET})
+  ENDIF()
 
   #
   # If DEAL_II_STATIC_EXECUTABLE is set, switch the final link type to
index 1c3527c0317a7bd9b8bba9fb2b42d896263a2b40..c9e9c8204f1c9e885baeea331cc52477b0f31b6c 100644 (file)
 #
 
 SET(_category all-headers)
-
-FILE(GLOB_RECURSE _header
-  ${CMAKE_SOURCE_DIR}/include/*.h
-  )
+FILE(GLOB_RECURSE _header ${CMAKE_SOURCE_DIR}/include/*.h)
 
 FOREACH(_full_file ${_header})
-
   GET_FILENAME_COMPONENT(_file ${_full_file} NAME)
 
   # TODO: A more sophisticated way to get the relative include path:
@@ -44,15 +40,12 @@ FOREACH(_full_file ${_header})
 
     SET(_test ${_category}/${_path}/${_file}.${_build_lowercase})
     SET(_target ${_category}-${_path}-${_file}.${_build_lowercase})
-    #
+
     # Respect TEST_PICKUP_REGEX:
-    #
     IF( "${TEST_PICKUP_REGEX}" STREQUAL "" OR
         _test MATCHES "${TEST_PICKUP_REGEX}" )
 
-      #
       # Add an object library for each header file and build configuration:
-      #
       ADD_LIBRARY(${_target} OBJECT EXCLUDE_FROM_ALL test_header.cc)
       SET_TARGET_PROPERTIES(${_target} PROPERTIES
         COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}"
@@ -65,13 +58,10 @@ FOREACH(_full_file ${_header})
           "${CMAKE_SOURCE_DIR}/include/deal.II/"
         )
       SET_PROPERTY(TARGET ${_target} APPEND PROPERTY
-        COMPILE_DEFINITIONS
-          HEADER=<deal.II/${_path}/${_file}>
+        COMPILE_DEFINITIONS HEADER=<deal.II/${_path}/${_file}>
         )
 
-      #
       # And finally add the test:
-      #
       ADD_TEST(NAME ${_test}
         COMMAND ${CMAKE_COMMAND}
           -DTRGT=${_target}
index de7de1e42263b8b2b2263dc33d979e83be9c9c1e..99aab0fc5d9735902f47a01ea7dacb6f82ac21cf 100644 (file)
@@ -27,7 +27,6 @@
 
 SET(_category build_tests)
 
-
 # Run a minimalistic set of steps in debug configuration:
 SET(_debug_steps
   step-1  step-2  step-3  step-4  step-5
@@ -44,7 +43,6 @@ SET(_release_steps
   step-47 step-48 step-49
   )
 
-
 FILE(GLOB _steps ${CMAKE_SOURCE_DIR}/examples/step-*)
 FOREACH(_step_full ${_steps})
   GET_FILENAME_COMPONENT(_step ${_step_full} NAME)
@@ -54,9 +52,7 @@ FOREACH(_step_full ${_steps})
 
     SET(_test ${_category}/${_step}.${_build_lowercase})
 
-    #
     # Respect TEST_PICKUP_REGEX:
-    #
     IF( "${TEST_PICKUP_REGEX}" STREQUAL "" OR
         _test MATCHES "${TEST_PICKUP_REGEX}"  )
 
@@ -133,16 +129,16 @@ FOREACH(_step_full ${_steps})
 
       ITEM_MATCHES(_match ${_step} ${_${_build_lowercase}_steps})
       IF(_match)
+        # Add a full test (CONFIGURE, BUILD, RUN):
         SET(_target ${_category}-${_step}.${_build_lowercase}.run)
         ADD_CUSTOM_TARGET(${_target} DEPENDS ${_step_dir}/run_output)
       ELSE()
+        # Add a minimal test (CONFIGURE, BUILD):
         SET(_target ${_category}-${_step}.${_build_lowercase}.build)
         ADD_CUSTOM_TARGET(${_target} DEPENDS ${_step_dir}/build_output)
       ENDIF()
 
-      #
       # And finally add the test:
-      #
       ADD_TEST(NAME ${_test}
         COMMAND ${CMAKE_COMMAND}
           -DTRGT=${_target}

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.