Skip to content

Commit

Permalink
Catch missing TRIBITS_PACKAGE_POSTPROCESS() (#200)
Browse files Browse the repository at this point in the history
  • Loading branch information
bartlettroscoe committed Aug 11, 2017
1 parent cfb441b commit 4d988ab
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 5 deletions.
33 changes: 32 additions & 1 deletion test/core/ExamplesUnitTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3038,10 +3038,41 @@ TRIBITS_ADD_ADVANCED_TEST( TribitsExampleProject_PkgWithUserErrors_PASS

TEST_4 CMND ${CMAKE_CTEST_COMMAND} ARGS -VV
PASS_REGULAR_EXPRESSION_ALL
"Test [#]1: PkgWithUserErrors_PkgWithUserErrorsTest_MPI_1 [.]+ +Passed"
"Test [#]1: PkgWithUserErrors_PkgWithUserErrorsTest[_MPI1]* [.]+ +Passed"
ALWAYS_FAIL_ON_NONZERO_RETURN

)


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
)
4 changes: 3 additions & 1 deletion test/core/ExamplesUnitTests/PkgWithUserErrors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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()
11 changes: 9 additions & 2 deletions tribits/core/package_arch/TribitsGlobalMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2287,12 +2287,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)
Expand Down
6 changes: 5 additions & 1 deletion tribits/core/package_arch/TribitsPackageMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 4d988ab

Please sign in to comment.