1

I'm new to CMAKE and now I'm trying to build a C++ library and faced some problem.

I'm trying to understand how does PKG_CHECK_MODULES (3RD_PARTY_LIB REQUIRED stream) work. I read the documentation and it is said:

When the ‘REQUIRED’ argument was set, macros will fail with an error when module(s) could not be found

The thing is there should be no stream module installed, but the PKG_CHECK_MODULES does not fail. I added the following

MESSAGE("\n3RD_PARTY_LIB_INCLUDE_DIRS = ${3RD_PARTY_LIB_INCLUDE_DIRS}\n")

and it prints the following

3RD_PARTY_LIB_INCLUDE_DIRS = /home/rjtor/work/libsrv/3rdp/stream/include

But the directory /home/rjtor/work/libsrv/3rdp/stream/include does not really exist.

Is there a way to check why is the module stream in the example found? How to check where is it located?

St.Antario
  • 26,175
  • 41
  • 130
  • 318
  • 1
    How is this variable populated? The `REQUIRED` checks that the variable is set to a specific `NOTFOUND` value. If it's manually set to something, then it gets validated. – Matthieu Brucher Feb 11 '19 at 14:43
  • 1
    Like `find_package`, the function `pkg_check_modules` sets `XXX_FOUND` variable which reflects whether the package has been found or not. Note, that `pkg_check_modules` just read corresponded `.pc` file. Whether the file is wrong or not, you should check by other means. – Tsyvarev Feb 11 '19 at 14:44
  • @Tsyvarev As far as I understood the `.pc` files contain meta-information needed to use the given library like compiler/linker flags, minimum required version etc... But the actual module need to be installed by itself. Is that correct? – St.Antario Feb 11 '19 at 14:54
  • 1
    Yes, in a correct environment, `.pc` file is installed alongside with the actual module. But it could be that your environment is not so correct - e.g., you have removed the actual module, but `.pc` file remains. Have you tried to clear CMake cache (remove `CMakeCache.txt` file)? It could contain data from the first configuration, but that data could be obsolete. – Tsyvarev Feb 11 '19 at 15:03
  • @Tsyvarev Actually you were right. The environment was not correctly installed. – St.Antario Feb 12 '19 at 06:53

0 Answers0