From 1c31c92fd43f7edb9916b69a301288b642305ebb Mon Sep 17 00:00:00 2001
From: Schaich <alonso@freebsd.org>
Date: Tue, 23 Nov 2021 21:10:58 +0900
Subject: [PATCH] Enable the qt backend test on windows

The ```configuration``` is required by the visual studio generator to determine
whether to use a Debug or a Release setup (or a user customized one). It's
required by whatever uses that generator rather then just the GUI code.

Add instructions for the Visual Studio Project File generator to the README
and enable the test on Windows.
---
 backend/tests/README      | 18 +++++++++++++++++-
 backend_qt/CMakeLists.txt |  2 +-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/backend/tests/README b/backend/tests/README
index 48f4f7a5..2d689141 100644
--- a/backend/tests/README
+++ b/backend/tests/README
@@ -8,8 +8,18 @@ ZINT_TEST option enabled:
   mkdir build
   cd build
   cmake -DZINT_TEST=ON ..
-  make
+  cmake --build .
 
+When using generators that support multiple build configurations, such as
+Visual C++ Project Files (the default generator on win32), the configuration
+can be provided via --config:
+
+  cd <project-dir>
+  mkdir build
+  cd build
+  cmake -DZINT_TEST=ON ..
+  cmake --build . --config Debug
+  
 ------------------------------------------------------------------------------
 
 In order to run the test suite, the path of the zint library may need to be
@@ -29,6 +39,12 @@ To run all tests (within <build-dir>):
 
   ctest
 
+When using a generator that does support multiple build configurations, the
+configuration that was used to build the project has to be explicitly provided
+to ctest, even if it was the default one:
+
+  ctest -C Debug
+
 For various useful options, e.g. matching (-R) and excluding (-E) tests, see
 https://cmake.org/cmake/help/latest/manual/ctest.1.html#options
 
diff --git a/backend_qt/CMakeLists.txt b/backend_qt/CMakeLists.txt
index a4897c11..7053a399 100644
--- a/backend_qt/CMakeLists.txt
+++ b/backend_qt/CMakeLists.txt
@@ -21,7 +21,7 @@ target_include_directories(${PROJECT_NAME} PUBLIC "${CMAKE_SOURCE_DIR}/backend")
 
 target_link_libraries(${PROJECT_NAME} zint Qt${QT_VERSION_MAJOR}::Widgets Qt${QT_VERSION_MAJOR}::Gui)
 
-if(ZINT_TEST AND NOT WIN32) # Fails with "Test not available without configuration" on Windows so skip
+if(ZINT_TEST)
     add_subdirectory(tests)
 endif()