DependenciesForShell.cmake 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637
  1. #[[
  2. Set up external dependencies required by the shell utility library used by the samples.
  3. ]]
  4. # RMLUI_CMAKE_MINIMUM_VERSION_RAISE_NOTICE:
  5. # CMake >= 3.18 introduces the REQUIRED option for find_library() calls. Guaranteeing the presence of the platform SDK
  6. # by making these calls to find_library() REQUIRED should be investigated.
  7. # More info: https://cmake.org/cmake/help/latest/command/find_library.html
  8. # Link against required libraries from Windows
  9. if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
  10. # Required to use the functions from the shlwapi.h header
  11. find_library(Shlwapi NAMES "Shlwapi" "Shlwapi.lib" "Shlwapi.dll")
  12. if(NOT Shlwapi)
  13. # Many platform libraries are still available to linkers even if CMake cannot find them
  14. # Ignore the fact that the Shlwapi wasn't found and try to link against it anyway
  15. set(Shlwapi "Shlwapi")
  16. endif()
  17. # Set up wrapper target
  18. add_library(Windows::Shell::LightweightUtility INTERFACE IMPORTED)
  19. target_link_libraries(Windows::Shell::LightweightUtility INTERFACE ${Shlwapi})
  20. # Link against required libraries from macOS
  21. elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
  22. # Required to use the functions from the Cocoa framework
  23. find_library(Cocoa NAMES "Cocoa" "Cocoa.framework")
  24. if(NOT Cocoa)
  25. # Many platform libraries are still available to linkers even if CMake cannot find them
  26. # Ignore the fact that the Cocoa wasn't found and try to link against it anyway
  27. set(Cocoa "Cocoa")
  28. endif()
  29. # Set up wrapper target
  30. add_library(macOS::Cocoa INTERFACE IMPORTED)
  31. target_link_libraries(macOS::Cocoa INTERFACE ${Cocoa})
  32. endif()