0

I'm working on a project using the GLPK solver. However, I'm having problems while trying to compile it.

I'm using this to find the package in my computer:

find_package(PkgConfig REQUIRED)

pkg_check_modules(GLPK REQUIRED glpk4.65)

include_directories(${GLPK_INCLUDE_DIR})

link_directories(${GLPK_LIB})

target_link_libraries(${PROG} ${GLPK_LIBRARIES})

I always get the error: No package 'glpk4.65' found when I type cmake .. in the terminal.

pkg_check_modules(GLPK REQUIRED glpk4.65)

I think the problem is here. There should be some glpk4.65 related .pc file in my computer, but I've searched and there is not. When I do this to find, for example, for gtk+-3.0, cmake finds the package. And the file gtk+-3.0.pc can be found in /lib/x86_64-linux-gnu/pkgconfig/ in my pc. However, no glpk .pc related file can be found there. Any ideas?

Thank you.

  • 2
    Googling reveals that none of `glpk4.65.pc`, `glpk4.pc` or even `glpk.pc` exist on any distro. Which tutorial suggests to use this way for search GLPK solver in CMake? – Tsyvarev Jun 01 '20 at 22:43
  • None. I've already tried many expressions and I reckon that no .pc file is found. After googling I realized that I'll probably have to manually create the shared library like this: https://stackoverflow.com/questions/17511496/how-to-create-a-shared-library-with-cmake , since I can't find any related glpk .pc file. The strange thing for me is that I can easily use glpk without cmake, by just including in my Makefile, the line: LIB=-lm -lglpk With cmake, I'm facing lots of problems. – Pedro Morais Jun 02 '20 at 11:28
  • 1
    "I can easily use glpk without cmake, by just including in my Makefile, the line: LIB=-lm -lglpk With cmake, I'm facing lots of problems." - With CMake you can link with libraries too: https://stackoverflow.com/questions/8774593/cmake-link-to-external-library, https://stackoverflow.com/questions/34625627/how-to-link-to-the-c-math-library-with-cmake. – Tsyvarev Jun 02 '20 at 11:30

0 Answers0