build: enable unit testing on release builds (#22554)

Unittests not working on release builds can lead to confusing
situations, such as contributors wondering why their tests aren't
working if they forgot they've built with a release build. This only
increased the Release executable size by 8 kB on my personal machine,
which is an acceptable tradeoff.
This commit is contained in:
dundargoc 2023-03-06 22:36:04 +01:00 committed by GitHub
parent 1cc23e1109
commit 6aa5346b04
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -626,8 +626,8 @@ if(PREFER_LUA)
message(STATUS "luajit not used, skipping unit tests")
else()
glob_wrapper(UNIT_TEST_FIXTURES ${PROJECT_SOURCE_DIR}/test/unit/fixtures/*.c)
target_sources(nvim PRIVATE $<$<CONFIG:Debug>:${UNIT_TEST_FIXTURES}>)
target_compile_definitions(nvim PRIVATE $<$<CONFIG:Debug>:UNIT_TESTING>)
target_sources(nvim PRIVATE ${UNIT_TEST_FIXTURES})
target_compile_definitions(nvim PRIVATE UNIT_TESTING)
endif()
target_sources(main_lib INTERFACE