summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/CMakeLists.txt5
-rw-r--r--Tests/RunCMake/FindGTK2/CMakeLists.txt3
-rw-r--r--Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake21
-rw-r--r--Tests/RunCMake/FindGTK2/RunCMakeTest.cmake3
4 files changed, 32 insertions, 0 deletions
diff --git a/Tests/RunCMake/CMakeLists.txt b/Tests/RunCMake/CMakeLists.txt
index 7e16d0e..c2c744f 100644
--- a/Tests/RunCMake/CMakeLists.txt
+++ b/Tests/RunCMake/CMakeLists.txt
@@ -255,6 +255,11 @@ if(PKG_CONFIG_FOUND)
add_RunCMake_test(FindPkgConfig)
endif()
+find_package(GTK2 QUIET)
+if (GTK2_FOUND)
+ add_RunCMake_test(FindGTK2)
+endif()
+
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio")
add_RunCMake_test(include_external_msproject)
if("${CMAKE_GENERATOR}" MATCHES "Visual Studio ([789]|10)" AND NOT CMAKE_VS_DEVENV_COMMAND)
diff --git a/Tests/RunCMake/FindGTK2/CMakeLists.txt b/Tests/RunCMake/FindGTK2/CMakeLists.txt
new file mode 100644
index 0000000..93ee9df
--- /dev/null
+++ b/Tests/RunCMake/FindGTK2/CMakeLists.txt
@@ -0,0 +1,3 @@
+cmake_minimum_required(VERSION 3.5)
+project(${RunCMake_TEST} NONE)
+include(${RunCMake_TEST}.cmake)
diff --git a/Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake b/Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake
new file mode 100644
index 0000000..e0585ee
--- /dev/null
+++ b/Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake
@@ -0,0 +1,21 @@
+cmake_minimum_required(VERSION 3.7)
+project(testFindGTK2 C)
+
+# First call
+find_package(GTK2 REQUIRED)
+
+# Backup variables
+set(GTK2_LIBRARIES_BAK ${GTK2_LIBRARIES})
+set(GTK2_TARGETS_BAK ${GTK2_TARGETS})
+
+# Second call
+find_package(GTK2 REQUIRED)
+
+# Check variables
+if(NOT "${GTK2_LIBRARIES_BAK}" STREQUAL "${GTK2_LIBRARIES}")
+ message(SEND_ERROR "GTK2_LIBRARIES is different:\nbefore: ${GTK2_LIBRARIES_BAK}\nafter: ${GTK2_LIBRARIES}")
+endif()
+
+if(NOT "${GTK2_TARGETS_BAK}" STREQUAL "${GTK2_TARGETS}")
+ message(SEND_ERROR "GTK2_TARGETS is different:\nbefore: ${GTK2_TARGETS_BAK}\nafter: ${GTK2_TARGETS}")
+endif()
diff --git a/Tests/RunCMake/FindGTK2/RunCMakeTest.cmake b/Tests/RunCMake/FindGTK2/RunCMakeTest.cmake
new file mode 100644
index 0000000..66364ca
--- /dev/null
+++ b/Tests/RunCMake/FindGTK2/RunCMakeTest.cmake
@@ -0,0 +1,3 @@
+include(RunCMake)
+
+run_cmake(FindGTK2RunTwice)