After upgrading to Catalina from Mojave, Setuping: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk in the env.
I\
@mkl 's solution helps to fix the similar issue on my side. Thanks.
I got the same issue to compile a project on basis of PCL. The solution is to set CommandLineTools SDK CMAKE_OSX_SYSROOT.
I tried @mkl's solution to do it in CMakeLists.txt, it doesn't work. So that I can only set it by cmake .. -DCMAKE_OSX_SYSROOT="/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk"
Another thing to mention: there are two versions of command line SDKs in my MacOS:
~ » /Library/Developer/CommandLineTools/SDKs/MacOSX
/Library/Developer/CommandLineTools/SDKs/MacOSX
MacOSX.sdk/ MacOSX10.14.sdk@
xcrun --show-sdk-path gives out the default one, but actually only MacOSX10.14.sdk works on my side.
Discussion of the similar issue in PCL's repo: https://github.com/PointCloudLibrary/pcl/issues/2601#issuecomment-621889211
I don't know much about cmake and SDKs in c++. The difference I noticed in cmake building log from different SDKs as following:
/Library/Developer/CommandLineTools/SDKs/MacOSX:
-- Found OpenGL: /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
-- Found OpenGL: /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/OpenGL.framework
On default:
-- Found OpenGL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk/System/Library/Frameworks/OpenGL.framework
Seems like the issue happens on SDK choice for Opengl.
Appreciated it if anyone could advice.