Re: [pcre-dev] Please comment on this build suggestion

Top Page
Delete this message
Author: Sheri
Date:  
To: pcre-dev
Subject: Re: [pcre-dev] Please comment on this build suggestion
Christian Ehrlicher wrote:
> Sheri schrieb:
>
>> Sheri wrote:
>>
>>> Philip Hazel wrote:
>>>
>>>
>>>> A PCRE user has sent me the following comments:
>>>>
>>>> ------------------------------------------------------------------------
>>>> I am looking at 7.5 . "configure" doesn't come up with any dll targets.
>>>> With the few additions I made, the dll is made and works well under Windows
>>>> (using mingw32 compiler).
>>>>
>>>> I humbly submit the following addition to "Makefile", which will allow
>>>> anyone using the 'mingw32' compiler to simply type 'make pcre.dll' and
>>>> get a nice DLL for Windows use:
>>>>
>>>> OBJS= pcre_compile.o pcre_config.o \
>>>>         pcre_dfa_exec.o pcre_exec.o pcre_fullinfo.o pcre_get.o \
>>>>         pcre_globals.o pcre_info.o pcre_maketables.o \
>>>>         pcre_newline.o pcre_ord2utf8.o pcre_refcount.o \
>>>>         pcre_study.o pcre_tables.o pcre_try_flipped.o \
>>>>         pcre_ucp_searchfuncs.o pcre_valid_utf8.o pcre_version.o \
>>>>         pcre_chartables.o \
>>>>         pcre_xclass.o
>>>> pcre.dll: $(OBJS)
>>>>         g++ -shared -o pcre.dll -Wl,"--strip-all" -Wl,"--export-all-symbols"
>>>> $(OBJS)
>>>> ------------------------------------------------------------------------

>>>>
>>>> Please could somebody who knows about Windows environments tell me if
>>>> this is a real problem, if the proposed solution is the right one, and
>>>> if so, where to patch it in.
>>>>
>>>> Philip
>>>>
>>>>
>>>>
>>>>
>>> Since version 7.1 or thereabouts special targets for mingw were removed
>>> from configure/make because Daniel nixed them saying they were a "third
>>> wheel" for automake and that if you wanted pcre.dll you should use
>>> cmake. (see here for example:
>>> http://lists.exim.org/lurker/message/20070325.065402.0ad41e10.en.html )
>>>
>>> Now Christian has said only MSVC should be able to make pcre.dll. Sigh.
>>>
>>> Regards,
>>> Sheri
>>>
>>>
>>>
>>>
>> Christian, could CmakeSetup options be added, so that it shows the
>> default "lib" library prefix for each of the libraries, and allows them
>> to be changed? Then it could be platform independent. We know that it
>> must be "lib" on mingw for each of the libraries unless building shared
>> (or the sample programs don't link), but that could be documented.
>>
>>
> There's no such option - when the sample program does not link there
> must be an error somewhere.
>

What I meant was to add user options to CMakeLists.txt for pcre.

e.g. (untested):

SET(PCRE_PREFIX "lib" CACHE STRING
    "clear this field if making a shared dll you want to have named 
pcre.dll instead of libpcre.dll.")


SET_TARGET_PROPERTIES(pcre PROPERTIES PREFIX PCRE_PREFIX)

The reason the sample programs don't link on mingw if using static
libraries and a prefix other than "lib" has something to do with libtool
and library interdepence. If building shared with no prefix, the samples
link fine on mingw. (AFAIK the sample programs link fine for regardless
if shared or static libraries are built with alternate or no prefix in
MSVC).

Regards,
Sheri