Mercurial > minori
annotate dep/pugixml/pugixml-config-version.cmake @ 364:99c961c91809
core: refactor out byte stream into its own file
easy dubs
author | Paper <paper@paper.us.eu.org> |
---|---|
date | Tue, 16 Jul 2024 21:15:59 -0400 |
parents | |
children |
rev | line source |
---|---|
364
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
1 # This is a basic version file for the Config-mode of find_package(). |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
2 # It is used by write_basic_package_version_file() as input file for configure_file() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
3 # to create a version-file which can be installed along a config.cmake file. |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
4 # |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
5 # The created file sets PACKAGE_VERSION_EXACT if the current version string and |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
6 # the requested version string are exactly the same and it sets |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
7 # PACKAGE_VERSION_COMPATIBLE if the current version is >= requested version, |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
8 # but only if the requested major version is the same as the current one. |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
9 # The variable CVF_VERSION must be set before calling configure_file(). |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
10 |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
11 |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
12 set(PACKAGE_VERSION "1.14") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
13 |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
14 if(PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
15 set(PACKAGE_VERSION_COMPATIBLE FALSE) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
16 else() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
17 |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
18 if("1.14" MATCHES "^([0-9]+)\\.") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
19 set(CVF_VERSION_MAJOR "${CMAKE_MATCH_1}") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
20 if(NOT CVF_VERSION_MAJOR VERSION_EQUAL 0) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
21 string(REGEX REPLACE "^0+" "" CVF_VERSION_MAJOR "${CVF_VERSION_MAJOR}") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
22 endif() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
23 else() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
24 set(CVF_VERSION_MAJOR "1.14") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
25 endif() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
26 |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
27 if(PACKAGE_FIND_VERSION_RANGE) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
28 # both endpoints of the range must have the expected major version |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
29 math (EXPR CVF_VERSION_MAJOR_NEXT "${CVF_VERSION_MAJOR} + 1") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
30 if (NOT PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
31 OR ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX_MAJOR STREQUAL CVF_VERSION_MAJOR) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
32 OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND NOT PACKAGE_FIND_VERSION_MAX VERSION_LESS_EQUAL CVF_VERSION_MAJOR_NEXT))) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
33 set(PACKAGE_VERSION_COMPATIBLE FALSE) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
34 elseif(PACKAGE_FIND_VERSION_MIN_MAJOR STREQUAL CVF_VERSION_MAJOR |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
35 AND ((PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "INCLUDE" AND PACKAGE_VERSION VERSION_LESS_EQUAL PACKAGE_FIND_VERSION_MAX) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
36 OR (PACKAGE_FIND_VERSION_RANGE_MAX STREQUAL "EXCLUDE" AND PACKAGE_VERSION VERSION_LESS PACKAGE_FIND_VERSION_MAX))) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
37 set(PACKAGE_VERSION_COMPATIBLE TRUE) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
38 else() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
39 set(PACKAGE_VERSION_COMPATIBLE FALSE) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
40 endif() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
41 else() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
42 if(PACKAGE_FIND_VERSION_MAJOR STREQUAL CVF_VERSION_MAJOR) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
43 set(PACKAGE_VERSION_COMPATIBLE TRUE) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
44 else() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
45 set(PACKAGE_VERSION_COMPATIBLE FALSE) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
46 endif() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
47 |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
48 if(PACKAGE_FIND_VERSION STREQUAL PACKAGE_VERSION) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
49 set(PACKAGE_VERSION_EXACT TRUE) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
50 endif() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
51 endif() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
52 endif() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
53 |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
54 |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
55 # if the installed or the using project don't have CMAKE_SIZEOF_VOID_P set, ignore it: |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
56 if("${CMAKE_SIZEOF_VOID_P}" STREQUAL "" OR "8" STREQUAL "") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
57 return() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
58 endif() |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
59 |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
60 # check that the installed version has the same 32/64bit-ness as the one which is currently searching: |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
61 if(NOT CMAKE_SIZEOF_VOID_P STREQUAL "8") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
62 math(EXPR installedBits "8 * 8") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
63 set(PACKAGE_VERSION "${PACKAGE_VERSION} (${installedBits}bit)") |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
64 set(PACKAGE_VERSION_UNSUITABLE TRUE) |
99c961c91809
core: refactor out byte stream into its own file
Paper <paper@paper.us.eu.org>
parents:
diff
changeset
|
65 endif() |