diff options
author | makise-homura <akemi_homura@kurisa.ch> | 2022-06-30 19:48:45 (GMT) |
---|---|---|
committer | makise-homura <akemi_homura@kurisa.ch> | 2022-06-30 19:48:45 (GMT) |
commit | 0eea1e856357719e3d03860e7e8e47b5416634af (patch) | |
tree | 7e5b567c245dba85bb00dbefe8d39be5a1886f09 /Modules | |
parent | 7375542615e0c1d3d09117eac3a9e201275da425 (diff) | |
download | CMake-0eea1e856357719e3d03860e7e8e47b5416634af.zip CMake-0eea1e856357719e3d03860e7e8e47b5416634af.tar.gz CMake-0eea1e856357719e3d03860e7e8e47b5416634af.tar.bz2 |
LCC: for OpenMP, collectly determine implicit link dirs
It is found out for LCC to not specify all library search paths
when called by cmake_parse_implicit_link_info().
Because of that, FindOpenMP module can't find some libraries,
like libpthread. For this, we should analyze -print-search-dirs
output and append library paths to implicit link ones.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/FindOpenMP.cmake | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Modules/FindOpenMP.cmake b/Modules/FindOpenMP.cmake index ecfb7f9..d19624e 100644 --- a/Modules/FindOpenMP.cmake +++ b/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) |