From: maier Date: Tue, 26 Feb 2013 18:08:37 +0000 (+0000) Subject: Remove setup of C compiler from the build system X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5945c11fcc0e9b8486f8eeb182a0dd7e0e28e211;p=dealii-svn.git Remove setup of C compiler from the build system git-svn-id: https://svn.dealii.org/branches/branch_cmake@28583 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/cmake/checks/check_01_compiler_features.cmake b/deal.II/cmake/checks/check_01_compiler_features.cmake index 1791b0df41..3dd75856e2 100644 --- a/deal.II/cmake/checks/check_01_compiler_features.cmake +++ b/deal.II/cmake/checks/check_01_compiler_features.cmake @@ -330,7 +330,6 @@ ENDIF() IF( (NOT CMAKE_SYSTEM_NAME MATCHES "CYGWIN") AND (NOT CMAKE_SYSTEM_NAME MATCHES "Windows") ) ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-Wa,--compress-debug-sections") - ENABLE_IF_SUPPORTED(DEAL_II_C_FLAGS_DEBUG "-Wa,--compress-debug-sections") ENDIF() diff --git a/deal.II/cmake/checks/check_01_system_features.cmake b/deal.II/cmake/checks/check_01_system_features.cmake index 87c26a0291..cf4ff0e546 100644 --- a/deal.II/cmake/checks/check_01_system_features.cmake +++ b/deal.II/cmake/checks/check_01_system_features.cmake @@ -35,10 +35,10 @@ # # ########################################################################### -CHECK_INCLUDE_FILE("sys/resource.h" HAVE_SYS_RESOURCE_H) -CHECK_INCLUDE_FILE("sys/time.h" HAVE_SYS_TIME_H) -CHECK_INCLUDE_FILE("sys/times.h" HAVE_SYS_TIMES_H) -CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILE_CXX("sys/resource.h" HAVE_SYS_RESOURCE_H) +CHECK_INCLUDE_FILE_CXX("sys/time.h" HAVE_SYS_TIME_H) +CHECK_INCLUDE_FILE_CXX("sys/times.h" HAVE_SYS_TIMES_H) +CHECK_INCLUDE_FILE_CXX("sys/types.h" HAVE_SYS_TYPES_H) # @@ -47,7 +47,7 @@ CHECK_INCLUDE_FILE("sys/types.h" HAVE_SYS_TYPES_H) # Windows/MinGW unistd.h is available but not all posix functions. So test # for each funtion as well. # -CHECK_INCLUDE_FILE("unistd.h" HAVE_UNISTD_H) +CHECK_INCLUDE_FILE_CXX("unistd.h" HAVE_UNISTD_H) CHECK_FUNCTION_EXISTS(gethostname HAVE_GETHOSTNAME) CHECK_FUNCTION_EXISTS(getpid HAVE_GETPID) CHECK_FUNCTION_EXISTS(rand_r HAVE_RAND_R) diff --git a/deal.II/cmake/checks/check_02_compiler_bugs.cmake b/deal.II/cmake/checks/check_02_compiler_bugs.cmake index 640014691d..b33e40b11c 100644 --- a/deal.II/cmake/checks/check_02_compiler_bugs.cmake +++ b/deal.II/cmake/checks/check_02_compiler_bugs.cmake @@ -76,7 +76,6 @@ POP_TEST_FLAG() IF(DEAL_II_WRETURN_TYPE_CONST_QUALIFIER_BUG) ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS -Wno-return-type) - ENABLE_IF_SUPPORTED(CMAKE_C_FLAGS -Wno-return-type) ENDIF() @@ -94,7 +93,6 @@ ENDIF() IF(CMAKE_CXX_COMPILER_ID MATCHES "GNU" AND CMAKE_CXX_COMPILER_VERSION MATCHES "4.4.") STRIP_FLAG(CMAKE_CXX_FLAGS "-pedantic") - STRIP_FLAG(CMAKE_C_FLAGS "-pedantic") ENDIF() @@ -126,7 +124,6 @@ IF(HAVE_MPI_H) IF(DEAL_II_ADVANCE_WARNING_BUG) ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS "-Wno-unused-parameter") - ENABLE_IF_SUPPORTED(CMAKE_C_FLAGS "-Wno-unused-parameter") ENDIF() ENDIF() @@ -322,7 +319,6 @@ CHECK_CXX_COMPILER_BUG( IF(DEAL_II_TYPE_QUALIFIER_BUG) ENABLE_IF_SUPPORTED(CMAKE_CXX_FLAGS -Wno-ignored-qualifiers) - ENABLE_IF_SUPPORTED(CMAKE_C_FLAGS -Wno-ignored-qualifiers) ENDIF() diff --git a/deal.II/cmake/configure/configure_1_mpi.cmake b/deal.II/cmake/configure/configure_1_mpi.cmake index 58c1253369..d7e4a0d854 100644 --- a/deal.II/cmake/configure/configure_1_mpi.cmake +++ b/deal.II/cmake/configure/configure_1_mpi.cmake @@ -50,7 +50,6 @@ MACRO(FEATURE_MPI_CONFIGURE_EXTERNAL var) IF(DEAL_II_MPICXX) SET(CMAKE_CXX_COMPILER ${MPI_CXX_COMPILER}) - SET(CMAKE_C_COMPILER ${MPI_C_COMPILER}) ENDIF() SET(DEAL_II_COMPILER_SUPPORTS_MPI TRUE) diff --git a/deal.II/cmake/macros/macro_deal_ii_add_c_library.cmake b/deal.II/cmake/macros/macro_deal_ii_add_c_library.cmake deleted file mode 100644 index 5b1600d1df..0000000000 --- a/deal.II/cmake/macros/macro_deal_ii_add_c_library.cmake +++ /dev/null @@ -1,40 +0,0 @@ -##### -## -## Copyright (C) 2012 by the deal.II authors -## -## This file is part of the deal.II library. -## -## -## This file is dual licensed under QPL 1.0 and LGPL 2.1 or any later -## version of the LGPL license. -## -## Author: Matthias Maier -## -##### - -# -# See macro_deal_ii_add_library.cmake for an explanation of this macro -# - -MACRO(DEAL_II_ADD_C_LIBRARY _library) - - FOREACH(_build ${DEAL_II_BUILD_TYPES}) - STRING(TOLOWER ${_build} _build_lowercase) - - ADD_LIBRARY(${_library}.${_build_lowercase} - ${ARGN} - ) - - SET_TARGET_PROPERTIES(${_library}.${_build_lowercase} PROPERTIES - LINK_FLAGS "${DEAL_II_SHARED_LINKER_FLAGS_${_build}}" - COMPILE_DEFINITIONS "${DEAL_II_DEFINITIONS};${DEAL_II_DEFINITIONS_${_build}}" - COMPILE_FLAGS "${DEAL_II_C_FLAGS_${_build}}" - ) - - FILE(APPEND - ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/deal_ii_objects_${_build_lowercase} - "$\n" - ) - ENDFOREACH() - -ENDMACRO() diff --git a/deal.II/cmake/setup_cached_variables.cmake b/deal.II/cmake/setup_cached_variables.cmake index 30bb6c7245..3122a8fc58 100644 --- a/deal.II/cmake/setup_cached_variables.cmake +++ b/deal.II/cmake/setup_cached_variables.cmake @@ -33,13 +33,10 @@ # CMAKE_BUILD_TYPE # BUILD_SHARED_LIBS # CMAKE_INSTALL_RPATH_USE_LINK_PATH -# CMAKE_C_FLAGS *) # CMAKE_CXX_FLAGS *) # CMAKE_SHARED_LINKER_FLAGS *) -# DEAL_II_C_FLAGS_DEBUG # DEAL_II_CXX_FLAGS_DEBUG # DEAL_II_SHARED_LINKER_FLAGS_DEBUG -# DEAL_II_C_FLAGS_RELEASE # DEAL_II_CXX_FLAGS_RELEASE # DEAL_II_SHARED_LINKER_FLAGS_RELEASE # @@ -154,9 +151,7 @@ MARK_AS_ADVANCED(CMAKE_INSTALL_RPATH_USE_LINK_PATH) # CMAKE_(C|CXX)_FLAGS_(DEBUG|RELEASE) # FOREACH(_flag - C_FLAGS_RELEASE CXX_FLAGS_RELEASE - C_FLAGS_DEBUG CXX_FLAGS_DEBUG ) IF(NOT "${CMAKE_${_flag}}" STREQUAL "") @@ -195,14 +190,11 @@ SET_IF_EMPTY(CMAKE_SHARED_LINKER_FLAGS "$ENV{LDFLAGS}") # Set cached compiler flags to an empty string: # SET(DEAL_II_USED_FLAGS - CMAKE_C_FLAGS CMAKE_CXX_FLAGS - CMAKE_SHARED_LINKER_FLAGS - DEAL_II_C_FLAGS_DEBUG DEAL_II_CXX_FLAGS_DEBUG - DEAL_II_SHARED_LINKER_FLAGS_DEBUG - DEAL_II_C_FLAGS_RELEASE DEAL_II_CXX_FLAGS_RELEASE + CMAKE_SHARED_LINKER_FLAGS + DEAL_II_SHARED_LINKER_FLAGS_DEBUG DEAL_II_SHARED_LINKER_FLAGS_RELEASE ) diff --git a/deal.II/cmake/setup_compiler_flags.cmake b/deal.II/cmake/setup_compiler_flags.cmake index 30420f674b..f902b5be06 100644 --- a/deal.II/cmake/setup_compiler_flags.cmake +++ b/deal.II/cmake/setup_compiler_flags.cmake @@ -48,13 +48,8 @@ # -# We need a C compiler only for the compilation of the bundled umfpack -# library, so we don't make much fuss about configuration and setup of the -# C compiler and assume that CC and CXX are the same compiler brand, hence -# supporting almost the same compiler flags. -# (See setup in setup_compiler_flags_*.cmake) -# -# So, give a prominent error message in case CC and CXX differ: +# TODO: Is there a way to set CMAKE_C_COMPILER to the same brand as +# CMAKE_CXX_COMPILER? # IF(NOT ( "${CMAKE_C_COMPILER_ID}" STREQUAL "${CMAKE_CXX_COMPILER_ID}" AND "${CMAKE_C_COMPILER_VERSION}" STREQUAL "${CMAKE_CXX_COMPILER_VERSION}" ) ) diff --git a/deal.II/cmake/setup_compiler_flags_gnu.cmake b/deal.II/cmake/setup_compiler_flags_gnu.cmake index 9efc7865d5..2ab59a91fb 100644 --- a/deal.II/cmake/setup_compiler_flags_gnu.cmake +++ b/deal.II/cmake/setup_compiler_flags_gnu.cmake @@ -149,31 +149,3 @@ IF (CMAKE_BUILD_TYPE MATCHES "Debug") ENDIF() ENDIF() - -######################### -# # -# Set up C FLAGS: # -# # -######################### - -# -# For the moment we assume that CC and CXX are the same compiler and that -# we can set (almost) the same default flags for both: -# -SET(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS}) -SET(DEAL_II_C_FLAGS_RELEASE ${DEAL_II_CXX_FLAGS_RELEASE}) -SET(DEAL_II_C_FLAGS_DEBUG ${DEAL_II_CXX_FLAGS_DEBUG}) - -# -# OK, touché, touché. We have to strip flags not supported by a C target: -# -STRIP_FLAG(CMAKE_C_FLAGS "-Wsynth") -STRIP_FLAG(DEAL_II_C_FLAGS_RELEASE "-felide-constructors") - -# -# and disable some warnings: -# -STRIP_FLAG(CMAKE_C_FLAGS "-Wall") # There is no other way to disable -Wunknown-pragma atm... -STRIP_FLAG(CMAKE_C_FLAGS "-Wsign-compare") -STRIP_FLAG(CMAKE_C_FLAGS "-Wwrite-strings") - diff --git a/deal.II/cmake/setup_compiler_flags_intel.cmake b/deal.II/cmake/setup_compiler_flags_intel.cmake index d136ebfcba..ac9808b055 100644 --- a/deal.II/cmake/setup_compiler_flags_intel.cmake +++ b/deal.II/cmake/setup_compiler_flags_intel.cmake @@ -107,18 +107,3 @@ IF (CMAKE_BUILD_TYPE MATCHES "Debug") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "-grecord-gcc-switches") ENDIF() - -######################### -# # -# Set up C FLAGS: # -# # -######################### - -# -# For the moment we assume that CC and CXX are the same compiler and that -# we can set (almost) the same default flags for both: -# -SET(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS}) -SET(DEAL_II_C_FLAGS_RELEASE ${DEAL_II_CXX_FLAGS_RELEASE}) -SET(DEAL_II_C_FLAGS_DEBUG ${DEAL_II_CXX_FLAGS_DEBUG}) - diff --git a/deal.II/cmake/setup_compiler_flags_msvc.cmake b/deal.II/cmake/setup_compiler_flags_msvc.cmake index fc1c88e037..b8871633f5 100644 --- a/deal.II/cmake/setup_compiler_flags_msvc.cmake +++ b/deal.II/cmake/setup_compiler_flags_msvc.cmake @@ -71,18 +71,3 @@ IF (CMAKE_BUILD_TYPE MATCHES "Debug") ENABLE_IF_SUPPORTED(DEAL_II_CXX_FLAGS_DEBUG "/Zi") ENDIF() - -######################### -# # -# Set up C FLAGS: # -# # -######################### - -# -# For the moment we assume that CC and CXX are the same compiler and that -# we can set (almost) the same default flags for both: -# -SET(CMAKE_C_FLAGS ${CMAKE_CXX_FLAGS}) -SET(DEAL_II_C_FLAGS_RELEASE ${DEAL_II_CXX_FLAGS_RELEASE}) -SET(DEAL_II_C_FLAGS_DEBUG ${DEAL_II_CXX_FLAGS_DEBUG}) - diff --git a/deal.II/cmake/setup_external_macros.cmake b/deal.II/cmake/setup_external_macros.cmake index a169480934..6adfecc7ab 100644 --- a/deal.II/cmake/setup_external_macros.cmake +++ b/deal.II/cmake/setup_external_macros.cmake @@ -19,7 +19,8 @@ INCLUDE(CheckCXXCompilerFlag) INCLUDE(CheckCXXSourceCompiles) INCLUDE(CheckCXXSourceRuns) -INCLUDE(CheckFunctionExists) -INCLUDE(CheckIncludeFile) +INCLUDE(CheckCXXSymbolExists) INCLUDE(CheckIncludeFileCXX) +INCLUDE(CheckFunctionExists) + diff --git a/deal.II/cmake/setup_finalize.cmake b/deal.II/cmake/setup_finalize.cmake index 7dfbb98efd..8994a11fdf 100644 --- a/deal.II/cmake/setup_finalize.cmake +++ b/deal.II/cmake/setup_finalize.cmake @@ -89,23 +89,6 @@ IF(CMAKE_BUILD_TYPE MATCHES "Debug") FILE(APPEND ${_log} "# DEAL_II_SHARED_LINKER_FLAGS_DEBUG: ${DEAL_II_SHARED_LINKER_FLAGS_DEBUG}\n") ENDIF() -IF(FEATURE_UMFPACK_BUNDLED_CONFIGURED) - FILE(APPEND ${_log} -"# -# The bundled UMFPACK library will be compiled with the following C compiler: -# CMAKE_C_COMPILER: ${CMAKE_C_COMPILER_ID} ${CMAKE_C_COMPILER_VERSION} -# ${CMAKE_C_COMPILER} -# CMAKE_C_FLAGS: ${CMAKE_C_FLAGS} -" - ) - IF(CMAKE_BUILD_TYPE MATCHES "Release") - FILE(APPEND ${_log} "# DEAL_II_C_FLAGS_RELEASE: ${DEAL_II_C_FLAGS_RELEASE}\n") - ENDIF() - IF(CMAKE_BUILD_TYPE MATCHES "Debug") - FILE(APPEND ${_log} "# DEAL_II_C_FLAGS_DEBUG: ${DEAL_II_C_FLAGS_DEBUG}\n") - ENDIF() -ENDIF() - IF(NOT DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS) FILE(APPEND ${_log} "#\n# WARNING: DEAL_II_SETUP_DEFAULT_COMPILER_FLAGS is set to OFF\n") ELSEIF(NOT DEAL_II_KNOWN_COMPILER) diff --git a/deal.II/doc/development/cmake.html b/deal.II/doc/development/cmake.html index 9479e77393..5d4f47a064 100644 --- a/deal.II/doc/development/cmake.html +++ b/deal.II/doc/development/cmake.html @@ -874,11 +874,9 @@ For internal use, for setting necessary compiler flags, e.g. -std=c++11 (if available):
    -
  • CMAKE_CXX_FLAGS (and CMAKE_C_FLAGS) -
  • DEAL_II_CXX_FLAGS_DEBUG (and - DEAL_II_C_FLAGS_DEBUG) -
  • DEAL_II_CXX_FLAGS_RELEASE (and - DEAL_II_C_FLAGS_RELEASE) +
  • CMAKE_CXX_FLAGS +
  • DEAL_II_CXX_FLAGS_DEBUG +
  • DEAL_II_CXX_FLAGS_RELEASE