Skip to content

Commit e1e5e6c

Browse files
committed
[unittests] Enable debug info when compiling unittests when debug info is enabled.
I noticed this while I was debugging a failure in unittest.
1 parent bf685b4 commit e1e5e6c

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cmake/modules/AddSwiftUnittests.cmake

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,12 @@ function(add_swift_unittest test_dirname)
111111
endif()
112112
endif()
113113

114+
is_build_type_with_debuginfo("${CMAKE_BUILD_TYPE}" HAS_DEBUG_INFO)
115+
if (HAS_DEBUG_INFO)
116+
set_property(TARGET "${test_dirname}" APPEND_STRING PROPERTY COMPILE_FLAGS
117+
" -g ")
118+
endif()
119+
114120
file(RELATIVE_PATH relative_lib_path "${CMAKE_CURRENT_BINARY_DIR}" "${SWIFT_LIBRARY_OUTPUT_INTDIR}")
115121

116122
if(SWIFT_HOST_VARIANT_SDK IN_LIST SWIFT_DARWIN_PLATFORMS)

0 commit comments

Comments
 (0)