Hi,

I have a couple of questions related to using pkg-config in CMake:

1) Using information returned by the macro pkg_check_module from FindPkgConfig.cmake

This should be straightforward but I just cannot get it to work. Say I create my own library "mylib" which depends on a module "cvodes" which comes with a cvodes.pc file. Adding pkg_check_modules(CVODES cvodes) in CMakelists.txt correctly extracts all the information from cvodes.pc and sets the variables:
 ===========================
 cvodes pkgconfig results:
 ===========================
 PKG_CONFIG_FOUND 1
 PKG_CONFIG_EXECUTABLE /usr/bin/pkg-config
 CVODES_FOUND 1
 CVODES_LIBRARIES sundials_cvodes;sundials_nvecserial;sundials_nvecparallel;m
 CVODES_LIBRARY_DIRS /home/radu/CODES/NREL/lib
CVODES_LDFLAGS -L/home/radu/CODES/NREL/lib;-lsundials_cvodes;-lsundials_nvecserial;-lsundials_nvecparallel;-lm
 CVODES_LDFLAGS_OTHERS
 CVODES_INCLUDE_DIRS /home/radu/CODES/NREL/include
 CVODES_CFLAGS -I/home/radu/CODES/NREL/include
 CVODES_CFLAGS_OTHERS
 ============================
I then use include_directories(${CVODES_INCLUDE_DIRS}) and successfully build the library mylib.

But then I'd like to build an example which must be linked with mylib and all CVODES libraries and this is where I got stuck... How do I use the above information? I have
  ADD_EXECUTABLE(testS testS.c)
  TARGET_LINK_LIBRARIES(testS as2)
but how about the CVODES libraries? What's the proper way of linking the target testS to these libraries? I tried unsuccessfully all sort of combinations using TARGET_LINK_LIBRARIES and SET_TARGET_PROPERTIES...


2) Creating a *.pc file for a project.

Suppose my project creates a library "mylib" which requires the BLAS library. Since I do not have a blas.pc file, I simply use some FindBLAS.cmake file which finds the BLAS library as /usr/lib/libblas.so. When I create mylib.pc I cannot use something like "Requires: blas" because there is no blas.pc so I need to add the BLAS libraries under the "Libs" keyword. Does CMake provide a way of generating the proper string to be added to "Libs:"?

Thanks,
--Radu
_______________________________________________
CMake mailing list
CMake@cmake.org
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to