File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -125,6 +125,44 @@ function(add_dotnet_project _TARGET_NAME)
125125 )
126126endfunction ()
127127
128+ function (add_dotnet_test_project _TARGET_NAME)
129+ # TODO: (sh) It seems the test project gets build twice with different output directories
130+ # e.g.: the same output files are contained in "build/<package>/<target>/net6.0/" and "build/<package>/<target>/net6.0/linux-x64"
131+ # But this seems to be the case with other projects as well (package rcldotnet and targets rcldotnet_assemblies and test_messages).
132+ # So maybe this is how it should be, but why?
133+
134+ cmake_parse_arguments (_add_dotnet_test_project
135+ ""
136+ ""
137+ "PROJ;INCLUDE_DLLS"
138+ ${ARGN}
139+ )
140+
141+ csharp_add_existing_project(${_TARGET_NAME}
142+ EXECUTABLE
143+ PROJ
144+ ${_add_dotnet_test_project_PROJ}
145+ ${_add_dotnet_test_project_UNPARSED_ARGUMENTS}
146+ INCLUDE_DLLS
147+ ${_add_dotnet_test_project_INCLUDE_DLLS}
148+ )
149+
150+ if (CSBUILD_PROJECT_DIR)
151+ set (CURRENT_TARGET_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR} /${CSBUILD_PROJECT_DIR} " )
152+ else ()
153+ set (CURRENT_TARGET_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR} " )
154+ endif ()
155+
156+ get_filename_component (_add_dotnet_test_project_PROJ_ABSOLUTE ${_add_dotnet_test_project_PROJ} ABSOLUTE )
157+
158+ ament_add_test(
159+ ${_TARGET_NAME}
160+ GENERATE_RESULT_FOR_RETURN_CODE_ZERO
161+ WORKING_DIRECTORY ${CURRENT_TARGET_BINARY_DIR} /${_TARGET_NAME}
162+ COMMAND dotnet test ${_add_dotnet_test_project_PROJ_ABSOLUTE}
163+ )
164+ endfunction ()
165+
128166function (install_dotnet _TARGET_NAME)
129167 get_target_property (_target_executable ${_TARGET_NAME} EXECUTABLE)
130168 get_target_property (_target_path ${_TARGET_NAME} OUTPUT_PATH)
You can’t perform that action at this time.
0 commit comments