MSVC: tests: link with all the compat libraries

This dance only has to be done because tests link against `yangobj`
instead of simply using `-lyang` for linking against the library. I
wonder why it's done like that.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index dd29a32..ea4b625 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -367,7 +367,8 @@
     include_directories(${COMPAT_POSIX_INCLUDES})
 
     find_package(pthreads REQUIRED)
-    target_link_libraries(yang PThreads4W::PThreads4W shlwapi.lib)
+    set(COMPAT_WIN_LIBRARIES PThreads4W::PThreads4W shlwapi.lib)
+    target_link_libraries(yang ${COMPAT_WIN_LIBRARIES})
 endif()
 
 set_target_properties(yang PROPERTIES VERSION ${LIBYANG_SOVERSION_FULL} SOVERSION ${LIBYANG_SOVERSION})
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 8f3a34d..c1fe852 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -20,6 +20,8 @@
     target_link_libraries(${TEST_NAME} ${CMOCKA_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT} ${PCRE2_LIBRARIES} ${CMAKE_DL_LIBS})
     if (NOT WIN32)
         target_link_libraries(${TEST_NAME} m)
+    else()
+        target_link_libraries(${TEST_NAME} ${COMPAT_WIN_LIBRARIES})
     endif()
     if (NOT APPLE)
         if (ADDTEST_WRAP)