mirror of
https://github.com/reactos/CMake.git
synced 2024-11-24 03:59:58 +00:00
FindGTK2: Add unit test to check variables when run twice
This commit is contained in:
parent
9702b3eefd
commit
4bc2c16b5d
@ -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)
|
||||
|
3
Tests/RunCMake/FindGTK2/CMakeLists.txt
Normal file
3
Tests/RunCMake/FindGTK2/CMakeLists.txt
Normal file
@ -0,0 +1,3 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
project(${RunCMake_TEST} NONE)
|
||||
include(${RunCMake_TEST}.cmake)
|
21
Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake
Normal file
21
Tests/RunCMake/FindGTK2/FindGTK2RunTwice.cmake
Normal file
@ -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()
|
3
Tests/RunCMake/FindGTK2/RunCMakeTest.cmake
Normal file
3
Tests/RunCMake/FindGTK2/RunCMakeTest.cmake
Normal file
@ -0,0 +1,3 @@
|
||||
include(RunCMake)
|
||||
|
||||
run_cmake(FindGTK2RunTwice)
|
Loading…
Reference in New Issue
Block a user