File: fix_cmake_for_tests.patch

package info (click to toggle)
glbinding 3.3.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 12,972 kB
  • sloc: cpp: 224,461; javascript: 1,615; sh: 114; makefile: 98
file content (123 lines) | stat: -rw-r--r-- 4,292 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
From: Debian Science Maintainers
 <debian-science-maintainers@lists.alioth.debian.org>
Date: Thu, 16 Oct 2025 15:05:21 +0200
Subject: fix_cmake_for_tests

===================================================================
---
 CMakeLists.txt                             |  2 +-
 cmake/CompileOptions.cmake                 |  6 +-----
 cmake/Cppcheck.cmake                       |  1 -
 source/tests/CMakeLists.txt                | 17 +++++++++--------
 source/tests/glbinding-test/CMakeLists.txt |  7 ++++---
 5 files changed, 15 insertions(+), 18 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 940db32..6b76583 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,7 +4,7 @@
 # 
 
 # CMake version
-cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.10)
 
 
 #
diff --git a/cmake/CompileOptions.cmake b/cmake/CompileOptions.cmake
index fcce7f3..8062040 100644
--- a/cmake/CompileOptions.cmake
+++ b/cmake/CompileOptions.cmake
@@ -150,11 +150,7 @@ if ("${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" OR "${CMAKE_CXX_COMPILER_ID}" MATCH
         $<$<PLATFORM_ID:Darwin>:
             -pthread
         >
-        
-        # Required for CMake < 3.1; should be removed if minimum required CMake version is raised.
-        $<$<VERSION_LESS:${CMAKE_VERSION},3.1>:
-            -std=c++11
-        >
+
     )
 endif ()
 
diff --git a/cmake/Cppcheck.cmake b/cmake/Cppcheck.cmake
index 1f9ac05..71481a8 100644
--- a/cmake/Cppcheck.cmake
+++ b/cmake/Cppcheck.cmake
@@ -9,7 +9,6 @@ function(perform_cppcheck check_target target)
             ${cppcheck_EXECUTABLE}
                 "$<$<BOOL:${includes}>:-I$<JOIN:${includes},\t-I>>"
                 --enable=all
-                --std=c++11
                 --verbose
                 --suppress=missingIncludeSystem
                 ${ARGN}
diff --git a/source/tests/CMakeLists.txt b/source/tests/CMakeLists.txt
index 54fb5a5..d5c3b01 100644
--- a/source/tests/CMakeLists.txt
+++ b/source/tests/CMakeLists.txt
@@ -3,7 +3,7 @@
 # Configure test project and environment
 #
 
-cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
+cmake_minimum_required(VERSION 3.10)
 
 # Meta information about the project
 set(META_PROJECT_NAME "glbinding")
@@ -12,9 +12,9 @@ set(META_PROJECT_NAME "glbinding")
 project("${META_PROJECT_NAME}-tests" C CXX)
 
 # Set policies
-set_policy(CMP0054 NEW) # ENABLE  CMP0054: Only interpret if() arguments as variables or keywords when unquoted.
-set_policy(CMP0042 NEW) # ENABLE  CMP0042: MACOSX_RPATH is enabled by default.
-set_policy(CMP0063 NEW) # ENABLE  CMP0063: Honor visibility properties for all target types.
+cmake_policy(SET CMP0054 NEW) # ENABLE  CMP0054: Only interpret if() arguments as variables or keywords when unquoted.
+cmake_policy(SET CMP0042 NEW) # ENABLE  CMP0042: MACOSX_RPATH is enabled by default.
+cmake_policy(SET CMP0063 NEW) # ENABLE  CMP0063: Honor visibility properties for all target types.
 
 # Compiler settings and options
 
@@ -42,9 +42,10 @@ function(add_test_without_ctest target)
     )
 endfunction()
 
-find_package(googletest QUIET)
-
-if (NOT TARGET googletest::googletest)
+if (EXISTS "${CMAKE_SOURCE_DIR}/googletest/CMakeLists.txt")
+    message(STATUS "Using local googletest")
+    add_subdirectory(googletest)
+else ()
     message(STATUS "Tests skipped: googletest not found")
     return()
 endif ()
@@ -54,7 +55,7 @@ endif ()
 # 
 
 if (${CMAKE_VERSION} VERSION_LESS "3.11")
-    set_policy(CMP0037 OLD) # DISABLE CMP0037: Target names should be reserved and should match a validity pattern.
+    cmake_policy(CMP0037 OLD) # DISABLE CMP0037: Target names should be reserved and should match a validity pattern.
     add_custom_target(test)
     set_target_properties(test PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD 1)
 else ()
diff --git a/source/tests/glbinding-test/CMakeLists.txt b/source/tests/glbinding-test/CMakeLists.txt
index 4ca3cfe..eb5c444 100644
--- a/source/tests/glbinding-test/CMakeLists.txt
+++ b/source/tests/glbinding-test/CMakeLists.txt
@@ -84,9 +84,10 @@ target_link_libraries(${target}
     PRIVATE
     ${DEFAULT_LIBRARIES}
     glfw
-    ${META_PROJECT_NAME}::glbinding
-    ${META_PROJECT_NAME}::glbinding-aux
-    googletest::googletest
+    glbinding
+    glbinding-aux
+    gtest
+    gmock
 )