--- /dev/null
+## ---------------------------------------------------------------------
+## $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()
## ---------------------------------------------------------------------
#
-# 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.
#
# 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
#
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:
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}}"
"${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}
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
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)
SET(_test ${_category}/${_step}.${_build_lowercase})
- #
# Respect TEST_PICKUP_REGEX:
- #
IF( "${TEST_PICKUP_REGEX}" STREQUAL "" OR
_test MATCHES "${TEST_PICKUP_REGEX}" )
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}