Fix always provide UT stub library
The "ut_osapi_stubs" library is mostly relevant for testing other
applications, as opposed to testing OSAL itself.  Therefore this library
should be provided regardless of whether OSAL is being tested.
@@ -203,13 +203,19 @@ add_definitions(${OSAL_USER_C_FLAGS})
#
# Build UT assert -
# the basic ut_assert library target is always defined regardless of "ENABLE_UNIT_TESTS",
-# but flagged using "EXCLUDE_FROM_ALL" so they won't be built unless actually used. This
-# is because the library is usable with functional tests, not just unit (coverage) tests.
+# This is because the library is usable with functional tests, not just unit (coverage) tests.
# This is done early, so that other targets may reference UT_ASSERT_SOURCE_DIR if needed
# Note that UT assert is only usable with an OSAL BSP implementation, thus this target
# cannot be compiled unless a specific BSP is selected.
add_subdirectory(ut_assert)
+# The "ut_osapi_stubs" library contains stub functions of the OSAL API calls, used for
+# testing _other_ application code that uses OSAL. Like UT Assert, this is also
+# provided independently of the local ENABLE_UNIT_TESTS switch, because it mainly affects
+# testing of other components. That is, even if OSAL itself is not being tested in this
+# build, a dependent application may still be built with testing enabled.
+add_subdirectory(src/ut-stubs ut-stubs)
+
#
# Step 1:
# Build the BSP layer
@@ -410,10 +416,6 @@ if (ENABLE_UNIT_TESTS)
endfunction(add_osal_ut_exe)
- # The "ut_osapi_stubs" library contains "stub" functions of the OSAL API calls, used for
- # testing other application code built on top of OSAL.
- add_subdirectory(src/ut-stubs ut-stubs)
-
# The "unit-test-coverage" is a white-box line coverage test.
# It re-compiles each source unit for coverage analysis and links
# with stub dependencies and a test sequence designed to execute
