From 7daceb0f0e9c210f01575f8cf2f97aad07fbd7d8 Mon Sep 17 00:00:00 2001 From: kervala Date: Fri, 12 Aug 2011 16:41:58 +0200 Subject: [PATCH] Fixed: #1329 Program received signal SIGSEGV, Segmentation fault. --- code/CMakeModules/FindLibwww.cmake | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/code/CMakeModules/FindLibwww.cmake b/code/CMakeModules/FindLibwww.cmake index b594b3140..77140492e 100644 --- a/code/CMakeModules/FindLibwww.cmake +++ b/code/CMakeModules/FindLibwww.cmake @@ -6,6 +6,8 @@ # LIBWWW_LIBRARY, where to find the LibWWW library. # LIBWWW_FOUND, If false, do not try to use LibWWW. +OPTION(WITH_LIBWWW_STATIC "Use only static libraries for libwww" OFF) + SET(LIBWWW_FIND_QUIETLY ${Libwww_FIND_QUIETLY}) # also defined, but not for general use are @@ -46,6 +48,11 @@ ENDIF(LIBWWW_ADDITIONAL_INCLUDE_DIR) # helper to find all the libwww sub libraries MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) + IF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) + SET(CMAKE_FIND_LIBRARY_SUFFIXES_OLD ${CMAKE_FIND_LIBRARY_SUFFIXES}) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ".a") + ENDIF(WITH_LIBWWW_STATIC AND UNIX AND NOT APPLE AND NOT WITH_STATIC_EXTERNAL) + FIND_LIBRARY(${MYLIBRARY} NAMES ${ARGN} PATHS @@ -60,10 +67,14 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) /usr/freeware/lib64 ) + IF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) + SET(CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES_OLD}) + ENDIF(CMAKE_FIND_LIBRARY_SUFFIXES_OLD) + IF(${MYLIBRARY}) - IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC) + IF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) SET(LIBWWW_LIBRARIES ${LIBWWW_LIBRARIES} ${${MYLIBRARY}}) - ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC) + ENDIF(${OPTION} STREQUAL REQUIRED OR WITH_STATIC OR WITH_LIBWWW_STATIC) ELSE(${MYLIBRARY}) IF(NOT LIBWWW_FIND_QUIETLY AND NOT WIN32) MESSAGE(STATUS "Warning: Libwww: Library not found: ${MYLIBRARY}") @@ -74,7 +85,9 @@ MACRO(FIND_WWW_LIBRARY MYLIBRARY OPTION) ENDMACRO(FIND_WWW_LIBRARY) MACRO(LINK_WWW_LIBRARY MYLIBRARY OTHERLIBRARY SYMBOL) - LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL}) + IF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) + LINK_DEPENDS(LIBWWW_LIBRARIES ${MYLIBRARY} ${OTHERLIBRARY} ${SYMBOL}) + ENDIF(NOT WITH_LIBWWW_STATIC AND NOT WITH_STATIC_EXTERNAL) ENDMACRO(LINK_WWW_LIBRARY) # Find and link required libs for static or dynamic