]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Use CMAKE_TRY_COMPILE_CONFIGURATION for MSVC
authorDaniel Arndt <arndtd@ornl.gov>
Fri, 4 Oct 2024 23:47:12 +0000 (19:47 -0400)
committerDaniel Arndt <arndtd@ornl.gov>
Fri, 4 Oct 2024 23:47:12 +0000 (19:47 -0400)
cmake/modules/FindDEAL_II_MPI.cmake
cmake/setup_compiler_flags.cmake
cmake/setup_sanity_checks.cmake

index 01e313f0e123679955ad746729d91fdeed2c05ec..8ad96111af8385c430539e294bef631a0cdd3705 100644 (file)
@@ -102,40 +102,42 @@ endif()
 # lld / ld.gold and missing libopen-pal.so on the link line:
 #
 
-check_compiler_setup(
-  "${DEAL_II_CXX_FLAGS_SAVED} ${DEAL_II_CXX_FLAGS}"
-  "${DEAL_II_LINKER_FLAGS_SAVED} ${DEAL_II_LINKER_FLAGS}"
-  MPI_UNDERLINKAGE_OK
-  ${MPI_CXX_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${MPI_C_LIBRARIES}
-  )
-
-if(NOT MPI_UNDERLINKAGE_OK AND NOT "${MPI_CXX_LIBRARIES}" STREQUAL "")
-  # This check only works if MPI_CXX_LIBRARIES is non-empty, otherwise we will just give up
-  # and hope for the best...
-  message(STATUS "Trying to avoid underlinkage by expliclitly adding libopen-pal to link line")
-
-  list(GET MPI_CXX_LIBRARIES 0 _lib)
-  get_filename_component(_hint ${_lib} DIRECTORY)
-  deal_ii_find_library(_mpi_libopen_pal_library
-    NAMES open-pal
-    HINTS ${_hint}
-    NO_DEFAULT_PATH
-    NO_CMAKE_ENVIRONMENT_PATH
-    NO_CMAKE_PATH
-    NO_SYSTEM_ENVIRONMENT_PATH
-    NO_CMAKE_SYSTEM_PATH
-    NO_CMAKE_FIND_ROOT_PATH
+if (NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
+  check_compiler_setup(
+    "${DEAL_II_CXX_FLAGS_SAVED} ${DEAL_II_CXX_FLAGS}"
+    "${DEAL_II_LINKER_FLAGS_SAVED} ${DEAL_II_LINKER_FLAGS}"
+    MPI_UNDERLINKAGE_OK
+    ${MPI_CXX_LIBRARIES} ${MPI_Fortran_LIBRARIES} ${MPI_C_LIBRARIES}
     )
 
-  #
-  # Note: We don't need to check whether the find library call is
-  # successful: If libopen-pal cannot be found then the
-  # process_feature will drop the library automatically.
-  #
-  # In this case the sanity check in cmake/setup_finalize.cmake will fail
-  # and we start dropping -fuse-ld=lld and -fuse-ld=ld.gold from the
-  # command line.
-  #
+  if(NOT MPI_UNDERLINKAGE_OK AND NOT "${MPI_CXX_LIBRARIES}" STREQUAL "")
+    # This check only works if MPI_CXX_LIBRARIES is non-empty, otherwise we will just give up
+    # and hope for the best...
+    message(STATUS "Trying to avoid underlinkage by expliclitly adding libopen-pal to link line")
+
+    list(GET MPI_CXX_LIBRARIES 0 _lib)
+    get_filename_component(_hint ${_lib} DIRECTORY)
+    deal_ii_find_library(_mpi_libopen_pal_library
+      NAMES open-pal
+      HINTS ${_hint}
+      NO_DEFAULT_PATH
+      NO_CMAKE_ENVIRONMENT_PATH
+      NO_CMAKE_PATH
+      NO_SYSTEM_ENVIRONMENT_PATH
+      NO_CMAKE_SYSTEM_PATH
+      NO_CMAKE_FIND_ROOT_PATH
+      )
+
+    #
+    # Note: We don't need to check whether the find library call is
+    # successful: If libopen-pal cannot be found then the
+    # process_feature will drop the library automatically.
+    #
+    # In this case the sanity check in cmake/setup_finalize.cmake will fail
+    # and we start dropping -fuse-ld=lld and -fuse-ld=ld.gold from the
+    # command line.
+    #
+  endif()
 endif()
 
 process_feature(MPI
index 9835801de26414fc18887d41b1b3280197a70662..d9c438180d2a895da249bf7025368d5812a10e0b 100644 (file)
@@ -68,6 +68,7 @@
 #
 
 foreach(build ${DEAL_II_BUILD_TYPES})
+  set(CMAKE_TRY_COMPILE_CONFIGURATION ${build})
   check_compiler_setup(
     "${DEAL_II_CXX_FLAGS_SAVED} ${DEAL_II_CXX_FLAGS_${build}_SAVED}"
     "${DEAL_II_LINKER_FLAGS_SAVED} ${DEAL_II_LINKER_FLAGS_${build}_SAVED}"
index f52074c3094ded52a5c79939a781d8e81542b4a1..3f075b070583b04d33d7310c57581623eee14de5 100644 (file)
@@ -24,6 +24,8 @@
 #
 
 foreach(build ${DEAL_II_BUILD_TYPES})
+  set(CMAKE_TRY_COMPILE_CONFIGURATION ${build})
+
   macro(_check_linker_flags)
     check_compiler_setup(
       "${DEAL_II_CXX_FLAGS} ${DEAL_II_CXX_FLAGS_${build}}"

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.