TriBITS
TriBITS copied to clipboard
tribits_add[_advanced]_test(): Extract exec path from target name
While working on #63, I realized that tribits_add_test() and tribits_add_advanced_test() I realized that we can make these extract the exec path from the target name automatically, even with an MPI build, by using the $<TARGET_FILE:exeName> generator expression. To do this, we just need to do the following:
-
Combine the functions
tribits_add_test_get_exe_binary_name()andtribits_add_test_adjust_directory()into a single functiontribits_add_test_get_exe_binary_path()that will return$<TARGET_FILE:exeName>whenexecNameis a target name. -
Change from
file(WRITE "${TEST_SCRIPT_FILE}" "${TEST_SCRIPT_STR}" )tofile(GENERATE ...)inTribitsAddAdvancedTest.cmakewhen not in testing mode.
This would make it so that you don't need to specify the DIRECTORY argument to the location of the executable. And this would work for MPI as well.