1 cmake_minimum_required (VERSION 2.6)
2 project(FindPackageTest)
4 list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR})
6 # Look for a package which uses FindPackageHandleStandardArgs.cmake with the
7 # new (as of cmake 2.8.3) syntax. This works only if CMP0017 is set to NEW,
8 # because otherwise FindPackageHandleStandardArgs.cmake from the current
9 # directory is included (via CMAKE_MODULE_PATH).
10 cmake_policy(SET CMP0017 NEW)
11 find_package(ZLIB QUIET)
13 # Look for a package that has a find module and may be found.
14 find_package(OpenGL QUIET)
16 # Look for a package that has no find module and will not be found.
17 find_package(NotAPackage QUIET)
19 # Look for a package that has an advanced find module.
20 find_package(VTK QUIET)
22 add_executable(FindPackageTest FindPackageTest.cxx)
24 # test behaviour of cmFindBase wrt. the CMAKE_PREFIX_PATH variable
25 # foo.h should be found in ${CMAKE_CURRENT_SOURCE_DIR}/include:
27 set(CMAKE_PREFIX_PATH /blub /blah "${CMAKE_CURRENT_SOURCE_DIR}")
28 find_path(FOO_DIR foo.h)
31 message(FATAL_ERROR "Did not find foo.h which is in ${CMAKE_CURRENT_SOURCE_DIR}/include
32 CMAKE_PREFIX_PATH = ${CMAKE_PREFIX_PATH}")
35 find_package(VersionTestA 1)
36 find_package(VersionTestB 1.2)
37 find_package(VersionTestC 1.2.3)
38 find_package(VersionTestD 1.2.3.4)
41 find_package(LotsOfComponents COMPONENTS AComp OPTIONAL_COMPONENTS BComp CComp)
42 if(NOT LOTSOFCOMPONENTS_FOUND)
43 message(SEND_ERROR "LotsOfComponents not found !")
46 find_package(SomePackage)
47 if(NOT SomePackage_FOUND)
48 message(SEND_ERROR "SomePackage with FOUND_VAR SomePackage_FOUND not found !")
51 find_package(UpperCasePackage)
52 if(NOT UPPERCASEPACKAGE_FOUND)
53 message(SEND_ERROR "UpperCasePackage with FOUND_VAR UPPERCASEPACKAGE_FOUND not found !")
56 #-----------------------------------------------------------------------------
57 # Test system package registry if possible.
58 set(CMakeTestSystemPackage "")
59 if(WIN32 AND NOT CYGWIN)
60 # Try writing a value to the system package registry.
61 set(_data "${FindPackageTest_SOURCE_DIR}/SystemPackage")
62 set(_key "HKLM\\Software\\Kitware\\CMake\\Packages\\CMakeTestSystemPackage")
63 set(_file "${FindPackageTest_BINARY_DIR}/CMakeTestSystemPackage.data")
64 file(WRITE ${_file} "${_data}\n")
66 COMMAND ${CMAKE_COMMAND} -E md5sum ${_file}
67 OUTPUT_VARIABLE _output ERROR_VARIABLE _error RESULT_VARIABLE _failed
68 OUTPUT_STRIP_TRAILING_WHITESPACE
70 string(REGEX REPLACE " .*" "" _value "${_output}")
71 if(NOT _failed AND _value)
73 COMMAND reg add "${_key}" /v "${_value}" /t REG_SZ /d "${_data}" /f
74 OUTPUT_VARIABLE _output ERROR_VARIABLE _output RESULT_VARIABLE _failed
77 # If the above worked, add the rest of the test and a rule to
80 message(STATUS "HKLM is writable: enabling CMakeTestSystemPackage")
81 set(CMakeTestSystemPackage_CLEANUP reg delete "${_key}" /v "${_value}" /f)
82 set(CMakeTestSystemPackage CMakeTestSystemPackage)
84 message(STATUS "HKLM is readonly: disabling CMakeTestSystemPackage")
88 #-----------------------------------------------------------------------------
90 #set(CMAKE_FIND_DEBUG_MODE 1)
92 # For purposes of the test wipe out previous find results.
94 foo Foo Bar Blub TFramework Tframework TApp Tapp Special
95 VersionedA VersionedB VersionedC VersionedD VersionedE
96 WrongA WrongB WrongC WrongD
98 RecursiveA RecursiveB RecursiveC
99 ArchA ArchB ArchC ArchD
101 SetFoundTRUE SetFoundFALSE
102 ${CMakeTestSystemPackage}
104 foreach(p ${PACKAGES})
105 set(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
108 # Enable framework and bundle searching. Make sure bundles are found
109 # before unix-syle packages.
110 set(CMAKE_FIND_FRAMEWORK LAST)
111 set(CMAKE_FIND_APPBUNDLE FIRST)
113 # Set the wrong answer for a find to make sure it re-finds.
114 set(VersionedA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-4.0)
116 # Test that CMAKE_IGNORE_PATH can ignore the purposely bad package
117 # files in the lib/cmake/zot-3.1 directory.
118 set(CMAKE_IGNORE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-3.1)
120 # Look for packages with new-style signatures.
121 find_package(foo NO_MODULE)
122 find_package(Foo CONFIGS FooConfig.cmake)
124 set(CMAKE_DISABLE_FIND_PACKAGE_Blub TRUE)
125 find_package(Blub NO_MODULE)
126 find_package(TFramework CONFIGS TFrameworkConfig.cmake)
127 find_package(Tframework)
129 find_package(Tapp CONFIGS tapp-config.cmake)
130 find_package(Special NAMES Suffix SuffixTest PATH_SUFFIXES test)
131 find_package(VersionedA 2 NAMES zot)
132 find_package(VersionedB 3.1 EXACT NAMES zot)
133 find_package(VersionedC 4.0 EXACT NAMES zot)
134 find_package(VersionedD 1.1 EXACT NAMES Baz)
135 find_package(VersionedE 1.2 EXACT NAMES Baz)
137 # Test Config files which set Xyz_FOUND themselves:
138 find_package(SetFoundTRUE NO_MODULE)
139 find_package(SetFoundFALSE NO_MODULE)
141 # Test wrong initial path when result is present.
142 set(WrongA_DIR "${VersionedD_DIR}")
143 find_package(WrongA 1.2 EXACT NAMES Baz)
145 # Test wrong initial cache entry of UNINITIALIZED type when result is present.
146 set(WrongB_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
147 get_property(type CACHE WrongB_DIR PROPERTY TYPE)
148 find_package(WrongB 1.2 EXACT NAMES Baz)
150 # Test wrong initial path when result is missing.
151 set(WrongC_DIR "${VersionedD_DIR}")
152 find_package(WrongC 1.3 EXACT QUIET NAMES Baz)
154 # Test wrong initial cache entry of UNINITIALIZED type when result is missing.
155 set(WrongD_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
156 get_property(type CACHE WrongD_DIR PROPERTY TYPE)
157 find_package(WrongD 1.3 EXACT QUIET NAMES Baz)
159 # HINTS should override the system but PATHS should not
160 list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A")
161 find_package(wibbleA NAMES wibble PATHS B)
162 find_package(wibbleB NAMES wibble HINTS B)
164 # Look for package with recursive find-modules.
165 find_package(RecursiveA COMPONENTS A)
166 find_package(RecursiveB 2)
167 find_package(RecursiveC 3.1 EXACT)
169 # Test architecture-specific search directories.
170 set(CMAKE_LIBRARY_ARCHITECTURE arch)
171 find_package(ArchA NAMES Bar)
172 find_package(ArchB NAMES Foo CONFIGS FooConfig.cmake)
173 find_package(ArchC 3.1 EXACT NAMES zot)
174 find_package(ArchD 4.0 EXACT NAMES zot)
175 unset(CMAKE_LIBRARY_ARCHITECTURE)
177 # Test <Package>_DIR environment variable.
178 # We erase the main prefix path to ensure the env var is used.
179 set(CMAKE_PREFIX_PATH)
180 set(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1")
181 find_package(EnvA 3.1 EXACT QUIET NAMES zot) # Should Work
182 find_package(EnvB 3.1 EXACT QUIET NAMES zot) # Should Fail
184 # Test system package registry if available.
185 if(CMakeTestSystemPackage)
186 find_package(CMakeTestSystemPackage)
187 execute_process(COMMAND ${CMakeTestSystemPackage_CLEANUP}
188 OUTPUT_VARIABLE _output ERROR_VARIABLE _error)
191 # Expected locations at which packages should be found.
192 set(foo_EXPECTED "lib/foo-1.2/foo-config.cmake")
193 set(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake")
194 set(Bar_EXPECTED "lib/Bar/BarConfig.cmake")
196 set(Special_EXPECTED "lib/suffix/test/SuffixTestConfig.cmake")
197 set(TFramework_EXPECTED
198 "TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake")
199 set(Tframework_EXPECTED
200 "TFramework.framework/Versions/A/Resources/tframework-config.cmake")
202 "TApp.app/Contents/Resources/TAppConfig.cmake")
204 "TApp.app/Contents/Resources/cmake/tapp-config.cmake")
205 set(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake")
206 set(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake")
207 set(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake")
208 set(VersionedD_EXPECTED "Baz 1.1/BazConfig.cmake")
209 set(VersionedE_EXPECTED "Baz 1.2/CMake/BazConfig.cmake")
210 set(WrongA_EXPECTED "${VersionedE_EXPECTED}")
211 set(WrongB_EXPECTED "${VersionedE_EXPECTED}")
212 set(WrongC_MISSING "WrongC_DIR-NOTFOUND")
213 set(WrongD_MISSING "WrongD_DIR-NOTFOUND")
214 set(wibbleA_EXPECTED "A/wibble-config.cmake")
215 set(wibbleB_EXPECTED "B/wibble-config.cmake")
216 set(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake")
217 set(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake")
218 set(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake")
219 set(ArchA_EXPECTED "lib/arch/Bar/BarConfig.cmake")
220 set(ArchB_EXPECTED "lib/arch/foo-1.2/CMake/FooConfig.cmake")
221 set(ArchC_EXPECTED "lib/arch/zot-3.1/zot-config.cmake")
222 set(ArchD_EXPECTED "lib/arch/cmake/zot-4.0/zot-config.cmake")
223 set(EnvA_EXPECTED "lib/zot-3.1/zot-config.cmake")
224 set(EnvB_MISSING "EnvB_DIR-NOTFOUND")
225 set(SetFoundTRUE_EXPECTED "cmake/SetFoundTRUEConfig.cmake")
226 set(SetFoundFALSE_MISSING "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
227 set(CMakeTestSystemPackage_EXPECTED "SystemPackage/CMakeTestSystemPackageConfig.cmake")
230 foreach(p ${PACKAGES})
231 if(DEFINED ${p}_MISSING)
232 # Check and report failure.
233 if(NOT "${${p}_DIR}" STREQUAL "${${p}_MISSING}")
235 "Package ${p} should have been [${${p}_MISSING}] but "
240 "Package ${p} should not have been found, but ${p}_FOUND is set to "
244 # Convert to relative path for comparison to expected location.
245 file(RELATIVE_PATH REL_${p}_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}"
249 if(CMAKE_FIND_DEBUG_MODE)
250 message("Package ${p} found [${REL_${p}_CONFIG}]")
253 # Check and report failure.
254 if(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}")
256 "Package ${p} should have been [${${p}_EXPECTED}] but "
257 "was [${REL_${p}_CONFIG}]")
260 message(SEND_ERROR "Package ${p} not found!")
264 # Check that version information was extracted.
265 if(NOT "${VersionedA_VERSION}" STREQUAL "2.0")
267 "Package VersionedA is version [${VersionedA_VERSION}], not [2.0]")
269 if(NOT "${VersionedA_VERSION_MAJOR}" STREQUAL "2")
271 "Package VersionedA is major version [${VersionedA_VERSION_MAJOR}], not [2]")
273 if(NOT "${VersionedA_VERSION_MINOR}" STREQUAL "0")
275 "Package VersionedA is minor version [${VersionedA_VERSION_MINOR}], not [0]")
278 if(NOT "${VersionedB_VERSION}" STREQUAL "3.1")
280 "Package VersionedB is version [${VersionedB_VERSION}], not [3.1]")
282 if(NOT "${VersionedB_VERSION_MAJOR}" STREQUAL "3")
284 "Package VersionedB is major version [${VersionedB_VERSION_MAJOR}], not [3]")
286 if(NOT "${VersionedB_VERSION_MINOR}" STREQUAL "1")
288 "Package VersionedB is minor version [${VersionedB_VERSION_MINOR}], not [1]")
291 if(NOT "${Special_VERSION}" STREQUAL "1.2")
293 "Package Special is version [${Special_VERSION}], not [1.2]")
295 if(NOT "${Special_VERSION_MAJOR}" STREQUAL "1")
297 "Package Special is major version [${Special_VERSION_MAJOR}], not [1]")
299 if(NOT "${Special_VERSION_MINOR}" STREQUAL "2")
301 "Package Special is minor version [${Special_VERSION_MINOR}], not [2]")
304 # Test version number comparison.
305 if(NOT "1.2.3.4" VERSION_LESS "1.2.3.5")
306 message(SEND_ERROR "1.2.3.4 VERSION_LESS 1.2.3.5 is not true!")
308 if(NOT "1.2" VERSION_LESS "1.10")
309 message(SEND_ERROR "1.2 VERSION_LESS 1.10 is not true!")
311 if(NOT "1.02" VERSION_GREATER "1.1")
312 message(SEND_ERROR "1.02 VERSION_GREATER 1.1 is not true!")
314 if("1.2.3" VERSION_GREATER "1.2.3.4")
315 message(SEND_ERROR "1.2.3 VERSION_GREATER 1.2.3.4 is not false!")
317 if(NOT "1.2" VERSION_EQUAL "1.2.0.0")
318 message(SEND_ERROR "1.2 VERSION_EQUAL 1.2.0.0 is not true!")
321 #-----------------------------------------------------------------------------
322 # Test export(PACKAGE) with find_package.
323 message(STATUS "Preparing export(PACKAGE) test project")
324 try_compile(EXPORTER_COMPILED
325 ${FindPackageTest_BINARY_DIR}/Exporter
326 ${FindPackageTest_SOURCE_DIR}/Exporter
327 CMakeTestExportPackage dummy
328 OUTPUT_VARIABLE output)
329 message(STATUS "Searching for export(PACKAGE) test project")
330 set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
331 "Wipe out find results for testing." FORCE)
332 string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
333 find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
335 #-----------------------------------------------------------------------------
336 # Test configure_package_config_file().
338 include(CMakePackageConfigHelpers)
340 set(INCLUDE_INSTALL_DIR include )
341 set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" )
342 set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
344 configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake"
345 INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
346 PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
349 set(Relocatable_FIND_COMPONENTS AComp BComp CComp)
350 set(Relocatable_FIND_REQUIRED_BComp 1)
351 include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake")
353 if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include")
354 message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to \"${RELOC_INCLUDE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/include\")")
357 if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/")
358 message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to \"${RELOC_SHARE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/share/\")")
361 if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
362 message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to \"${RELOC_BUILD_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}\")")
365 if(NOT DEFINED Relocatable_FOUND)
366 message(SEND_ERROR "Relocatable_FOUND not defined !")
369 if(Relocatable_FOUND)
370 message(SEND_ERROR "Relocatable_FOUND set to TRUE !")
373 #-----------------------------------------------------------------------------
374 # Test write_basic_config_version_file().
376 # also test that an empty CMAKE_SIZEOF_VOID_P is accepted:
377 set(_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
378 set(CMAKE_SIZEOF_VOID_P "")
380 write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake
382 COMPATIBILITY AnyNewerVersion)
384 set(CMAKE_SIZEOF_VOID_P ${_CMAKE_SIZEOF_VOID_P})
386 set(PACKAGE_FIND_VERSION 2.3.4)
387 include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
388 if(PACKAGE_VERSION_COMPATIBLE)
389 message(SEND_ERROR "Found Foo123 with version 1.2.3, but 2.3.4 was requested !")
392 set(PACKAGE_FIND_VERSION 0.0.1)
393 include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
394 if(NOT PACKAGE_VERSION_COMPATIBLE)
395 message(SEND_ERROR "Did not find Foo123 with version 1.2.3 (0.0.1 was requested) !")
398 if(PACKAGE_VERSION_UNSUITABLE)
399 message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
402 set(PACKAGE_FIND_VERSION 1.0.0)
403 include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
404 if(NOT PACKAGE_VERSION_COMPATIBLE)
405 message(SEND_ERROR "Did not find Foo123 with version 1.2.3 (1.0.0 was requested) !")
407 if(PACKAGE_VERSION_EXACT)
408 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
411 set(PACKAGE_FIND_VERSION 1.2.3)
412 include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
413 if(NOT PACKAGE_VERSION_COMPATIBLE)
414 message(SEND_ERROR "Did not find Foo123 with version 1.2.3 (1.2.3 was requested) !")
416 if(NOT PACKAGE_VERSION_EXACT)
417 message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
421 #######################
422 include(WriteBasicConfigVersionFile)
424 write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake
426 COMPATIBILITY SameMajorVersion)
428 unset(PACKAGE_VERSION_UNSUITABLE)
429 set(PACKAGE_VERSION_EXACT FALSE)
430 set(PACKAGE_FIND_VERSION 2.3.4)
431 set(PACKAGE_FIND_VERSION_MAJOR 2)
432 include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
433 if(PACKAGE_VERSION_COMPATIBLE)
434 message(SEND_ERROR "Found Boo123 with version 1.2.3, but 2.3.4 was requested !")
436 if(PACKAGE_VERSION_EXACT)
437 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
440 set(PACKAGE_FIND_VERSION 0.0.1)
441 set(PACKAGE_FIND_VERSION_MAJOR 0)
442 include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
443 if(PACKAGE_VERSION_COMPATIBLE)
444 message(SEND_ERROR "Found Boo123 with version 1.2.3, but 0.0.1 was requested !")
446 if(PACKAGE_VERSION_EXACT)
447 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
450 set(PACKAGE_FIND_VERSION 1.0.0)
451 set(PACKAGE_FIND_VERSION_MAJOR 1)
452 include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
453 if(NOT PACKAGE_VERSION_COMPATIBLE)
454 message(SEND_ERROR "Did not find Boo123 with version 1.2.3 (1.0.0 was requested) !")
456 if(PACKAGE_VERSION_EXACT)
457 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
460 set(PACKAGE_FIND_VERSION 1.2.3)
461 set(PACKAGE_FIND_VERSION_MAJOR 1)
462 include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
463 if(NOT PACKAGE_VERSION_COMPATIBLE)
464 message(SEND_ERROR "Did not find Boo123 with version 1.2.3 (1.2.3 was requested) !")
466 if(NOT PACKAGE_VERSION_EXACT)
467 message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
470 if(PACKAGE_VERSION_UNSUITABLE)
471 message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
474 #######################
476 write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake
478 COMPATIBILITY ExactVersion)
480 unset(PACKAGE_VERSION_UNSUITABLE)
481 set(PACKAGE_VERSION_EXACT FALSE)
482 set(PACKAGE_FIND_VERSION 2.3.4)
483 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
484 if(PACKAGE_VERSION_COMPATIBLE)
485 message(SEND_ERROR "Found Bar123 with version 1.2.3 (2.3.4 was requested) !")
487 if(PACKAGE_VERSION_EXACT)
488 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
491 set(PACKAGE_FIND_VERSION 1.2)
492 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
493 if(PACKAGE_VERSION_COMPATIBLE)
494 message(SEND_ERROR "Found Bar123 with version 1.2.3 (1.2 was requested) !")
496 if(PACKAGE_VERSION_EXACT)
497 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
500 set(PACKAGE_FIND_VERSION 1)
501 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
502 if(PACKAGE_VERSION_COMPATIBLE)
503 message(SEND_ERROR "Found Bar123 with version 1.2.3 (1 was requested) !")
505 if(PACKAGE_VERSION_EXACT)
506 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
509 set(PACKAGE_FIND_VERSION 1.2.3.4)
510 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
511 if(NOT PACKAGE_VERSION_COMPATIBLE)
512 message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.4 was requested) !")
514 if(PACKAGE_VERSION_EXACT)
515 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
518 set(PACKAGE_FIND_VERSION 1.2.3)
519 set(PACKAGE_VERSION_EXACT FALSE)
520 set(PACKAGE_VERSION_COMPATIBLE FALSE)
521 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
522 if(NOT PACKAGE_VERSION_COMPATIBLE)
523 message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3 was requested) !")
525 if(PACKAGE_VERSION_EXACT)
526 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
530 set(PACKAGE_FIND_VERSION 1.2.3.17)
531 set(PACKAGE_VERSION_EXACT FALSE)
532 set(PACKAGE_VERSION_COMPATIBLE FALSE)
533 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
534 if(NOT PACKAGE_VERSION_COMPATIBLE)
535 message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.17 was requested) !")
537 if(NOT PACKAGE_VERSION_EXACT)
538 message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
541 if(PACKAGE_VERSION_UNSUITABLE)
542 message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")