[Openmp-commits] [openmp] 21c0e74 - [CMake][OpenMP] Remove old dead CMake code

Raul Tambre via Openmp-commits openmp-commits at lists.llvm.org
Mon Sep 7 00:57:03 PDT 2020


Author: Raul Tambre
Date: 2020-09-07T10:56:56+03:00
New Revision: 21c0e74c9e7fa33153c484a6dabf33b38aede0d1

URL: https://github.com/llvm/llvm-project/commit/21c0e74c9e7fa33153c484a6dabf33b38aede0d1
DIFF: https://github.com/llvm/llvm-project/commit/21c0e74c9e7fa33153c484a6dabf33b38aede0d1.diff

LOG: [CMake][OpenMP] Remove old dead CMake code

LLVM requires CMake 3.13.4 so remove code behind checks for an older version.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D87191

Added: 
    

Modified: 
    openmp/cmake/OpenMPTesting.cmake
    openmp/runtime/cmake/LibompCheckFortranFlag.cmake

Removed: 
    


################################################################################
diff  --git a/openmp/cmake/OpenMPTesting.cmake b/openmp/cmake/OpenMPTesting.cmake
index 90e0704c4a94..1d46b141ffdf 100644
--- a/openmp/cmake/OpenMPTesting.cmake
+++ b/openmp/cmake/OpenMPTesting.cmake
@@ -50,13 +50,6 @@ endfunction()
 if (${OPENMP_STANDALONE_BUILD})
   find_standalone_test_dependencies()
 
-  # Make sure we can use the console pool for recent CMake and Ninja > 1.5.
-  if (CMAKE_VERSION VERSION_LESS 3.1.20141117)
-    set(cmake_3_2_USES_TERMINAL)
-  else()
-    set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
-  endif()
-
   # Set lit arguments.
   set(DEFAULT_LIT_ARGS "-sv --show-unsupported --show-xfail")
   if (MSVC OR XCODE)
@@ -189,7 +182,7 @@ function(add_openmp_testsuite target comment)
       COMMAND ${PYTHON_EXECUTABLE} ${OPENMP_LLVM_LIT_EXECUTABLE} ${LIT_ARGS} ${ARG_UNPARSED_ARGUMENTS}
       COMMENT ${comment}
       DEPENDS ${ARG_DEPENDS}
-      ${cmake_3_2_USES_TERMINAL}
+      USES_TERMINAL
     )
   else()
     if (ARG_EXCLUDE_FROM_CHECK_ALL)

diff  --git a/openmp/runtime/cmake/LibompCheckFortranFlag.cmake b/openmp/runtime/cmake/LibompCheckFortranFlag.cmake
index 21837ef068e3..b8cdb28a4bf2 100644
--- a/openmp/runtime/cmake/LibompCheckFortranFlag.cmake
+++ b/openmp/runtime/cmake/LibompCheckFortranFlag.cmake
@@ -19,54 +19,9 @@ function(libomp_check_fortran_flag flag boolean)
            print *, \"Hello World!\"
       end program hello")
 
-  set(failed_regexes "[Ee]rror;[Uu]nknown;[Ss]kipping")
-  if(CMAKE_VERSION VERSION_GREATER 3.1 OR CMAKE_VERSION VERSION_EQUAL 3.1)
+    set(failed_regexes "[Ee]rror;[Uu]nknown;[Ss]kipping")
     include(CheckFortranSourceCompiles)
     check_fortran_source_compiles("${fortran_source}" ${boolean} FAIL_REGEX "${failed_regexes}")
     set(${boolean} ${${boolean}} PARENT_SCOPE)
-    return()
-  else()
-    # Our manual check for cmake versions that don't have CheckFortranSourceCompiles
-    set(base_dir ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/fortran_flag_check)
-    file(MAKE_DIRECTORY ${base_dir})
-    file(WRITE ${base_dir}/fortran_source.f "${fortran_source}")
-
-    message(STATUS "Performing Test ${boolean}")
-    execute_process(
-      COMMAND ${CMAKE_Fortran_COMPILER} "${flag}" ${base_dir}/fortran_source.f
-      WORKING_DIRECTORY ${base_dir}
-      RESULT_VARIABLE exit_code
-      OUTPUT_VARIABLE OUTPUT
-      ERROR_VARIABLE OUTPUT
-    )
-
-    if(${exit_code} EQUAL 0)
-      foreach(regex IN LISTS failed_regexes)
-        if("${OUTPUT}" MATCHES ${regex})
-          set(retval FALSE)
-        endif()
-      endforeach()
-    else()
-      set(retval FALSE)
-    endif()
-
-    if(${retval})
-      set(${boolean} 1 CACHE INTERNAL "Test ${boolean}")
-      message(STATUS "Performing Test ${boolean} - Success")
-      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
-        "Performing Fortran Compiler Flag test ${boolean} succeeded with the following output:\n"
-        "${OUTPUT}\n"
-        "Source file was:\n${fortran_source}\n")
-    else()
-      set(${boolean} "" CACHE INTERNAL "Test ${boolean}")
-      message(STATUS "Performing Test ${boolean} - Failed")
-      file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
-        "Performing Fortran Compiler Flag test ${boolean} failed with the following output:\n"
-        "${OUTPUT}\n"
-        "Source file was:\n${fortran_source}\n")
-    endif()
-  endif()
-
-  set(${boolean} ${retval} PARENT_SCOPE)
   endif()
 endfunction()


        


More information about the Openmp-commits mailing list