[CMake] cmakeConfigureFile libfoo.pc.in Question

lux-integ lux-integ at btconnect.com
Mon Oct 14 08:56:04 EDT 2013


Greetings,
I have a projest (normally built with autotools )  with 
libfoo.pc.in.  

suppose libfoo.pc.in  looks like this:-
#---------------------
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@/foo2

Name: libfoo
Description:a library about swine foods
Version: @VERSION@
Libs: -L${libdir} -Wl,-rpath,${exec_prefix}/lib -lfoo
Cflags: -I${includedir}
#-------------------------------

 I want to replace all the variables with the  @@  and generate the libfoo.pc 
and install this at installation time to ~/prefix/lib/pkgconfig 


Is this simply a case of running configure_file like so:-

#--------------
configure_file(${CMAKE_SOURCE_DIR}/libfoo.pc.in   
${CMAKE_BINARY_DIR}/libfoo.pc  @ONLY)
install(file ${CMAKE_BINARY_DIR}/libfoo.pc DESTINATION lib/pkgconfig )
#-------------------------

and will the required variables be substitued ? 
or is there more to it. (in-other-words  will I have to  set varibles such as 
these (or somesuch ) ????
set(libdir ${CMAKE_INSTALL_PREFIX}/lib )
set(includedir ${CMAKE_INSTALL_PREFIX}/include )
set(exec_prefix ${CMAKE_INSTALL_PREFIX}/bin )
???

Thanks in advance
sincerely
luxInteg


More information about the CMake mailing list