aboutsummaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorCharles Karney <charles.karney@sri.com>2019-09-19 09:25:09 -0400
committerCharles Karney <charles.karney@sri.com>2019-09-19 09:25:09 -0400
commit1c2f375033afb0a4eb57c978222db2feeb148f43 (patch)
tree5f1644142a32d3fc47a7a3592860dbe48dea4638 /cmake
parent8948068deaa8b1b9cf14e7e509d06abc3a0b8dcf (diff)
downloadPROJ-1c2f375033afb0a4eb57c978222db2feeb148f43.tar.gz
PROJ-1c2f375033afb0a4eb57c978222db2feeb148f43.zip
Require C99 compiler see #1621
cmake and autoconf now stipulate C99 change c89 to c99 in travis jobs remove HAVE_C99_MATH checks (unrelated) relax Visual Studio compatibility check in cmake/project-config-version.cmake.in (VS 2019 can use a VS 2015 library but not vice versa).
Diffstat (limited to 'cmake')
-rw-r--r--cmake/project-config-version.cmake.in20
1 files changed, 17 insertions, 3 deletions
diff --git a/cmake/project-config-version.cmake.in b/cmake/project-config-version.cmake.in
index 7dc90ddc..b49504d4 100644
--- a/cmake/project-config-version.cmake.in
+++ b/cmake/project-config-version.cmake.in
@@ -11,6 +11,16 @@ else ()
set (CMAKE_CROSSCOMPILING_STR "OFF")
endif ()
+if (MSVC)
+ # For checking the compatibility of MSVC_TOOLSET_VERSION; see
+ # https://docs.microsoft.com/en-us/cpp/porting/overview-of-potential-upgrade-issues-visual-cpp
+ # Assume major version number is obtained by dropping the last decimal
+ # digit. LIBR, resp. PROJ, refer to @PROJECT_NAME@, resp. the package
+ # trying to find and link against @PROJECT_NAME@.
+ math (EXPR _MSVC_PROJ_MAJOR "${MSVC_TOOLSET_VERSION}/10")
+ math (EXPR _MSVC_LIBR_MAJOR "@MSVC_TOOLSET_VERSION@/10")
+endif ()
+
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").
@@ -24,9 +34,13 @@ elseif (NOT (APPLE OR (NOT DEFINED CMAKE_SIZEOF_VOID_P) OR
# since a multi-architecture library is built for that platform).
set (REASON "sizeof(*void) = @CMAKE_SIZEOF_VOID_P@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
-elseif (MSVC AND NOT MSVC_VERSION STREQUAL "@MSVC_VERSION@")
+elseif (MSVC AND NOT (
+ # toolset version must be at least as great as @PROJECT_NAME@'s
+ ${MSVC_TOOLSET_VERSION} GREATER_EQUAL @MSVC_TOOLSET_VERSION@
+ # and major versions must match
+ AND _MSVC_PROJ_MAJOR EQUAL _MSVC_LIBR_MAJOR ))
# Reject if there's a mismatch in MSVC compiler versions
- set (REASON "_MSC_VER = @MSVC_VERSION@")
+ set (REASON "MSVC_TOOLSET_VERSION = @MSVC_TOOLSET_VERSION@")
set (PACKAGE_VERSION_UNSUITABLE TRUE)
elseif (NOT CMAKE_CROSSCOMPILING_STR STREQUAL "@CMAKE_CROSSCOMPILING_STR@")
# Reject if there's a mismatch in ${CMAKE_CROSSCOMPILING}
@@ -53,4 +67,4 @@ if (PACKAGE_VERSION_UNSUITABLE)
set (PACKAGE_VERSION "${PACKAGE_VERSION} (${REASON})")
endif ()
-unset(CMAKE_CROSSCOMPILING_STR) \ No newline at end of file
+unset(CMAKE_CROSSCOMPILING_STR)