Closed srinathv2 closed 2 months ago
you can check this
You repeatedly asked your own question in #383, Is that comment the only one that explains the behavior I did not understand? If so, I already know its CMake behavior specification.
What I didn't understand was that find_package()
should also look for libraries in the PATH
environment variable, but it failed to do so.
Nevertheless, when I pass only a string to target_link_libraries()
, it is able to link.
This is because the fact that it is linked means that libpq was found somewhere in the path contained in the PATH
environment variable.
This behavior appears to be inconsistent,
Furthermore, find_package()
could not find libpq when I defined the PostgreSQL_ROOT
variable.
The only way to investigate the reason for this would be to look at #383 author's machine.
@tt4g this is not about any issue i was letting you know,how target_link_libraries works when you give lib name
I don't know what you want to do by telling me that.
@tt4g
What I didn't understand was that
find_package()
should also look for libraries in thePATH
environment variable, but it failed to do so.
find_package tries to search the for
I don't know what you want to do by telling me that.
@tt4g i saw the comment https://github.com/jtv/libpqxx/issues/383#issuecomment-723992584 and just thought to help and learn,nothing else.
Suddenly such a comment is lost on me. Because you were commenting on how to link a customized libpq just prior to that.
@srinathv2 No. CMake checks if a string and the matching CMake target are defined. If a CMake target is found, it adds the necessary linker flags to use that target. If the target is not found, the name is treated as a link target.
See:
Originally posted by @tt4g in https://github.com/jtv/libpqxx/issues/383#issuecomment-2031767111