[libpng] Add file usage.txt to describe the usage of port libpng#23379
[libpng] Add file usage.txt to describe the usage of port libpng#23379RookieTars wants to merge 1 commit intomicrosoft:masterfrom
Conversation
Describe the usage of package libpng in CMake targets.
| target_link_libraries(main PRIVATE ${PNG_LIBRARY}) | ||
| target_include_directories(main PRIVATE ${PNG_INCLUDE_DIR}) |
There was a problem hiding this comment.
why? use targets? Isn't the automatic usage not good enough?
there is also cmakes FindPNG which can be used.
There was a problem hiding this comment.
Do you mean find_package(PNG REQUIRED) ? It doesn't work on my machine.
There was a problem hiding this comment.
find_package(libpng REQUIRED)
target_link_libraries(${target_name} PRIVATE png)
This is how it's used in my project. I think this is also what vcpkg prints after install.
There was a problem hiding this comment.
for static builds it is png_static
There was a problem hiding this comment.
@Osyotr You're right.I didn't pay attention to the info after install and couldn't find any information from this repo.
There was a problem hiding this comment.
@Neumann-A Sorry, I can't understand that. 😢 I'm still very new to CMake and vcpkg. But I found
find_package(PNG REQUIRED)
target_link_libraries(main PRIVATE PNG::PNG)
works on my machine. Is that the correct usage of FindPNG?
|
This port seems to already have a usage message is this incorrect? |
|
@Hoikas That's right! But I couldn't find it. |
|
The port doesn't have a usage file. The usage information is generated automatically (but seems to work). I would still recommend the CMake find module if you don't want to depend on either vpckg or a recent enough libpng. find_package(PNG REQUIRED)
target_link_libraries(main PRIVATE PNG::PNG) # since CMake 3.5If this doesn't work, it is either wrong usage of vcpkg, or a bug. |
As pointed out by @Neumann-A, this is incorrect for static builds. Adding to #20190. |
|
There is now a usage file based on |
Correct. So I'm going to close this PR since it's invalid. |
Appreciate that. |
Describe the pull request
What does your PR fix?
Add usage.txt in directory ports/libpng to describe the usage of package libpng in CMake targets.
Have you updated the CI baseline?
No
Does your PR follow the maintainer guide?
Yes