Hello, sorry for flooding with e-mails today, it all kinda piled up. This one is about imported target location for frameworks on OSX (and thus also iOS). I saw the bugreport here https://cmake.org/Bug/view.php?id=14105 and that it was closed as "no change needed". The suggested solution was that the Find module needs to practically work around this with a code similar to the following (for example finding the SDL2 framework installed through Homebrew on OSX):
find_library(SDL2_LIBRARY SDL2) if(APPLE AND ${SDL2_LIBRARY} MATCHES "\\.framework$") set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION ${SDL2_LIBRARY}/SDL2) else() set_property(TARGET SDL2::SDL2 PROPERTY IMPORTED_LOCATION ${SDL2_LIBRARY}) endif() It's ugly to do and I have to do it for all my custom modules that were switched to imported targets, but seeing that even the builtin `FindQt4.cmake` is doing the same, I thought that there is no way to use the nice old "just works" behavior that worked before imported targets. However, this requires that there actually *is* a file at `name.framework/name`, which is not always the case. One of those cases is the `OpenGLES` framework on iOS and for it I *have* to use the `-framework OpenGLES` way to make it work. In that case the workaround is like this: find_library(OpenGLES3 OpenGLES) # other platform-specific names omitted if(APPLE AND ${OPENGLES3_LIBRARY} MATCHES "\\.framework$") add_library(OpenGLES3::OpenGLES3 INTERFACE IMPORTED) set_property(TARGET OpenGLES3::OpenGLES3 APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${OPENGLES3_LIBRARY}) else() add_library(OpenGLES3::OpenGLES3 UNKNOWN IMPORTED) set_property(TARGET OpenGLES3::OpenGLES3 PROPERTY IMPORTED_LOCATION ${OPENGLES3_LIBRARY}) endif() You see that I actually have to completely sidestep the imported target functionality. Only this way the ${OPENGLES3_LIBRARY} location (which in this case is `/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/System/Library/Frameworks/OpenGLES.framework`) gets properly replaced with `-framework OpenGLES` on linker command line and everything works as it should. My question is: why CMake does not keep the old behavior also for imported targets? Is there any way to make it "just work" like it was with the old variable-based approach for finding libraries? I.e. not requiring the users to do elaborate platform-specific branching and introspection of each framework? Thanks for your input. mosra -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake