validate_special_target.cmake 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. # This file is part of Desktop App Toolkit,
  2. # a set of libraries for developing nice desktop applications.
  3. #
  4. # For license and copyright information please follow this link:
  5. # https://github.com/desktop-app/legal/blob/master/LEGAL
  6. include(CMakeDependentOption)
  7. set(DESKTOP_APP_SPECIAL_TARGET "" CACHE STRING "Use special platform target, like 'macstore' for Mac App Store.")
  8. get_filename_component(libs_loc "../Libraries" REALPATH)
  9. set(libs_loc_exists 0)
  10. if (EXISTS ${libs_loc})
  11. set(libs_loc_exists 1)
  12. endif()
  13. cmake_dependent_option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." OFF libs_loc_exists ON)
  14. function(report_bad_special_target)
  15. if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")
  16. message(FATAL_ERROR "Bad special target '${DESKTOP_APP_SPECIAL_TARGET}'")
  17. endif()
  18. endfunction()
  19. if (NOT DESKTOP_APP_USE_PACKAGED)
  20. set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "Minimum macOS deployment version" FORCE)
  21. if (NOT DEFINED CMAKE_OSX_ARCHITECTURES)
  22. set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64" CACHE STRING "Target macOS architectures" FORCE)
  23. endif()
  24. endif()
  25. if (WIN32)
  26. if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp"
  27. AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwp64"
  28. AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win"
  29. AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "win64"
  30. AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "winarm"
  31. AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "uwparm")
  32. report_bad_special_target()
  33. endif()
  34. elseif (APPLE)
  35. if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "macstore"
  36. AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "mac")
  37. report_bad_special_target()
  38. endif()
  39. else()
  40. set(LINUX 1)
  41. if (NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "linux")
  42. report_bad_special_target()
  43. endif()
  44. endif()