]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: clean up setup_finalize.cmake and call before feature configuration
authorMatthias Maier <tamiko@43-1.org>
Tue, 29 Nov 2022 04:11:11 +0000 (22:11 -0600)
committerMatthias Maier <tamiko@43-1.org>
Fri, 17 Mar 2023 12:44:53 +0000 (07:44 -0500)
CMakeLists.txt
cmake/setup_finalize.cmake

index 0a8d962a1250f514c0b7b64f38c2085f2f9c3522..9f48e7076f6ff3a0f4d1c6ae200b6c1a8995dffa 100644 (file)
@@ -111,6 +111,8 @@ foreach(_file ${_check_files})
   verbose_include(${_file})
 endforeach()
 
+verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_finalize.cmake)
+
 #
 # Feature configuration:
 #
@@ -120,12 +122,8 @@ foreach(_file ${_configure_files})
   verbose_include(${_file})
 endforeach()
 
-#
-# Finalize the configuration:
-#
 verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_cpack.cmake)
 verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_custom_targets.cmake)
-verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_finalize.cmake)
 verbose_include(${CMAKE_SOURCE_DIR}/cmake/setup_write_config.cmake)
 
 ########################################################################
index 5f10a075239f05c4f157a1a67a6c8c2bb45d8378..090c262da7fc9994c8af2712478877919081fad0 100644 (file)
@@ -50,104 +50,23 @@ foreach(_flag ${DEAL_II_REMOVED_FLAGS})
   endif()
 endforeach()
 
-#
-# Save base configuration into variables BASE_* for later use in
-# setup_write_config.cmake:
-#
-foreach(_suffix ${DEAL_II_STRING_SUFFIXES} ${DEAL_II_LIST_SUFFIXES})
-  set(BASE_${_suffix} ${DEAL_II_${_suffix}})
-endforeach()
-
-#
-# Register features:
-#
-foreach(_feature ${DEAL_II_FEATURES})
-  if(DEAL_II_WITH_${_feature})
-    filter_system_libraries(${_feature})
-    register_feature(${_feature})
-  endif()
-endforeach()
-
-#
-# Deduplicate entries one more time :-]
-#
-foreach(_suffix ${DEAL_II_LIST_SUFFIXES})
-  if(_suffix MATCHES "INCLUDE_DIRS$")
-    remove_duplicates(DEAL_II_${_suffix})
-  else()
-    remove_duplicates(DEAL_II_${_suffix} REVERSE)
-  endif()
-endforeach()
-
 #
 # Sanity check: Can we compile with the final setup?
 #
 
 foreach(build ${DEAL_II_BUILD_TYPES})
-
-  macro(_check_linker_flags)
-    check_compiler_setup(
-      "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${build}}"
-      "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${build}}"
-      DEAL_II_HAVE_USABLE_FLAGS_${build}
-      ${DEAL_II_LIBRARIES} ${DEAL_II_LIBRARIES_${build}}
-      )
-  endmacro()
-
-  macro(_drop_linker_flag _linker_flag _replacement_flag _variable)
-    message(STATUS
-      "Unable to compile a simple test program. "
-      "Trying to drop \"${_linker_flag}\" from the linker flags."
-      )
-    foreach(_flags
-        DEAL_II_LINKER_FLAGS DEAL_II_LINKER_FLAGS_${build}
-        BASE_LINKER_FLAGS BASE_LINKER_FLAGS_${build}
-        )
-      string(REPLACE "${_linker_flag}" "${_replacement_flag}"
-        ${_flags} "${${_flags}}"
-        )
-    endforeach()
-    set(${_variable} FALSE CACHE INTERNAL "" FORCE)
-    set(${_variable} FALSE)
-  endmacro()
-
-  _check_linker_flags()
-
-  if(NOT DEAL_II_HAVE_USABLE_FLAGS_${build} AND DEAL_II_COMPILER_HAS_FUSE_LD_LLD)
-    set(_replacement "")
-    if(DEAL_II_COMPILER_HAS_FUSE_LD_GOLD)
-      set(_replacement "-fuse-ld=gold")
-    endif()
-    _drop_linker_flag(
-      "-fuse-ld=lld" ${_replacement}
-      DEAL_II_COMPILER_HAS_FUSE_LD_LLD
-      )
-    _check_linker_flags()
-  endif()
-
-  if(NOT DEAL_II_HAVE_USABLE_FLAGS_${build} AND DEAL_II_COMPILER_HAS_FUSE_LD_GOLD)
-    _drop_linker_flag(
-      "-fuse-ld=gold" ""
-      DEAL_II_COMPILER_HAS_FUSE_LD_GOLD
-      )
-    _check_linker_flags()
-  endif()
-
-  if(NOT DEAL_II_HAVE_USABLE_FLAGS_${build})
-    message(FATAL_ERROR "
-  Configuration error: Cannot compile a test program with the final set of
-  compiler and linker flags:
-    CXX flags (${build}): ${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${build}}
-    LD flags  (${build}): ${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${build}}
-    LIBRARIES (${build}): ${DEAL_II_LIBRARIES};${DEAL_II_LIBRARIES_${build}}
-  \n\n"
-      )
-  endif()
+  check_compiler_setup(
+    "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${build}}"
+    "${DEAL_II_LINKER_FLAGS} ${DEAL_II_LINKER_FLAGS_${build}}"
+    DEAL_II_HAVE_USABLE_FLAGS_${build}
+    ${DEAL_II_LIBRARIES} ${DEAL_II_LIBRARIES_${build}}
+    )
 endforeach()
 
 #
 # Clean up deal.IITargets.cmake in the build directory:
 #
+
 file(REMOVE
   ${CMAKE_BINARY_DIR}/${DEAL_II_PROJECT_CONFIG_RELDIR}/${DEAL_II_PROJECT_CONFIG_NAME}Targets.cmake
   )

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.