1## --------------------------------------------------------------------- 2## 3## Copyright (C) 2012 - 2018 by the deal.II authors 4## 5## This file is part of the deal.II library. 6## 7## The deal.II library is free software; you can use it, redistribute 8## it, and/or modify it under the terms of the GNU Lesser General 9## Public License as published by the Free Software Foundation; either 10## version 2.1 of the License, or (at your option) any later version. 11## The full text of the license can be found in the file LICENSE.md at 12## the top level directory of deal.II. 13## 14## --------------------------------------------------------------------- 15 16# 17# This file sets up: 18# 19# DEAL_II_HAVE_GETHOSTNAME 20# DEAL_II_HAVE_GETPID 21# DEAL_II_HAVE_SYS_RESOURCE_H 22# DEAL_II_HAVE_UNISTD_H 23# DEAL_II_MSVC 24# 25 26 27######################################################################## 28# # 29# POSIX and Linux specific tests: # 30# # 31######################################################################## 32 33# 34# Check for various posix (and linux) specific header files and symbols 35# 36CHECK_INCLUDE_FILE_CXX("sys/resource.h" DEAL_II_HAVE_SYS_RESOURCE_H) 37 38CHECK_INCLUDE_FILE_CXX("unistd.h" DEAL_II_HAVE_UNISTD_H) 39CHECK_CXX_SYMBOL_EXISTS("gethostname" "unistd.h" DEAL_II_HAVE_GETHOSTNAME) 40CHECK_CXX_SYMBOL_EXISTS("getpid" "unistd.h" DEAL_II_HAVE_GETPID) 41 42######################################################################## 43# # 44# Mac OSX specific setup: # 45# # 46######################################################################## 47 48IF(CMAKE_SYSTEM_NAME MATCHES "Darwin") 49 # 50 # Use -Wno-long-double on Apple Darwin to avoid some unnecessary 51 # warnings. However, newer gccs on that platform do not have 52 # this flag any more, so check whether we can indeed do this 53 # 54 ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-Wno-long-double") 55 56 # 57 # On Mac OS X, -rdynamic is accepted by the compiler (i.e. 58 # it doesn't produce an error) but we always get a warning 59 # that it isn't supported. 60 # 61 # TODO: MM: Check whether this is still necessary... 62 # 63 STRIP_FLAG(DEAL_II_LINKER_FLAGS "-rdynamic") 64 65 # 66 # At least on Clang 5.0.0 the template depth is set to 128, which is too low 67 # to compile parts of the library. Fix this by setting a large value. 68 # 69 ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS "-ftemplate-depth=1024") 70ENDIF() 71 72 73 74######################################################################## 75# # 76# Windows and CYGWIN specific setup: # 77# # 78######################################################################## 79 80# 81# Put an end to user's suffering from cygwin's defects 82# 83IF( CMAKE_SYSTEM_NAME MATCHES "CYGWIN" OR 84 CMAKE_SYSTEM_NAME MATCHES "Windows" ) 85 IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") 86 MESSAGE(FATAL_ERROR 87 "\nCygwin and forks such as MinGW and MinGW-64 are unsupported due to " 88 "multiple unresolved miscompilation issues.\n\n" 89 ) 90 ENDIF() 91ENDIF() 92 93IF(CMAKE_SYSTEM_NAME MATCHES "Windows") 94 95 # 96 # Export DEAL_II_MSVC if we are on a Windows platform: 97 # 98 SET(DEAL_II_MSVC TRUE) 99 100 # 101 # Shared library handling: 102 # 103 104 IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU") 105 # With MinGW we're lucky: 106 ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--export-all-symbols") 107 ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--enable-auto-import") 108 ENABLE_IF_LINKS(DEAL_II_LINKER_FLAGS "-Wl,--allow-multiple-definition") 109 ELSE() 110 # Otherwise disable shared libraries: 111 MESSAGE(WARNING "\n" 112 "BUILD_SHARED_LIBS forced to OFF\n\n" 113 ) 114 SET(BUILD_SHARED_LIBS OFF CACHE BOOL "" FORCE) 115 116 # And disable compilation of examples: 117 SET(DEAL_II_COMPILE_EXAMPLES OFF CACHE BOOL "" FORCE) 118 ENDIF() 119 120ENDIF() 121