-
Notifications
You must be signed in to change notification settings - Fork 432
/
project-config-version.cmake.in
39 lines (37 loc) · 1.81 KB
/
project-config-version.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
# Version checking for @PROJECT_NAME@
set(PACKAGE_VERSION "@PACKAGE_VERSION@")
set(PACKAGE_VERSION_MAJOR "@PACKAGE_MAJOR_VERSION@")
set(PACKAGE_VERSION_MINOR "@PACKAGE_MINOR_VERSION@")
if (NOT PACKAGE_FIND_NAME STREQUAL "@PROJECT_NAME@")
# Check package name (in particular, because of the way cmake finds
# package config files, the capitalization could easily be "wrong").
# This is necessary to ensure that the automatically generated
# variables, e.g., <package>_FOUND, are consistently spelled. Make
# this a WARNING, because this is a user error that needs to be fixed.
#
# Skip this message. It's possible the user is looking for E3D.
# message (WARNING
# "Mismatched package names: use find_package(@PROJECT_NAME@ ...) instead"
# " of find_package(${PACKAGE_FIND_NAME} ...)")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (NOT (APPLE OR CMAKE_SIZEOF_VOID_P EQUAL @CMAKE_SIZEOF_VOID_P@))
# Reject if there's a 32-bit/64-bit mismatch (not necessary with Apple
# since a multi-architecture library is built for that platform).
message (STATUS
"${CMAKE_CURRENT_LIST_FILE} unsuitable because package built with "
"sizeof(*void) = @CMAKE_SIZEOF_VOID_P@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (MSVC AND NOT MSVC_VERSION STREQUAL "@MSVC_VERSION@")
# Reject if there's a mismatch in MSVC compiler versions
message (STATUS
"${CMAKE_CURRENT_LIST_FILE} unsuitable because package built with "
"_MSC_VER = @MSVC_VERSION@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (PACKAGE_FIND_VERSION)
if (${PACKAGE_FIND_VERSION} VERSION_EQUAL ${PACKAGE_VERSION})
set (PACKAGE_VERSION_EXACT TRUE)
elseif (${PACKAGE_FIND_VERSION} VERSION_LESS ${PACKAGE_VERSION}
AND ${PACKAGE_FIND_VERSION_MAJOR} EQUAL ${PACKAGE_VERSION_MAJOR})
set (PACKAGE_VERSION_COMPATIBLE TRUE)
endif ()
endif ()