diff --git a/test/core/ExamplesUnitTests/TribitsExampleProject2_Tests.cmake b/test/core/ExamplesUnitTests/TribitsExampleProject2_Tests.cmake index ffb2112e5..002c3de2f 100644 --- a/test/core/ExamplesUnitTests/TribitsExampleProject2_Tests.cmake +++ b/test/core/ExamplesUnitTests/TribitsExampleProject2_Tests.cmake @@ -541,7 +541,9 @@ TribitsExampleProject2_explicit_tpl_vars(SHARED) ######################################################################## -function(TribitsExampleProject2_find_package sharedOrStatic package1TribitsOrRawCMake) +function(TribitsExampleProject2_find_package sharedOrStatic package1TribitsOrRawCMake + packageUseTribitsTestFunctions + ) TribitsExampleProject2_test_setup_header() @@ -559,6 +561,19 @@ function(TribitsExampleProject2_find_package sharedOrStatic package1TribitsOrR message(FATAL_ERROR "package1UseRawCMakeArgs='${package1UseRawCMakeArgs}' Invalid!") endif() + if (package1TribitsOrRawCMake STREQUAL "PACKAGE1_USE_RAW_CMAKE") + if (packageUseTribitsTestFunctions STREQUAL "PACKAGE1_USE_TRIBITS_TEST_FUNCTIONS") + list(APPEND package1UseRawCMakeArgs + "-D Package1_USE_TRIBITS_TEST_FUNCTIONS=TRUE" ) + string(APPEND testNameSuffix "_${packageUseTribitsTestFunctions}" ) + list(APPEND package1ConfiRegex + "Using TriBITS Test Functions in a raw CMake Package1 build" ) + else() + list(APPEND package1ConfiRegex + "Using Raw CMake add_test[(][)] in a raw CMake Package1 build" ) + endif() + endif() + # Allow skipping delete of src and build dirs to aid in debugging if (TribitsExampleProject2_Tests_SKIP_DELETE_SRC_AND_BUILD) set(deleteSrcAndBuildDirsCmndArgs @@ -687,10 +702,12 @@ function(TribitsExampleProject2_find_package sharedOrStatic package1TribitsOrR endfunction() -TribitsExampleProject2_find_package(STATIC "") -TribitsExampleProject2_find_package(SHARED "") -TribitsExampleProject2_find_package(STATIC PACKAGE1_USE_RAW_CMAKE) -TribitsExampleProject2_find_package(SHARED PACKAGE1_USE_RAW_CMAKE) +TribitsExampleProject2_find_package(STATIC "" "") +TribitsExampleProject2_find_package(SHARED "" "") +TribitsExampleProject2_find_package(STATIC PACKAGE1_USE_RAW_CMAKE "") +TribitsExampleProject2_find_package(SHARED PACKAGE1_USE_RAW_CMAKE "") +TribitsExampleProject2_find_package(SHARED PACKAGE1_USE_RAW_CMAKE + PACKAGE1_USE_TRIBITS_TEST_FUNCTIONS) ######################################################################## diff --git a/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.tribits.cmake b/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.tribits.cmake new file mode 100644 index 000000000..308757908 --- /dev/null +++ b/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.tribits.cmake @@ -0,0 +1,3 @@ +tribits_add_test(package1-prg NOEXEPREFIX NOEXESUFFIX + NAME Prg DIRECTORY ${PACKAGE_BINARY_DIR}/src NUM_MPI_PROCS 1 + PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1" ) diff --git a/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt b/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt index 906e0faf8..922e735d1 100644 --- a/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt +++ b/tribits/examples/TribitsExampleProject2/packages/package1/test/CMakeLists.txt @@ -1,5 +1,11 @@ -include_raw_cmake_build() - -tribits_add_test(package1-prg NOEXEPREFIX NOEXESUFFIX - NAME Prg DIRECTORY ${PACKAGE_BINARY_DIR}/src NUM_MPI_PROCS 1 - PASS_REGULAR_EXPRESSION "Package1 Deps: tpl1" ) +if ((NOT COMMAND tribits_project) OR Package1_USE_RAW_CMAKE) + if (Package1_USE_TRIBITS_TEST_FUNCTIONS) + message("-- Using TriBITS Test Functions in a raw CMake Package1 build!") + include("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.tribits.cmake") + else() + message("-- Using Raw CMake add_test() in a raw CMake Package1 build!") + include("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.raw.cmake") + endif() +else() + include("${CMAKE_CURRENT_LIST_DIR}/CMakeLists.tribits.cmake") +endif()