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 #-----------------------------------------------------------------------------
47 # Test system package registry if possible.
48 set(CMakeTestSystemPackage "")
49 if(WIN32 AND NOT CYGWIN)
50 # Try writing a value to the system package registry.
51 set(_data "${FindPackageTest_SOURCE_DIR}/SystemPackage")
52 set(_key "HKLM\\Software\\Kitware\\CMake\\Packages\\CMakeTestSystemPackage")
53 set(_file "${FindPackageTest_BINARY_DIR}/CMakeTestSystemPackage.data")
54 file(WRITE ${_file} "${_data}\n")
56 COMMAND ${CMAKE_COMMAND} -E md5sum ${_file}
57 OUTPUT_VARIABLE _output ERROR_VARIABLE _error RESULT_VARIABLE _failed
58 OUTPUT_STRIP_TRAILING_WHITESPACE
60 string(REGEX REPLACE " .*" "" _value "${_output}")
61 if(NOT _failed AND _value)
63 COMMAND reg add "${_key}" /v "${_value}" /t REG_SZ /d "${_data}" /f
64 OUTPUT_VARIABLE _output ERROR_VARIABLE _output RESULT_VARIABLE _failed
67 # If the above worked, add the rest of the test and a rule to
70 message(STATUS "HKLM is writable: enabling CMakeTestSystemPackage")
71 set(CMakeTestSystemPackage_CLEANUP reg delete "${_key}" /v "${_value}" /f)
72 set(CMakeTestSystemPackage CMakeTestSystemPackage)
74 message(STATUS "HKLM is readonly: disabling CMakeTestSystemPackage")
78 #-----------------------------------------------------------------------------
80 #set(CMAKE_FIND_DEBUG_MODE 1)
82 # For purposes of the test wipe out previous find results.
84 foo Foo Bar Blub TFramework Tframework TApp Tapp Special
85 VersionedA VersionedB VersionedC VersionedD VersionedE
86 WrongA WrongB WrongC WrongD
88 RecursiveA RecursiveB RecursiveC
89 ArchA ArchB ArchC ArchD
91 SetFoundTRUE SetFoundFALSE
92 ${CMakeTestSystemPackage}
94 foreach(p ${PACKAGES})
95 set(${p}_DIR "" CACHE FILEPATH "Wipe out find results for testing." FORCE)
98 # Enable framework and bundle searching. Make sure bundles are found
99 # before unix-syle packages.
100 set(CMAKE_FIND_FRAMEWORK LAST)
101 set(CMAKE_FIND_APPBUNDLE FIRST)
103 # Set the wrong answer for a find to make sure it re-finds.
104 set(VersionedA_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-4.0)
106 # Test that CMAKE_IGNORE_PATH can ignore the purposely bad package
107 # files in the lib/cmake/zot-3.1 directory.
108 set(CMAKE_IGNORE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/lib/cmake/zot-3.1)
110 # Look for packages with new-style signatures.
111 find_package(foo NO_MODULE)
112 find_package(Foo CONFIGS FooConfig.cmake)
114 set(CMAKE_DISABLE_FIND_PACKAGE_Blub TRUE)
115 find_package(Blub NO_MODULE)
116 find_package(TFramework CONFIGS TFrameworkConfig.cmake)
117 find_package(Tframework)
119 find_package(Tapp CONFIGS tapp-config.cmake)
120 find_package(Special NAMES Suffix SuffixTest PATH_SUFFIXES test)
121 find_package(VersionedA 2 NAMES zot)
122 find_package(VersionedB 3.1 EXACT NAMES zot)
123 find_package(VersionedC 4.0 EXACT NAMES zot)
124 find_package(VersionedD 1.1 EXACT NAMES Baz)
125 find_package(VersionedE 1.2 EXACT NAMES Baz)
127 # Test Config files which set Xyz_FOUND themselves:
128 find_package(SetFoundTRUE NO_MODULE)
129 find_package(SetFoundFALSE NO_MODULE)
131 # Test wrong initial path when result is present.
132 set(WrongA_DIR "${VersionedD_DIR}")
133 find_package(WrongA 1.2 EXACT NAMES Baz)
135 # Test wrong initial cache entry of UNINITIALIZED type when result is present.
136 set(WrongB_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
137 get_property(type CACHE WrongB_DIR PROPERTY TYPE)
138 find_package(WrongB 1.2 EXACT NAMES Baz)
140 # Test wrong initial path when result is missing.
141 set(WrongC_DIR "${VersionedD_DIR}")
142 find_package(WrongC 1.3 EXACT QUIET NAMES Baz)
144 # Test wrong initial cache entry of UNINITIALIZED type when result is missing.
145 set(WrongD_DIR "${VersionedD_DIR}" CACHE UNINITIALIZED "Wrong Value" FORCE)
146 get_property(type CACHE WrongD_DIR PROPERTY TYPE)
147 find_package(WrongD 1.3 EXACT QUIET NAMES Baz)
149 # HINTS should override the system but PATHS should not
150 list(INSERT CMAKE_SYSTEM_PREFIX_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/A")
151 find_package(wibbleA NAMES wibble PATHS B)
152 find_package(wibbleB NAMES wibble HINTS B)
154 # Look for package with recursive find-modules.
155 find_package(RecursiveA COMPONENTS A)
156 find_package(RecursiveB 2)
157 find_package(RecursiveC 3.1 EXACT)
159 # Test architecture-specific search directories.
160 set(CMAKE_LIBRARY_ARCHITECTURE arch)
161 find_package(ArchA NAMES Bar)
162 find_package(ArchB NAMES Foo CONFIGS FooConfig.cmake)
163 find_package(ArchC 3.1 EXACT NAMES zot)
164 find_package(ArchD 4.0 EXACT NAMES zot)
165 unset(CMAKE_LIBRARY_ARCHITECTURE)
167 # Test <Package>_DIR environment variable.
168 # We erase the main prefix path to ensure the env var is used.
169 set(CMAKE_PREFIX_PATH)
170 set(ENV{EnvA_DIR} "${CMAKE_CURRENT_SOURCE_DIR}/lib/zot-3.1")
171 find_package(EnvA 3.1 EXACT QUIET NAMES zot) # Should Work
172 find_package(EnvB 3.1 EXACT QUIET NAMES zot) # Should Fail
174 # Test system package registry if available.
175 if(CMakeTestSystemPackage)
176 find_package(CMakeTestSystemPackage)
177 execute_process(COMMAND ${CMakeTestSystemPackage_CLEANUP}
178 OUTPUT_VARIABLE _output ERROR_VARIABLE _error)
181 # Expected locations at which packages should be found.
182 set(foo_EXPECTED "lib/foo-1.2/foo-config.cmake")
183 set(Foo_EXPECTED "lib/foo-1.2/CMake/FooConfig.cmake")
184 set(Bar_EXPECTED "lib/Bar/BarConfig.cmake")
186 set(Special_EXPECTED "lib/suffix/test/SuffixTestConfig.cmake")
187 set(TFramework_EXPECTED
188 "TFramework.framework/Versions/A/Resources/CMake/TFrameworkConfig.cmake")
189 set(Tframework_EXPECTED
190 "TFramework.framework/Versions/A/Resources/tframework-config.cmake")
192 "TApp.app/Contents/Resources/TAppConfig.cmake")
194 "TApp.app/Contents/Resources/cmake/tapp-config.cmake")
195 set(VersionedA_EXPECTED "lib/zot-2.0/zot-config.cmake")
196 set(VersionedB_EXPECTED "lib/zot-3.1/zot-config.cmake")
197 set(VersionedC_EXPECTED "lib/cmake/zot-4.0/zot-config.cmake")
198 set(VersionedD_EXPECTED "Baz 1.1/BazConfig.cmake")
199 set(VersionedE_EXPECTED "Baz 1.2/CMake/BazConfig.cmake")
200 set(WrongA_EXPECTED "${VersionedE_EXPECTED}")
201 set(WrongB_EXPECTED "${VersionedE_EXPECTED}")
202 set(WrongC_MISSING "WrongC_DIR-NOTFOUND")
203 set(WrongD_MISSING "WrongD_DIR-NOTFOUND")
204 set(wibbleA_EXPECTED "A/wibble-config.cmake")
205 set(wibbleB_EXPECTED "B/wibble-config.cmake")
206 set(RecursiveA_EXPECTED "lib/RecursiveA/recursivea-config.cmake")
207 set(RecursiveB_EXPECTED "lib/zot-2.0/zot-config.cmake")
208 set(RecursiveC_EXPECTED "lib/zot-3.1/zot-config.cmake")
209 set(ArchA_EXPECTED "lib/arch/Bar/BarConfig.cmake")
210 set(ArchB_EXPECTED "lib/arch/foo-1.2/CMake/FooConfig.cmake")
211 set(ArchC_EXPECTED "lib/arch/zot-3.1/zot-config.cmake")
212 set(ArchD_EXPECTED "lib/arch/cmake/zot-4.0/zot-config.cmake")
213 set(EnvA_EXPECTED "lib/zot-3.1/zot-config.cmake")
214 set(EnvB_MISSING "EnvB_DIR-NOTFOUND")
215 set(SetFoundTRUE_EXPECTED "cmake/SetFoundTRUEConfig.cmake")
216 set(SetFoundFALSE_MISSING "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
217 set(CMakeTestSystemPackage_EXPECTED "SystemPackage/CMakeTestSystemPackageConfig.cmake")
220 foreach(p ${PACKAGES})
221 if(DEFINED ${p}_MISSING)
222 # Check and report failure.
223 if(NOT "${${p}_DIR}" STREQUAL "${${p}_MISSING}")
225 "Package ${p} should have been [${${p}_MISSING}] but "
230 "Package ${p} should not have been found, but ${p}_FOUND is set to "
234 # Convert to relative path for comparison to expected location.
235 file(RELATIVE_PATH REL_${p}_CONFIG "${CMAKE_CURRENT_SOURCE_DIR}"
239 if(CMAKE_FIND_DEBUG_MODE)
240 message("Package ${p} found [${REL_${p}_CONFIG}]")
243 # Check and report failure.
244 if(NOT "${REL_${p}_CONFIG}" STREQUAL "${${p}_EXPECTED}")
246 "Package ${p} should have been [${${p}_EXPECTED}] but "
247 "was [${REL_${p}_CONFIG}]")
250 message(SEND_ERROR "Package ${p} not found!")
254 # Check that version information was extracted.
255 if(NOT "${VersionedA_VERSION}" STREQUAL "2.0")
257 "Package VersionedA is version [${VersionedA_VERSION}], not [2.0]")
259 if(NOT "${VersionedA_VERSION_MAJOR}" STREQUAL "2")
261 "Package VersionedA is major version [${VersionedA_VERSION_MAJOR}], not [2]")
263 if(NOT "${VersionedA_VERSION_MINOR}" STREQUAL "0")
265 "Package VersionedA is minor version [${VersionedA_VERSION_MINOR}], not [0]")
268 if(NOT "${VersionedB_VERSION}" STREQUAL "3.1")
270 "Package VersionedB is version [${VersionedB_VERSION}], not [3.1]")
272 if(NOT "${VersionedB_VERSION_MAJOR}" STREQUAL "3")
274 "Package VersionedB is major version [${VersionedB_VERSION_MAJOR}], not [3]")
276 if(NOT "${VersionedB_VERSION_MINOR}" STREQUAL "1")
278 "Package VersionedB is minor version [${VersionedB_VERSION_MINOR}], not [1]")
281 if(NOT "${Special_VERSION}" STREQUAL "1.2")
283 "Package Special is version [${Special_VERSION}], not [1.2]")
285 if(NOT "${Special_VERSION_MAJOR}" STREQUAL "1")
287 "Package Special is major version [${Special_VERSION_MAJOR}], not [1]")
289 if(NOT "${Special_VERSION_MINOR}" STREQUAL "2")
291 "Package Special is minor version [${Special_VERSION_MINOR}], not [2]")
294 # Test version number comparison.
295 if(NOT "1.2.3.4" VERSION_LESS "1.2.3.5")
296 message(SEND_ERROR "1.2.3.4 VERSION_LESS 1.2.3.5 is not true!")
298 if(NOT "1.2" VERSION_LESS "1.10")
299 message(SEND_ERROR "1.2 VERSION_LESS 1.10 is not true!")
301 if(NOT "1.02" VERSION_GREATER "1.1")
302 message(SEND_ERROR "1.02 VERSION_GREATER 1.1 is not true!")
304 if("1.2.3" VERSION_GREATER "1.2.3.4")
305 message(SEND_ERROR "1.2.3 VERSION_GREATER 1.2.3.4 is not false!")
307 if(NOT "1.2" VERSION_EQUAL "1.2.0.0")
308 message(SEND_ERROR "1.2 VERSION_EQUAL 1.2.0.0 is not true!")
311 #-----------------------------------------------------------------------------
312 # Test export(PACKAGE) with find_package.
313 message(STATUS "Preparing export(PACKAGE) test project")
314 try_compile(EXPORTER_COMPILED
315 ${FindPackageTest_BINARY_DIR}/Exporter
316 ${FindPackageTest_SOURCE_DIR}/Exporter
317 CMakeTestExportPackage dummy
318 OUTPUT_VARIABLE output)
319 message(STATUS "Searching for export(PACKAGE) test project")
320 set(CMakeTestExportPackage_DIR "" CACHE FILEPATH
321 "Wipe out find results for testing." FORCE)
322 string(REGEX REPLACE "-.*$" "" version ${CMAKE_VERSION})
323 find_package(CMakeTestExportPackage 1.${version} EXACT REQUIRED)
325 #-----------------------------------------------------------------------------
326 # Test configure_package_config_file().
328 include(CMakePackageConfigHelpers)
330 set(INCLUDE_INSTALL_DIR include )
331 set(SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/share/" )
332 set(CURRENT_BUILD_DIR "${CMAKE_CURRENT_BINARY_DIR}" )
334 configure_package_config_file(RelocatableConfig.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake"
335 INSTALL_DESTINATION "${CMAKE_INSTALL_PREFIX}"
336 PATH_VARS INCLUDE_INSTALL_DIR SHARE_INSTALL_DIR CURRENT_BUILD_DIR
339 set(Relocatable_FIND_COMPONENTS AComp BComp CComp)
340 set(Relocatable_FIND_REQUIRED_BComp 1)
341 include("${CMAKE_CURRENT_BINARY_DIR}/RelocatableConfig.cmake")
343 if(NOT "${RELOC_INCLUDE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/include")
344 message(SEND_ERROR "RELOC_INCLUDE_DIR set by configure_package_config_file() is set to \"${RELOC_INCLUDE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/include\")")
347 if(NOT "${RELOC_SHARE_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}/share/")
348 message(SEND_ERROR "RELOC_SHARE_DIR set by configure_package_config_file() is set to \"${RELOC_SHARE_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}/share/\")")
351 if(NOT "${RELOC_BUILD_DIR}" STREQUAL "${CMAKE_CURRENT_BINARY_DIR}")
352 message(SEND_ERROR "RELOC_BUILD_DIR set by configure_package_config_file() is set to \"${RELOC_BUILD_DIR}\" (expected \"${CMAKE_CURRENT_BINARY_DIR}\")")
355 if(NOT DEFINED Relocatable_FOUND)
356 message(SEND_ERROR "Relocatable_FOUND not defined !")
359 if(Relocatable_FOUND)
360 message(SEND_ERROR "Relocatable_FOUND set to TRUE !")
363 #-----------------------------------------------------------------------------
364 # Test write_basic_config_version_file().
366 # also test that an empty CMAKE_SIZEOF_VOID_P is accepted:
367 set(_CMAKE_SIZEOF_VOID_P ${CMAKE_SIZEOF_VOID_P})
368 set(CMAKE_SIZEOF_VOID_P "")
370 write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake
372 COMPATIBILITY AnyNewerVersion)
374 set(CMAKE_SIZEOF_VOID_P ${_CMAKE_SIZEOF_VOID_P})
376 set(PACKAGE_FIND_VERSION 2.3.4)
377 include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
378 if(PACKAGE_VERSION_COMPATIBLE)
379 message(SEND_ERROR "Found Foo123 with version 1.2.3, but 2.3.4 was requested !")
382 set(PACKAGE_FIND_VERSION 0.0.1)
383 include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
384 if(NOT PACKAGE_VERSION_COMPATIBLE)
385 message(SEND_ERROR "Did not find Foo123 with version 1.2.3 (0.0.1 was requested) !")
388 if(PACKAGE_VERSION_UNSUITABLE)
389 message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
392 set(PACKAGE_FIND_VERSION 1.0.0)
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 (1.0.0 was requested) !")
397 if(PACKAGE_VERSION_EXACT)
398 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
401 set(PACKAGE_FIND_VERSION 1.2.3)
402 include(${CMAKE_CURRENT_BINARY_DIR}/Foo123ConfigVersion.cmake)
403 if(NOT PACKAGE_VERSION_COMPATIBLE)
404 message(SEND_ERROR "Did not find Foo123 with version 1.2.3 (1.2.3 was requested) !")
406 if(NOT PACKAGE_VERSION_EXACT)
407 message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
411 #######################
412 include(WriteBasicConfigVersionFile)
414 write_basic_config_version_file(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake
416 COMPATIBILITY SameMajorVersion)
418 unset(PACKAGE_VERSION_UNSUITABLE)
419 set(PACKAGE_VERSION_EXACT FALSE)
420 set(PACKAGE_FIND_VERSION 2.3.4)
421 set(PACKAGE_FIND_VERSION_MAJOR 2)
422 include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
423 if(PACKAGE_VERSION_COMPATIBLE)
424 message(SEND_ERROR "Found Boo123 with version 1.2.3, but 2.3.4 was requested !")
426 if(PACKAGE_VERSION_EXACT)
427 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
430 set(PACKAGE_FIND_VERSION 0.0.1)
431 set(PACKAGE_FIND_VERSION_MAJOR 0)
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 0.0.1 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 1.0.0)
441 set(PACKAGE_FIND_VERSION_MAJOR 1)
442 include(${CMAKE_CURRENT_BINARY_DIR}/Boo123ConfigVersion.cmake)
443 if(NOT PACKAGE_VERSION_COMPATIBLE)
444 message(SEND_ERROR "Did not find Boo123 with version 1.2.3 (1.0.0 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.2.3)
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.2.3 was requested) !")
456 if(NOT PACKAGE_VERSION_EXACT)
457 message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
460 if(PACKAGE_VERSION_UNSUITABLE)
461 message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")
464 #######################
466 write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake
468 COMPATIBILITY ExactVersion)
470 unset(PACKAGE_VERSION_UNSUITABLE)
471 set(PACKAGE_VERSION_EXACT FALSE)
472 set(PACKAGE_FIND_VERSION 2.3.4)
473 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
474 if(PACKAGE_VERSION_COMPATIBLE)
475 message(SEND_ERROR "Found Bar123 with version 1.2.3 (2.3.4 was requested) !")
477 if(PACKAGE_VERSION_EXACT)
478 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
481 set(PACKAGE_FIND_VERSION 1.2)
482 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
483 if(PACKAGE_VERSION_COMPATIBLE)
484 message(SEND_ERROR "Found Bar123 with version 1.2.3 (1.2 was requested) !")
486 if(PACKAGE_VERSION_EXACT)
487 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
490 set(PACKAGE_FIND_VERSION 1)
491 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
492 if(PACKAGE_VERSION_COMPATIBLE)
493 message(SEND_ERROR "Found Bar123 with version 1.2.3 (1 was requested) !")
495 if(PACKAGE_VERSION_EXACT)
496 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
499 set(PACKAGE_FIND_VERSION 1.2.3.4)
500 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
501 if(NOT PACKAGE_VERSION_COMPATIBLE)
502 message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.4 was requested) !")
504 if(PACKAGE_VERSION_EXACT)
505 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
508 set(PACKAGE_FIND_VERSION 1.2.3)
509 set(PACKAGE_VERSION_EXACT FALSE)
510 set(PACKAGE_VERSION_COMPATIBLE FALSE)
511 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
512 if(NOT PACKAGE_VERSION_COMPATIBLE)
513 message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3 was requested) !")
515 if(PACKAGE_VERSION_EXACT)
516 message(SEND_ERROR "PACKAGE_VERSION_EXACT set, although it should not be !")
520 set(PACKAGE_FIND_VERSION 1.2.3.17)
521 set(PACKAGE_VERSION_EXACT FALSE)
522 set(PACKAGE_VERSION_COMPATIBLE FALSE)
523 include(${CMAKE_CURRENT_BINARY_DIR}/Bar123ConfigVersion.cmake)
524 if(NOT PACKAGE_VERSION_COMPATIBLE)
525 message(SEND_ERROR "Did not find Bar123 with version 1.2.3 (1.2.3.17 was requested) !")
527 if(NOT PACKAGE_VERSION_EXACT)
528 message(SEND_ERROR "PACKAGE_VERSION_EXACT not set, although it should be !")
531 if(PACKAGE_VERSION_UNSUITABLE)
532 message(SEND_ERROR "PACKAGE_VERSION_UNSUITABLE set, but must not be !")