Avoid brute-force checking for debug libraries when the release version exists.

metadata
Edgar Velazquez-Armendariz 2014-01-25 17:42:33 -05:00
parent dd03cbd2d9
commit ff93dd3278
1 changed files with 13 additions and 0 deletions

View File

@ -105,6 +105,19 @@ macro(FIND_RELEASE_AND_DEBUG)
PATHS ${LIBRELDBG_FIXED_PATHS} PATHS ${LIBRELDBG_FIXED_PATHS}
PATH_SUFFIXES lib PATH_SUFFIXES lib
) )
# Use a single debug name is the release version has been found
if (${LIBPREFIX}_LIBRARY_RELEASE)
get_filename_component(${LIBPREFIX}_LIBRARY_RELEASE_NAME
"${${LIBPREFIX}_LIBRARY_RELEASE}" NAME)
if ("${${LIBPREFIX}_LIBRARY_RELEASE_NAME}" MATCHES "(lib)?(.+)\\.[^.]+$")
set(LIBRELDBG_NAMES "${CMAKE_MATCH_2}")
if (WIN32 AND CMAKE_MATCH_1)
list(APPEND LIBRELDBG_NAMES "${CMAKE_MATCH_1}${CMAKE_MATCH_2}")
endif()
endif()
endif()
# CMake hangs if the list of library names is too long. As of CMake 2.8.11 # CMake hangs if the list of library names is too long. As of CMake 2.8.11
# it is far faster to call find_library many times with a single library name # it is far faster to call find_library many times with a single library name
foreach(suffix ${LIBRELDBG_DBG_SUFFIXES}) foreach(suffix ${LIBRELDBG_DBG_SUFFIXES})