3
0
Fork 0
mirror of https://github.com/Z3Prover/z3 synced 2025-07-18 02:16:40 +00:00

bump cmake minimum version to 3.4 as it was released 3+ years ago

some misc compiler flags cleanup
This commit is contained in:
Nuno Lopes 2019-03-07 09:58:36 +00:00
parent c7bbf2f8de
commit c0f7afacc4
5 changed files with 13 additions and 59 deletions

View file

@ -1,17 +1,8 @@
# Enforce some CMake policies
cmake_minimum_required(VERSION 2.8.12)
cmake_minimum_required(VERSION 3.4)
if (POLICY CMP0054)
# FIXME: This is horrible. With the old behaviour,
# quoted strings like "MSVC" in if() conditionals
# get implicitly dereferenced. The NEW behaviour
# doesn't do this but CMP0054 was only introduced
# in CMake 3.1 and we support lower versions as the
# minimum. We could set NEW here but it would be very
# confusing to use NEW for some builds and OLD for others
# which could lead to some subtle bugs. Instead when the
# minimum version is 3.1 change this policy to NEW and remove
# the hacks in place to work around it.
cmake_policy(SET CMP0054 OLD)
cmake_policy(SET CMP0054 NEW)
endif()
if (POLICY CMP0042)
@ -22,13 +13,6 @@ endif()
set(CMAKE_USER_MAKE_RULES_OVERRIDE_CXX "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cxx_compiler_flags_overrides.cmake")
project(Z3 CXX)
if ("${CMAKE_VERSION}" VERSION_LESS "3.4")
# FIXME: Drop this when we upgrade to newer CMake versions.
# HACK: Although we don't need C language support if it is not
# enabled CMake's `FindThreads` module fails in old CMake versions.
enable_language(C)
endif()
################################################################################
# Project version
################################################################################
@ -352,12 +336,11 @@ if (("${TARGET_ARCHITECTURE}" STREQUAL "x86_64") OR ("${TARGET_ARCHITECTURE}" ST
list(APPEND Z3_DEPENDENT_LIBS "iomp5")
endif()
set(SSE_FLAGS "-mfpmath=sse" "-msse" "-msse2")
# FIXME: Remove "x.." when CMP0054 is set to NEW
elseif ("${CMAKE_CXX_COMPILER_ID}" MATCHES "Intel")
set(SSE_FLAGS "-mfpmath=sse" "-msse" "-msse2")
# Intel's compiler requires linking with libiomp5
list(APPEND Z3_DEPENDENT_LIBS "iomp5")
elseif ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
set(SSE_FLAGS "/arch:SSE2")
else()
message(FATAL_ERROR "Unknown compiler ${CMAKE_CXX_COMPILER_ID}")
@ -369,17 +352,6 @@ if (("${TARGET_ARCHITECTURE}" STREQUAL "x86_64") OR ("${TARGET_ARCHITECTURE}" ST
unset(SSE_FLAGS)
endif()
# FIXME: Remove "x.." when CMP0054 is set to NEW
if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
# This is the default for MSVC already but to replicate the
# python/Makefile build system behaviour this flag is set
# explicitly.
z3_add_cxx_flag("/fp:precise" REQUIRED)
endif()
# There doesn't seem to be an equivalent for clang/gcc
################################################################################
# Threading support
################################################################################
@ -493,8 +465,7 @@ endif()
################################################################################
# MSVC specific flags inherited from old build system
################################################################################
# FIXME: Remove "x.." when CMP0054 is set to NEW
if ("x${CMAKE_CXX_COMPILER_ID}" STREQUAL "xMSVC")
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
include(${CMAKE_SOURCE_DIR}/cmake/msvc_legacy_quirks.cmake)
endif()