UsewxWidgets.cmake 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. # PrusaSlicer: this is a direct copy of the UsewxWidgets.cmake module
  2. # within the original CMake 3.27 distribution
  3. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  4. # file Copyright.txt or https://cmake.org/licensing for details.
  5. #[=======================================================================[.rst:
  6. UsewxWidgets
  7. ------------
  8. Convenience include for using wxWidgets library.
  9. Determines if wxWidgets was FOUND and sets the appropriate libs,
  10. incdirs, flags, etc. INCLUDE_DIRECTORIES and LINK_DIRECTORIES are
  11. called.
  12. USAGE
  13. ::
  14. # Note that for MinGW users the order of libs is important!
  15. find_package(wxWidgets REQUIRED net gl core base)
  16. include(${wxWidgets_USE_FILE})
  17. # and for each of your dependent executable/library targets:
  18. target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
  19. DEPRECATED
  20. ::
  21. LINK_LIBRARIES is not called in favor of adding dependencies per target.
  22. AUTHOR
  23. ::
  24. Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
  25. #]=======================================================================]
  26. if (wxWidgets_FOUND)
  27. if (wxWidgets_INCLUDE_DIRS)
  28. if(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
  29. include_directories(${wxWidgets_INCLUDE_DIRS})
  30. else()
  31. include_directories(SYSTEM ${wxWidgets_INCLUDE_DIRS})
  32. endif()
  33. endif()
  34. if (wxWidgets_LIBRARY_DIRS)
  35. link_directories(${wxWidgets_LIBRARY_DIRS})
  36. endif()
  37. if (wxWidgets_DEFINITIONS)
  38. set_property(DIRECTORY APPEND
  39. PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS})
  40. endif()
  41. if (wxWidgets_DEFINITIONS_DEBUG)
  42. set_property(DIRECTORY APPEND
  43. PROPERTY COMPILE_DEFINITIONS_DEBUG ${wxWidgets_DEFINITIONS_DEBUG})
  44. endif()
  45. if (wxWidgets_CXX_FLAGS)
  46. # Flags are expected to be a string here, not a list.
  47. string(REPLACE ";" " " wxWidgets_CXX_FLAGS_str "${wxWidgets_CXX_FLAGS}")
  48. string(APPEND CMAKE_CXX_FLAGS " ${wxWidgets_CXX_FLAGS_str}")
  49. unset(wxWidgets_CXX_FLAGS_str)
  50. endif()
  51. else ()
  52. message("wxWidgets requested but not found.")
  53. endif()