From 1788b9fa1bb2f159f36da934af67369ea4bbc474 Mon Sep 17 00:00:00 2001 From: maier Date: Fri, 4 Oct 2013 20:30:03 +0000 Subject: [PATCH] Proper fix, some final rearrangement. git-svn-id: https://svn.dealii.org/branches/branch_port_the_testsuite@31126 0785d39b-7218-0410-832d-ea1e28bc413d --- deal.II/cmake/config/CMakeLists.txt | 9 +++--- deal.II/cmake/setup_custom_targets.cmake | 20 +++++-------- tests/CMakeLists.txt | 37 ++++++++++++++---------- 3 files changed, 33 insertions(+), 33 deletions(-) diff --git a/deal.II/cmake/config/CMakeLists.txt b/deal.II/cmake/config/CMakeLists.txt index 7c8b5c3a30..b298923025 100644 --- a/deal.II/cmake/config/CMakeLists.txt +++ b/deal.II/cmake/config/CMakeLists.txt @@ -22,7 +22,7 @@ # 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. # # @@ -308,22 +308,23 @@ ENDIF() # # 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 " diff --git a/deal.II/cmake/setup_custom_targets.cmake b/deal.II/cmake/setup_custom_targets.cmake index 2f42194a01..5b73f3e30c 100644 --- a/deal.II/cmake/setup_custom_targets.cmake +++ b/deal.II/cmake/setup_custom_targets.cmake @@ -18,34 +18,28 @@ # 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() - diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index f62f2843a0..1de72dd17e 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -33,19 +33,32 @@ IF(NOT "${CMAKE_PROJECT_NAME}" STREQUAL "deal.II") ) 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}) @@ -98,16 +111,6 @@ IF(DEAL_II_WITH_UMFPACK) 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: # @@ -125,7 +128,9 @@ FOREACH(_category ${_categories}) 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} -- 2.39.5