# deal.IIVersionConfig.cmake
#
# and copies it (a) to the build directory and (b) prepares it for later
-# installation (the copy in CMAKE_CURRENT_BINARY_DIR).
+# installation.
#
#
#
# Finally, add a target to create the "binary" file in
-# ${DEAL_II_PROJECT_CONFIG_RELDIR} and add it to the library target:
+# ${DEAL_II_PROJECT_CONFIG_RELDIR} and add it to the "all" target:
#
ADD_CUSTOM_TARGET(setup_build_dir ALL
COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/binary
COMMAND ${CMAKE_COMMAND} -E touch
${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Config.cmake
- COMMENT "Update build configuration"
+ COMMENT "Update build directory"
)
-ADD_DEPENDENCIES(library setup_build_dir)
FOREACH(_build ${DEAL_II_BUILD_TYPES})
ADD_DEPENDENCIES(setup_build_dir ${DEAL_II_BASE_NAME}${DEAL_II_${_build}_SUFFIX})
ENDFOREACH()
#
# And a script to remove it upon installation from the install prefix:
+# This is necessary if somebody wants to install into the build directory
+# (yes this is a valid use case...).
#
INSTALL(CODE
"
# Add convenience targets that build and install only a specific component:
#
-FOREACH(_component library)
- ADD_CUSTOM_TARGET(${_component}
- # COMMAND ${CMAKE_COMMAND}
- # -DCOMPONENT="${_component}" -P cmake_install.cmake
- # COMMENT "Build and install component \"${_component}\"."
- # WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
- )
-ENDFOREACH()
+# The library can always be installed ;-)
+ADD_CUSTOM_TARGET(library
+ COMMAND ${CMAKE_COMMAND}
+ -DCOMPONENT="library" -P cmake_install.cmake
+ COMMENT "Build and install component \"library\"."
+ WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
+ )
FOREACH(_component compat_files documentation examples mesh_converter parameter_gui)
STRING(TOUPPER "${_component}" _component_uppercase)
IF(DEAL_II_COMPONENT_${_component_uppercase})
-
ADD_CUSTOM_TARGET(${_component}
COMMAND ${CMAKE_COMMAND}
-DCOMPONENT="${_component}" -P cmake_install.cmake
COMMENT "Build and install component \"${_component}\"."
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
)
-
ELSE()
-
ADD_CUSTOM_TARGET(${_component}
COMMAND ${CMAKE_COMMAND} -E echo "Error: Could not build and install disabled component \"${_component}\"."
&& ${CMAKE_COMMAND} -E echo "Please reconfigure with -DDEAL_II_COMPONENT_${_component}=yes"
&& false
)
-
ENDIF()
ENDFOREACH()
-
)
ENDIF()
-SET(_options)
-
+#
# Write a minimalistic CTestTestfile.cmake file to CMAKE_BINARY_DIR:
+#
FILE(WRITE ${CMAKE_BINARY_DIR}/CTestTestfile.cmake
"SUBDIRS(tests)"
)
-LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR})
-LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR})
+#
+# The hook into CTest so that the tests from the suprojects get picked up
+# by the main project:
+#
+
+FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/deal.IITestfile.cmake "")
+SET_PROPERTY(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
+ APPEND PROPERTY TEST_INCLUDE_FILE deal.IITestfile.cmake
+ )
#
-# Pass all relevant "TEST_" variables down to the subprojects:
+# Pass all relevant "TEST_" and "_DIR" variables down to the subprojects:
#
+
+SET(_options)
+
+LIST(APPEND _options -DDEAL_II_SOURCE_DIR=${CMAKE_SOURCE_DIR})
+LIST(APPEND _options -DDEAL_II_BINARY_DIR=${CMAKE_BINARY_DIR})
+
FOREACH(_var TEST_DIR TEST_DIFF TEST_TIME_LIMIT TEST_PICKUP_REGEX NUMDIFF_DIR)
LIST(APPEND _options "-U${_var}")
IF(DEFINED ${_var})
LIST(APPEND _categories umfpack)
ENDIF()
-#
-# The hook into CTest so that the tests from the suprojects get picked up
-# by the main project:
-#
-
-FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/deal.IITestfile.cmake "")
-SET_PROPERTY(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
- APPEND PROPERTY TEST_INCLUDE_FILE deal.IITestfile.cmake
- )
-
#
# Define a subproject for every enabled category:
#
COMMENT "Processing ./tests/${_category}"
)
ADD_DEPENDENCIES(setup_test setup_test_${_category})
- ADD_DEPENDENCIES(setup_test_${_category} library)
+
+ # depend on a valid build directory (libraries built, config in place):
+ ADD_DEPENDENCIES(setup_test_${_category} setup_build_dir)
ADD_CUSTOM_TARGET(clean_test_${_category}
COMMAND [ ! -d ${_category} ] || ${CMAKE_COMMAND}