glfw.cmake 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. if(TARGET glfw::glfw)
  2. return()
  3. endif()
  4. message(STATUS "Third-party: creating target 'glfw::glfw'")
  5. include(FetchContent)
  6. FetchContent_Declare(
  7. glfw
  8. GIT_REPOSITORY https://github.com/glfw/glfw.git
  9. GIT_TAG 3327050ca66ad34426a82c217c2d60ced61526b7
  10. )
  11. option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" OFF)
  12. option(GLFW_BUILD_TESTS "Build the GLFW test programs" OFF)
  13. option(GLFW_BUILD_DOCS "Build the GLFW documentation" OFF)
  14. option(GLFW_INSTALL "Generate installation target" OFF)
  15. option(GLFW_VULKAN_STATIC "Use the Vulkan loader statically linked into application" OFF)
  16. FetchContent_MakeAvailable(glfw)
  17. add_library(glfw::glfw ALIAS glfw)
  18. set_target_properties(glfw PROPERTIES FOLDER ThirdParty)
  19. # Warning config
  20. if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "AppleClang")
  21. target_compile_options(glfw PRIVATE
  22. "-Wno-missing-field-initializers"
  23. "-Wno-objc-multiple-method-names"
  24. )
  25. elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
  26. target_compile_options(glfw PRIVATE
  27. "-Wno-missing-field-initializers"
  28. "-Wno-objc-multiple-method-names"
  29. )
  30. elseif("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
  31. target_compile_options(glfw PRIVATE
  32. "-Wno-missing-field-initializers"
  33. "-Wno-sign-compare"
  34. "-Wno-unused-parameter"
  35. )
  36. endif()