/
autowiring-configVersion.cmake.in
107 lines (93 loc) · 3.89 KB
/
autowiring-configVersion.cmake.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
set(PACKAGE_VERSION "@autowiring_VERSION@")
if(autowiring_DEBUG)
message(STATUS "Debug mode on")
message(STATUS "Installed autowiring_VERSION: @autowiring_VERSION@")
message(STATUS "Installed autowiring_BUILD_ARCHITECTURES: @autowiring_BUILD_ARCHITECTURES@")
message(STATUS "Configured autowiring_BUILD_ARCHITECTURES: ${autowiring_BUILD_ARCHITECTURES}")
message(STATUS "Installed CMAKE_SIZEOF_VOID_P: @CMAKE_SIZEOF_VOID_P@")
message(STATUS "Configured CMAKE_SIZEOF_VOID_P: ${CMAKE_SIZEOF_VOID_P}")
message(STATUS "Installed using autowiring_USE_LIBCXX: @autowiring_USE_LIBCXX@")
message(STATUS "Configured using autowiring_USE_LIBCXX: ${autowiring_USE_LIBCXX}")
endif()
# If the customer has an override architecture requirement, use that
if(DEFINED autowiring_ARCHITECTURE)
foreach(i IN LISTS autowiring_ARCHITECTURE)
string(REGEX MATCH "amd64|x86_64|x64" autowiring_is_x64 ${i})
string(REGEX MATCH "i386|x86" autowiring_is_x86 ${i})
string(REGEX MATCH "arm" autowiring_is_arm ${i})
# Classify
if(autowiring_is_x86)
list(APPEND autowiring_ARCHITECTURES x86)
elseif(autowiring_is_x64)
list(APPEND autowiring_ARCHITECTURES x64)
elseif(autowiring_is_arm)
list(APPEND autowiring_ARCHITECTURES arm)
else()
message(WARNING "Unrecognized architecture ${i}")
endif()
endforeach()
else()
# Try to infer what the user wants
if(CMAKE_SYSTEM_PROCESSOR STREQUAL "arm")
set(autowiring_ARCHITECTURES arm)
elseif(CMAKE_SIZEOF_VOID_P EQUAL "8")
set(autowiring_ARCHITECTURES x64)
else()
set(autowiring_ARCHITECTURES x86)
endif()
endif()
if(autowiring_DEBUG)
message(STATUS "autowiring_ARCHITECTURE: ${autowiring_ARCHITECTURE}")
message(STATUS "autowiring_ARCHITECTURES: ${autowiring_ARCHITECTURES}")
endif()
# Architectures we were built with
set(autowiring_BUILD_ARCHITECTURES @autowiring_BUILD_ARCHITECTURES@)
if(autowiring_DEBUG)
message(STATUS "autowiring_BUILD_ARCHITECTURES: ${autowiring_BUILD_ARCHITECTURES}")
endif()
# Verify that we match all of the architectures requested by the customer
foreach(i IN LISTS autowiring_ARCHITECTURES)
list(FIND autowiring_BUILD_ARCHITECTURES ${i} found)
if(found EQUAL -1)
set(PACKAGE_VERSION_COMPATIBLE FALSE)
set(PACKAGE_VERSION_UNSUITABLE TRUE)
if(autowiring_DEBUG)
message(STATUS "Requested architecture of ${autowiring_ARCHITECTURE} not compatible with @autowiring_BUILD_ARCHITECTURES@")
endif()
return()
endif()
endforeach()
# Determine whether the user's request (either implied or explicit) for libstdc++ can
# be met by this verison of Autowiring
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
# If this value isn't defined, then we assume the user's request is "on"
if(NOT DEFINED autowiring_USE_LIBCXX)
SET(autowiring_USE_LIBCXX ON)
endif()
if(autowiring_DEBUG)
message(STATUS "Installed autowiring_USE_LIBCXX: @autowiring_USE_LIBCXX@")
message(STATUS "Configured autowiring_USE_LIBCXX: ${autowiring_USE_LIBCXX}")
endif()
# Our built version must be the same as the requested version. If it's not, then we are
# not a match for the user's request
if((NOT ${autowiring_USE_LIBCXX} AND @autowiring_USE_LIBCXX@) OR (${autowiring_USE_LIBCXX} AND NOT @autowiring_USE_LIBCXX@))
if(autowiring_DEBUG)
message("User C++ runtime library request incompatible with locally built version")
endif()
set(PACKAGE_VERSION_COMPATIBLE FALSE)
set(PACKAGE_VERSION_UNSUITABLE TRUE)
return()
endif()
endif()
# Check whether the requested PACKAGE_FIND_VERSION is compatible
if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_COMPATIBLE FALSE)
else()
set(PACKAGE_VERSION_COMPATIBLE TRUE)
if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}")
set(PACKAGE_VERSION_EXACT TRUE)
endif()
if(autowiring_DEBUG)
message(STATUS "Using Autowiring in ${CMAKE_CURRENT_SOURCE_DIR}")
endif()
endif()