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.
6 # # Note that for MinGW users the order of libs is important!
7 # find_package(wxWidgets REQUIRED net gl core base)
8 # include(${wxWidgets_USE_FILE})
9 # # and for each of your dependent executable/library targets:
10 # target_link_libraries(<YourTarget> ${wxWidgets_LIBRARIES})
13 # LINK_LIBRARIES is not called in favor of adding dependencies per target.
16 # Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
18 #=============================================================================
19 # Copyright 2004-2009 Kitware, Inc.
20 # Copyright 2006 Jan Woetzel
22 # Distributed under the OSI-approved BSD License (the "License");
23 # see accompanying file Copyright.txt for details.
25 # This software is distributed WITHOUT ANY WARRANTY; without even the
26 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
27 # See the License for more information.
28 #=============================================================================
29 # (To distribute this file outside of CMake, substitute the full
30 # License text for the above reference.)
32 # debug message and logging.
33 # comment these out for distribution
35 # set(LOGFILE "${PROJECT_BINARY_DIR}/CMakeOutput.log")
38 # file(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}\n")
39 # message(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
43 MSG("wxWidgets_FOUND=${wxWidgets_FOUND}")
45 if (wxWidgets_INCLUDE_DIRS)
46 if(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
47 include_directories(${wxWidgets_INCLUDE_DIRS})
49 include_directories(SYSTEM ${wxWidgets_INCLUDE_DIRS})
51 MSG("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}")
54 if (wxWidgets_LIBRARY_DIRS)
55 link_directories(${wxWidgets_LIBRARY_DIRS})
56 MSG("wxWidgets_LIBRARY_DIRS=${wxWidgets_LIBRARY_DIRS}")
59 if (wxWidgets_DEFINITIONS)
60 set_property(DIRECTORY APPEND
61 PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS})
62 MSG("wxWidgets_DEFINITIONS=${wxWidgets_DEFINITIONS}")
65 if (wxWidgets_DEFINITIONS_DEBUG)
66 set_property(DIRECTORY APPEND
67 PROPERTY COMPILE_DEFINITIONS_DEBUG ${wxWidgets_DEFINITIONS_DEBUG})
68 MSG("wxWidgets_DEFINITIONS_DEBUG=${wxWidgets_DEFINITIONS_DEBUG}")
71 if (wxWidgets_CXX_FLAGS)
72 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
73 MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
77 # just for backward compatibility: add deps to all targets
78 # library projects better use advanced find_package(wxWidgets) directly.
79 #if(wxWidgets_LIBRARIES)
80 # link_libraries(${wxWidgets_LIBRARIES})
81 # # BUG: str too long: MSG("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}")
83 # file(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${wxWidgets_LIBRARIES}\n")
88 message("wxWidgets requested but not found.")