chrgfx icon indicating copy to clipboard operation
chrgfx copied to clipboard

OSX build fails to find png.hpp

Open flyingclimber opened this issue 4 years ago • 2 comments

Build is failing to find

"png++/png.hpp"
even though it is installed in
/usr/local/Cellar/png++/0.2.10/include/png++/png.hpp

I tried to edit

chrgfx/CMakeLists.txt
to manually add the source dirs but not luck.

The actual build failure is

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -o CMakeFiles/cmTC_26f9a.dir/PNGPP_H.cpp.o -c /Users/[..]/chrgfx/build/CMakeFiles/CheckIncludeFiles/PNGPP_H.cpp -I /usr/local/Cellar/png++/0.2.10/include/

... fatal error: 'png++/png.hpp' file not found

and compiles fine if I add the two source dirs with "-I"

/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++   -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -o /tmp/PNGPP_H.cpp.o -c /Users/[..]/chrgfx/build/CMakeFiles/CheckIncludeFiles/PNGPP_H.cpp -I /usr/local/Cellar/png++/0.2.10/include -I /usr/local/Cellar/libpng/1.6.37/include/

But I don't know how to make CMAKE aware of these.

This seems to only affect OSX. Linux works great. Thank you!

flyingclimber avatar Sep 05 '20 07:09 flyingclimber

First of all, I appreciate you even giving the code a try! Thank you! As for the issue, I don't have a Max/OSX myself, but googling around a bit, I've found this: https://cmake.org/pipermail/cmake/2016-November/064613.html

If I'm reading this correctly Homebrew packages should be symlinked to one of the standard lib directories (i.e. /usr/local/lib etc). I'm not familiar with the system, so I don't know if that's something the end user always has to do or if it's something the package installer should have done.

In Linux, there's also the LD_LIBRARY_PATH environment variable which specifies directories to search for libraries. Not sure if it's present in OSX, but it may be worth a shot.

drojaazu avatar Sep 05 '20 11:09 drojaazu

You're most welcome! This project is exactly what I've been looking for and saves me a ton of time in writing it myself. I'll take another pass and hopefully report back with a PR.

flyingclimber avatar Sep 05 '20 18:09 flyingclimber