diff options
author | Daniele E. Domenichelli <ddomenichelli@drdanz.it> | 2017-01-25 09:19:00 (GMT) |
---|---|---|
committer | Daniele E. Domenichelli <ddomenichelli@drdanz.it> | 2017-01-25 09:20:35 (GMT) |
commit | 4bc2c16b5d01a66c00100171ad083e9ab5a6506c (patch) | |
tree | 5f00afe66f51f9833c852b86928ac7aed83d284c /Tests/RunCMake/FindGTK2 | |
parent | 9702b3eefd2baccd24eea9779e17da8fc143fa4c (diff) | |
download | CMake-4bc2c16b5d01a66c00100171ad083e9ab5a6506c.zip CMake-4bc2c16b5d01a66c00100171ad083e9ab5a6506c.tar.gz CMake-4bc2c16b5d01a66c00100171ad083e9ab5a6506c.tar.bz2 |
FindGTK2: Add unit test to check variables when run twice
Diffstat (limited to 'Tests/RunCMake/FindGTK2')
-rw-r--r-- | Tests/RunCMake/FindGTK2/CMakeLists.txt | 3 | ||||
-rw-r--r-- | Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake | 21 | ||||
-rw-r--r-- | Tests/RunCMake/FindGTK2/RunCMakeTest.cmake | 3 |
3 files changed, 27 insertions, 0 deletions
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) |