Use_wxWindows.cmake 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file LICENSE.rst or https://cmake.org/licensing for details.
  3. #[=======================================================================[.rst:
  4. Use_wxWindows
  5. -------------
  6. .. deprecated:: 2.8.10
  7. This module should no longer be used. Use :module:`find_package(wxWidgets)
  8. <FindwxWidgets>` instead.
  9. This module serves as a convenience wrapper for finding the wxWidgets library
  10. (formerly known as wxWindows) and propagates its usage requirements, such as
  11. libraries, include directories, and compiler flags, into the current directory
  12. scope for use by targets.
  13. Load this module in a CMake project with:
  14. .. code-block:: cmake
  15. include(Use_wxWindows)
  16. Examples
  17. ^^^^^^^^
  18. In earlier versions of CMake, wxWidgets (wxWindows) could be found and used in
  19. the current directory like this:
  20. .. code-block:: cmake
  21. :caption: ``CMakeLists.txt``
  22. include(Use_wxWindows)
  23. To request OpenGL support, the ``WXWINDOWS_USE_GL`` variable could be set before
  24. including this module:
  25. .. code-block:: cmake
  26. :caption: ``CMakeLists.txt``
  27. set(WXWINDOWS_USE_GL ON)
  28. include(Use_wxWindows)
  29. add_library(example example.cxx)
  30. Starting with CMake 3.0, wxWidgets can be found using the
  31. :module:`FindwxWidgets` module, which provides the wxWidgets usage requirements
  32. either using result variables or imported target as of CMake 3.27:
  33. .. code-block:: cmake
  34. :caption: ``CMakeLists.txt``
  35. find_package(wxWidgets)
  36. add_library(example example.cxx)
  37. target_link_libraries(example PRIVATE wxWidgets::wxWidgets)
  38. #]=======================================================================]
  39. # Author: Jan Woetzel <jw -at- mip.informatik.uni-kiel.de> (07/2003)
  40. # -----------------------------------------------------
  41. # 16.Feb.2004: changed INCLUDE to FIND_PACKAGE to read from users own non-system CMAKE_MODULE_PATH (Jan Woetzel JW)
  42. # 07/2006: rewrite as FindwxWidgets.cmake, kept for backward compatibility JW
  43. message(
  44. DEPRECATION
  45. "Use_wxWindows module is DEPRECATED.\n"
  46. "Please use find_package(wxWidgets) instead. (JW)"
  47. )
  48. # ------------------------
  49. find_package( wxWindows )
  50. if(WXWINDOWS_FOUND)
  51. #message("DBG Use_wxWindows.cmake: WXWINDOWS_INCLUDE_DIR=${WXWINDOWS_INCLUDE_DIR} WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES} WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES} CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS} WXWINDOWS_DEFINITIONS=${WXWINDOWS_DEFINITIONS}")
  52. if(WXWINDOWS_INCLUDE_DIR)
  53. include_directories(${WXWINDOWS_INCLUDE_DIR})
  54. endif()
  55. if(WXWINDOWS_LINK_DIRECTORIES)
  56. link_directories(${WXWINDOWS_LINK_DIRECTORIES})
  57. endif()
  58. if(WXWINDOWS_LIBRARIES)
  59. link_libraries(${WXWINDOWS_LIBRARIES})
  60. endif()
  61. if (CMAKE_WXWINDOWS_CXX_FLAGS)
  62. string(APPEND CMAKE_CXX_FLAGS " ${CMAKE_WXWINDOWS_CXX_FLAGS}")
  63. endif()
  64. if(WXWINDOWS_DEFINITIONS)
  65. add_definitions(${WXWINDOWS_DEFINITIONS})
  66. endif()
  67. else()
  68. message(SEND_ERROR "wxWindows not found by Use_wxWindows.cmake")
  69. endif()