Skip to content

Commit

Permalink
Only use 'd' suffix when debug libraries are present. (#50)
Browse files Browse the repository at this point in the history
Recent versions of Debian and Ubuntu (beginning with Stretch and Bionic
respectively) do not provide separate debug library versions of Poco.

The refactored debug check now actually verifies that a d-suffixed
library exists. If not it falls back to using the non-suffixed version
of the library which may or may not include debug symbols.
  • Loading branch information
nuclearsandwich authored and wjwwood committed Mar 19, 2019
1 parent f974edb commit 66d4034
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions cmake/Modules/FindPoco.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -159,23 +159,26 @@ IF(Poco_INCLUDE_DIR)
SET(Poco_BINARY_DIRS ${Poco_BINARY_DIR}/bin)
ENDIF(Poco_BINARY_DIR AND EXISTS "${Poco_BINARY_DIR}/bin")
ENDIF(Poco_LIBRARY_DIR AND Poco_FOUNDATION_LIB)
SET(DBG "")
IF(Poco_FOUNDATION_LIB)
IF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
SET(DBG "d")
ELSE ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
SET(DBG "")
# Check that separate debug libraries are actually present.
FIND_LIBRARY(LIBFoundation "PocoFoundationd" Poco_LIBRARY_DIR)
IF(LIBFoundation)
SET(DBG "d")
ENDIF(LIBFoundation)
ENDIF ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug")
SET(Comp_List "Foundation${DBG}")
FOREACH(COMPONENT ${Poco_FIND_COMPONENTS})
FIND_LIBRARY(LIB${COMPONENT} "Poco${COMPONENT}${DBG}" Poco_LIBRARY_DIR)
IF (LIB${COMPONENT})
LIST(APPEND Poco_LIBRARIES "${LIB${COMPONENT}}")
LIST(APPEND Comp_List "${COMPONENT}${DBG}")
ENDIF(LIB${COMPONENT})
FIND_LIBRARY(LIB${COMPONENT} "Poco${COMPONENT}${DBG}" Poco_LIBRARY_DIR)
IF (LIB${COMPONENT})
LIST(APPEND Poco_LIBRARIES "${LIB${COMPONENT}}")
LIST(APPEND Comp_List "${COMPONENT}${DBG}")
ENDIF(LIB${COMPONENT})
ENDFOREACH(COMPONENT)
LIST(REMOVE_DUPLICATES Comp_List)
ENDIF(Poco_FOUNDATION_LIB)
ENDIF(NOT Poco_LIBRARY_DIR)
ENDIF(NOT Poco_LIBRARY_DIR)
ENDIF(Poco_INCLUDE_DIR)

IF(NOT Poco_FOUND)
Expand Down

0 comments on commit 66d4034

Please sign in to comment.