UsewxWidgets.cmake 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. # - Convenience include for using wxWidgets library.
  2. # Determines if wxWidgets was FOUND and sets the appropriate libs, incdirs,
  3. # flags, etc. INCLUDE_DIRECTORIES and LINK_DIRECTORIES are called.
  4. #
  5. # USAGE
  6. # FIND_PACKAGE(wxWidgets REQUIRED base core gl net)
  7. # INCLUDE(${wxWidgets_USE_FILE})
  8. # # and for each of your dependant executable/library targets:
  9. # TARGET_LINK_LIBRARIES(<YourTarget> ${wxWidgets_LIBRARIES})
  10. #
  11. # DEPRECATED
  12. # LINK_LIBRARIES is not called in favor of adding dependencies per target.
  13. #
  14. # AUTHOR
  15. # Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
  16. #=============================================================================
  17. # Copyright 2004-2009 Kitware, Inc.
  18. # Copyright 2006 Jan Woetzel
  19. #
  20. # Distributed under the OSI-approved BSD License (the "License");
  21. # see accompanying file Copyright.txt for details.
  22. #
  23. # This software is distributed WITHOUT ANY WARRANTY; without even the
  24. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  25. # See the License for more information.
  26. #=============================================================================
  27. # (To distribute this file outside of CMake, substitute the full
  28. # License text for the above reference.)
  29. # debug message and logging.
  30. # comment these out for distribution
  31. IF (NOT LOGFILE )
  32. # SET(LOGFILE "${PROJECT_BINARY_DIR}/CMakeOutput.log")
  33. ENDIF (NOT LOGFILE )
  34. MACRO(MSG _MSG)
  35. # FILE(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}\n")
  36. # MESSAGE(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
  37. ENDMACRO(MSG)
  38. MSG("wxWidgets_FOUND=${wxWidgets_FOUND}")
  39. IF (wxWidgets_FOUND)
  40. IF (wxWidgets_INCLUDE_DIRS)
  41. IF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
  42. INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS})
  43. ELSE(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
  44. INCLUDE_DIRECTORIES(SYSTEM ${wxWidgets_INCLUDE_DIRS})
  45. ENDIF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
  46. MSG("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}")
  47. ENDIF(wxWidgets_INCLUDE_DIRS)
  48. IF (wxWidgets_LIBRARY_DIRS)
  49. LINK_DIRECTORIES(${wxWidgets_LIBRARY_DIRS})
  50. MSG("wxWidgets_LIBRARY_DIRS=${wxWidgets_LIBRARY_DIRS}")
  51. ENDIF(wxWidgets_LIBRARY_DIRS)
  52. IF (wxWidgets_DEFINITIONS)
  53. SET_PROPERTY(DIRECTORY APPEND
  54. PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS})
  55. MSG("wxWidgets_DEFINITIONS=${wxWidgets_DEFINITIONS}")
  56. ENDIF(wxWidgets_DEFINITIONS)
  57. IF (wxWidgets_DEFINITIONS_DEBUG)
  58. SET_PROPERTY(DIRECTORY APPEND
  59. PROPERTY COMPILE_DEFINITIONS_DEBUG ${wxWidgets_DEFINITIONS_DEBUG})
  60. MSG("wxWidgets_DEFINITIONS_DEBUG=${wxWidgets_DEFINITIONS_DEBUG}")
  61. ENDIF(wxWidgets_DEFINITIONS_DEBUG)
  62. IF (wxWidgets_CXX_FLAGS)
  63. SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
  64. MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
  65. ENDIF(wxWidgets_CXX_FLAGS)
  66. # DEPRECATED JW
  67. # just for backward compatibility: add deps to all targets
  68. # library projects better use advanced FIND_PACKAGE(wxWidgets) directly.
  69. #IF(wxWidgets_LIBRARIES)
  70. # LINK_LIBRARIES(${wxWidgets_LIBRARIES})
  71. # # BUG: str too long: MSG("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}")
  72. # IF(LOGFILE)
  73. # FILE(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${wxWidgets_LIBRARIES}\n")
  74. # ENDIF(LOGFILE)
  75. #ENDIF(wxWidgets_LIBRARIES)
  76. ELSE (wxWidgets_FOUND)
  77. MESSAGE("wxWidgets requested but not found.")
  78. ENDIF(wxWidgets_FOUND)