Kaynağa Gözat

Merge topic 'lcc-additional-implicit-link-dirs'

0eea1e8563 LCC: for OpenMP, collectly determine implicit link dirs

Acked-by: Kitware Robot <[email protected]>
Tested-by: buildbot <[email protected]>
Merge-request: !7436
Brad King 3 yıl önce
ebeveyn
işleme
0b05adebcc
1 değiştirilmiş dosya ile 17 ekleme ve 0 silme
  1. 17 0
      Modules/FindOpenMP.cmake

+ 17 - 0
Modules/FindOpenMP.cmake

@@ -243,6 +243,23 @@ function(_OPENMP_GET_FLAGS LANG FLAG_MODE OPENMP_FLAG_VAR OPENMP_LIB_NAMES_VAR)
         file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
         "Parsed ${LANG} OpenMP implicit link information from above output:\n${OpenMP_${LANG}_LOG_VAR}\n\n")
 
+        # For LCC we should additionally alanyze -print-search-dirs output
+        # to check for additional implicit_dirs.
+        # Note: This won't work if CMP0129 policy is set to OLD!
+        if("${CMAKE_${LANG}_COMPILER_ID}" STREQUAL "LCC")
+          execute_process(
+            COMMAND ${CMAKE_${LANG}_COMPILER} -print-search-dirs
+            OUTPUT_VARIABLE output_lines
+            COMMAND_ERROR_IS_FATAL ANY
+            ERROR_QUIET)
+          if("${output_lines}" MATCHES ".*\nlibraries:[ \t]+(.*:)\n.*")
+            string(REPLACE ":" ";" implicit_dirs_addon "${CMAKE_MATCH_1}")
+            list(PREPEND OpenMP_${LANG}_IMPLICIT_LINK_DIRS ${implicit_dirs_addon})
+            file(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log
+              "  Extended OpenMP library search paths: [${implicit_dirs}]\n")
+          endif()
+        endif()
+
         unset(_OPENMP_LIB_NAMES)
         foreach(_OPENMP_IMPLICIT_LIB IN LISTS OpenMP_${LANG}_IMPLICIT_LIBRARIES)
           get_filename_component(_OPENMP_IMPLICIT_LIB_DIR "${_OPENMP_IMPLICIT_LIB}" DIRECTORY)