CMake: add the custom buildtests target only once

Make BUILDTESTS_ADDED a global property, so the `buildtests` target gets added only once. As far as I understood, this seems to fulfil the requirements of CMP0002.

Bug #103003
diff --git a/cmake/modules/PopplerMacros.cmake b/cmake/modules/PopplerMacros.cmake
index aa5ca6d..ccb2790 100644
--- a/cmake/modules/PopplerMacros.cmake
+++ b/cmake/modules/PopplerMacros.cmake
@@ -13,10 +13,10 @@
 
   # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
   if(NOT build_test AND NOT MSVC_IDE)
-    get_directory_property(_buildtestsAdded BUILDTESTS_ADDED)
+    get_property(_buildtestsAdded GLOBAL PROPERTY BUILDTESTS_ADDED)
     if(NOT _buildtestsAdded)
       add_custom_target(buildtests)
-      set_directory_properties(PROPERTIES BUILDTESTS_ADDED TRUE)
+      set_property(GLOBAL PROPERTY BUILDTESTS_ADDED TRUE)
     endif(NOT _buildtestsAdded)
     add_dependencies(buildtests ${exe})
   endif(NOT build_test AND NOT MSVC_IDE)
@@ -33,10 +33,10 @@
 
   # if the tests are EXCLUDE_FROM_ALL, add a target "buildtests" to build all tests
   if(NOT build_test)
-    get_directory_property(_buildtestsAdded BUILDTESTS_ADDED)
+    get_property(_buildtestsAdded GLOBAL PROPERTY BUILDTESTS_ADDED)
     if(NOT _buildtestsAdded)
       add_custom_target(buildtests)
-      set_directory_properties(PROPERTIES BUILDTESTS_ADDED TRUE)
+      set_property(GLOBAL PROPERTY BUILDTESTS_ADDED TRUE)
     endif(NOT _buildtestsAdded)
     add_dependencies(buildtests ${exe})
   endif(NOT build_test)