FindFirebaseCore.cmake 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. # Copyright 2017 Google
  2. #
  3. # Licensed under the Apache License, Version 2.0 (the "License");
  4. # you may not use this file except in compliance with the License.
  5. # You may obtain a copy of the License at
  6. #
  7. # http://www.apache.org/licenses/LICENSE-2.0
  8. #
  9. # Unless required by applicable law or agreed to in writing, software
  10. # distributed under the License is distributed on an "AS IS" BASIS,
  11. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. # See the License for the specific language governing permissions and
  13. # limitations under the License.
  14. find_library(
  15. FIREBASECORE_LIBRARY
  16. FirebaseCore
  17. PATHS ${FIREBASE_INSTALL_DIR}/Frameworks
  18. )
  19. include(FindPackageHandleStandardArgs)
  20. find_package_handle_standard_args(
  21. FirebaseCore
  22. DEFAULT_MSG
  23. FIREBASECORE_LIBRARY
  24. )
  25. if(FIREBASECORE_FOUND)
  26. # Emulate CocoaPods behavior which makes all headers available unqualified.
  27. set(
  28. FIREBASECORE_INCLUDE_DIRS
  29. ${FIREBASECORE_LIBRARY}/Headers
  30. ${FIREBASECORE_LIBRARY}/PrivateHeaders
  31. )
  32. set(
  33. FIREBASECORE_LIBRARIES
  34. ${FIREBASECORE_LIBRARY}
  35. "-framework Foundation"
  36. )
  37. if(NOT TARGET FirebaseCore)
  38. # Add frameworks as INTERFACE libraries rather than IMPORTED so that
  39. # framework behavior is preserved.
  40. add_library(FirebaseCore INTERFACE)
  41. set_property(
  42. TARGET FirebaseCore APPEND PROPERTY
  43. INTERFACE_INCLUDE_DIRECTORIES ${FIREBASECORE_INCLUDE_DIRS}
  44. )
  45. set_property(
  46. TARGET FirebaseCore APPEND PROPERTY
  47. INTERFACE_LINK_LIBRARIES ${FIREBASECORE_LIBRARIES}
  48. )
  49. endif()
  50. endif(FIREBASECORE_FOUND)