[CMake] How to prevent semicolons in pkg-config.pc files generated with configure_file?

Claus Klein claus.klein at arcormail.de
Fri Jun 28 16:23:08 EDT 2013


Thanks Eike,

that helps, but I can't understand why it is necessary?

Within the trace message output there was no semicolon, see below.

My first try was this:
message(EXTRA_LIBS=${EXTRA_LIBS})   # => EXTRA_LIBS=/usr/lib/libpthread.dylib/usr/lib/libcrypto.dylib	# OK but no spaces
message(EXTRA_LIBS="${EXTRA_LIBS}") # >>>>>>>> EXTRA_LIBS=/usr/lib/libpthread.dylib;/usr/lib/libcrypto.dylib	# fault! with ';'

Than I changed my code and got this output:


On 28.06.2013, at 19:06, Rolf Eike Beer wrote:

>> # ....
>> # trace
>> message( STATUS SNMP_PP_LIBS="${LIBS}")
>> message( STATUS SNMP_PP_LDFLAGS="${LINKFLAGS}")
>> #
>> # -- SNMP_PP_LIBS="-lpthread -lcrypto "	<<<<<<<<<<<<<<<<< OK, with spaces and no ';'
>> # -- SNMP_PP_LDFLAGS="-L/usr/lib "
>> # ...
>> ## configure_file(snmp++-3.pc.in snmp++-3.pc @ONLY)
>> # -- Generating snmp++-3.pc file for pkg-config ...
>> #
>> # Libs.private: @LIBS@ @LINKFLAGS@
>> # ... expands to:
>> # Libs.private: -lpthread ;-lcrypto  -L/usr/lib
>> #                                    ^
>> #                 How can I prevent this?
> 
> string(REPLACE ";" " " LIBS "${LIBS}")
> 
> Eike
> -- 


Is there a better way to create a pkg-config file?

IMHO, It would be nice if the FindPkgConfig.cmake module could create pc file too.

something like:
	pkg_create_module(<PREFIX> <PATH> [QUIET] <MODULE> )

it should be the reversed function of:
	pkg_search_module (LIBXML  libxml2)

Is this possible?

//Regards
Claus


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20130628/0a1f12ec/attachment.htm>


More information about the CMake mailing list