diff --git a/test/core/ExamplesUnitTests/CMakeLists.txt b/test/core/ExamplesUnitTests/CMakeLists.txt index da8122611..e002fa821 100644 --- a/test/core/ExamplesUnitTests/CMakeLists.txt +++ b/test/core/ExamplesUnitTests/CMakeLists.txt @@ -3015,4 +3015,35 @@ TRIBITS_ADD_ADVANCED_TEST( TribitsExampleProject_PkgWithUserErrors_PASS ) +TRIBITS_ADD_ADVANCED_TEST( TribitsExampleProject_PkgWithUserErrors_PACKAGE_POST_PROCESS + OVERALL_WORKING_DIRECTORY TEST_NAME + OVERALL_NUM_MPI_PROCS 1 + + TEST_0 + MESSAGE "Copy TribitsExampleProject so that we can copy in PkgWithUserErrors." + CMND cp + ARGS -r ${${PROJECT_NAME}_TRIBITS_DIR}/examples/TribitsExampleProject . + TEST_1 + MESSAGE "Copy PkgWithUserErrors to base dir." + CMND cp + ARGS -r ${CMAKE_CURRENT_SOURCE_DIR}/PkgWithUserErrors + TribitsExampleProject/. + + TEST_2 + MESSAGE "Configure PkgWithUserErrors" + CMND ${CMAKE_COMMAND} + ARGS + ${TribitsExampleProject_COMMON_CONFIG_ARGS} + -DTribitsExProj_TRIBITS_DIR=${${PROJECT_NAME}_TRIBITS_DIR} + -DTribitsExProj_ENABLE_Fortran=OFF + -DTribitsExProj_EXTRA_REPOSITORIES=PkgWithUserErrors + -DTribitsExProj_ENABLE_PkgWithUserErrors=ON + -DTribitsExProj_ENABLE_TESTS=ON + -DPkgWithUserErrors_SKIP_PACKAGE_POST_PROCESS=TRUE + TribitsExampleProject + PASS_REGULAR_EXPRESSION_ALL + "Processing enabled package: PkgWithUserErrors [(]Libs, Tests, Examples[)]" + "ERROR: Forgot to call TRIBITS_PACKAGE_POSTPROCESS[(][)] .*/TribitsExampleProject/PkgWithUserErrors/CMakeLists.txt" + ALWAYS_FAIL_ON_ZERO_RETURN + ) diff --git a/test/core/ExamplesUnitTests/PkgWithUserErrors/CMakeLists.txt b/test/core/ExamplesUnitTests/PkgWithUserErrors/CMakeLists.txt index c38e126f8..b4ae500f9 100644 --- a/test/core/ExamplesUnitTests/PkgWithUserErrors/CMakeLists.txt +++ b/test/core/ExamplesUnitTests/PkgWithUserErrors/CMakeLists.txt @@ -10,4 +10,6 @@ TRIBITS_ADD_LIBRARY( TRIBITS_ADD_TEST_DIRECTORIES(test) -TRIBITS_PACKAGE_POSTPROCESS() +IF (NOT ${PACKAGE_NAME}_SKIP_PACKAGE_POST_PROCESS) + TRIBITS_PACKAGE_POSTPROCESS() +ENDIF() diff --git a/tribits/core/package_arch/TribitsGlobalMacros.cmake b/tribits/core/package_arch/TribitsGlobalMacros.cmake index 65eed4d2a..768323d15 100644 --- a/tribits/core/package_arch/TribitsGlobalMacros.cmake +++ b/tribits/core/package_arch/TribitsGlobalMacros.cmake @@ -2284,12 +2284,19 @@ MACRO(TRIBITS_CONFIGURE_ENABLED_PACKAGES) PRINT_VAR(${TRIBITS_PACKAGE}_BINARY_DIR) ENDIF() - TRIBITS_TRACE_FILE_PROCESSING(PACKAGE ADD_SUBDIR + SET(TRIBITS_PACKAGE_CMAKELIST_FILE "${${TRIBITS_PACKAGE}_SOURCE_DIR}/CMakeLists.txt") + TRIBITS_TRACE_FILE_PROCESSING(PACKAGE ADD_SUBDIR + "${TRIBITS_PACKAGE_CMAKELIST_FILE}") IF (NOT ${TRIBITS_PACKAGE}_SOURCE_DIR STREQUAL ${PROJECT_NAME}_SOURCE_DIR) ADD_SUBDIRECTORY(${${TRIBITS_PACKAGE}_SOURCE_DIR} ${${TRIBITS_PACKAGE}_BINARY_DIR}) ELSE() - INCLUDE("${${TRIBITS_PACKAGE}_SOURCE_DIR}/CMakeLists.txt") + INCLUDE("${TRIBITS_PACKAGE_CMAKELIST_FILE}") + ENDIF() + IF (NOT ${PACKAGE_NAME}_TRIBITS_PACAKGE_POSTPROCESS) + MESSAGE(FATAL_ERROR + "ERROR: Forgot to call TRIBITS_PACKAGE_POSTPROCESS() in ${TRIBITS_PACKAGE_CMAKELIST_FILE}" + ) ENDIF() LIST(APPEND ENABLED_PACKAGE_LIBS_TARGETS ${TRIBITS_PACKAGE}_libs) diff --git a/tribits/core/package_arch/TribitsPackageMacros.cmake b/tribits/core/package_arch/TribitsPackageMacros.cmake index 6da27399e..1b4c81f1f 100644 --- a/tribits/core/package_arch/TribitsPackageMacros.cmake +++ b/tribits/core/package_arch/TribitsPackageMacros.cmake @@ -616,7 +616,11 @@ MACRO(TRIBITS_PACKAGE_POSTPROCESS) TRIBITS_PACKAGE_FINALIZE_DEPENDENCY_VARS() TRIBITS_PACKAGE_POSTPROCESS_COMMON() - # NOTE: This package is only able + IF (${PACKAGE_NAME}_SOURCE_DIR STREQUAL ${PROJECT_NAME}_SOURCE_DIR) + SET(${PACKAGE_NAME}_TRIBITS_PACAKGE_POSTPROCESS TRUE) + ELSE() + SET(${PACKAGE_NAME}_TRIBITS_PACAKGE_POSTPROCESS TRUE PARENT_SCOPE) + ENDIF() ENDMACRO()