1 # - Convenience include for using wxWidgets library
2 # Finds if wxWidgets is installed
3 # and set the appropriate libs, incdirs, flags etc.
4 # INCLUDE_DIRECTORIES, LINK_DIRECTORIES and ADD_DEFINITIONS
8 # SET( wxWidgets_USE_LIBS gl xml xrc ) # optionally: more than wx std libs
9 # FIND_PACKAGE(wxWidgets REQUIRED)
10 # INCLUDE( ${xWidgets_USE_FILE} )
11 # ... add your targets here, e.g. ADD_EXECUTABLE/ ADD_LIBRARY ...
12 # TARGET_LINK_LIBRARIERS( <yourWxDependantTarget> ${wxWidgets_LIBRARIES})
15 # LINK_LIBRARIES is not called in favor of adding dependencies per target.
18 # Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
21 # debug message and logging.
22 # comment these out for distribution
24 # SET(LOGFILE "${PROJECT_BINARY_DIR}/CMakeOutput.log")
27 # FILE(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}\n")
28 # MESSAGE(STATUS "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
32 MSG("wxWidgets_FOUND=${wxWidgets_FOUND}")
34 IF (wxWidgets_INCLUDE_DIRS)
35 IF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
36 INCLUDE_DIRECTORIES(${wxWidgets_INCLUDE_DIRS})
37 ELSE(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
38 INCLUDE_DIRECTORIES(SYSTEM ${wxWidgets_INCLUDE_DIRS})
39 ENDIF(wxWidgets_INCLUDE_DIRS_NO_SYSTEM)
40 MSG("wxWidgets_INCLUDE_DIRS=${wxWidgets_INCLUDE_DIRS}")
41 ENDIF(wxWidgets_INCLUDE_DIRS)
43 IF (wxWidgets_LIBRARY_DIRS)
44 LINK_DIRECTORIES(${wxWidgets_LIBRARY_DIRS})
45 MSG("wxWidgets_LIBRARY_DIRS=${wxWidgets_LIBRARY_DIRS}")
46 ENDIF(wxWidgets_LIBRARY_DIRS)
48 IF (wxWidgets_DEFINITIONS)
49 SET_PROPERTY(DIRECTORY APPEND
50 PROPERTY COMPILE_DEFINITIONS ${wxWidgets_DEFINITIONS})
51 MSG("wxWidgets_DEFINITIONS=${wxWidgets_DEFINITIONS}")
52 ENDIF(wxWidgets_DEFINITIONS)
54 IF (wxWidgets_DEFINITIONS_DEBUG)
55 SET_PROPERTY(DIRECTORY APPEND
56 PROPERTY COMPILE_DEFINITIONS_DEBUG ${wxWidgets_DEFINITIONS_DEBUG})
57 MSG("wxWidgets_DEFINITIONS_DEBUG=${wxWidgets_DEFINITIONS_DEBUG}")
58 ENDIF(wxWidgets_DEFINITIONS_DEBUG)
60 IF (wxWidgets_CXX_FLAGS)
61 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
62 MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
63 ENDIF(wxWidgets_CXX_FLAGS)
66 # just for backward compatibility: add deps to all targets
67 # library projects better use advanced FIND_PACKAGE(wxWidgets) directly.
68 #IF(wxWidgets_LIBRARIES)
69 # LINK_LIBRARIES(${wxWidgets_LIBRARIES})
70 # # BUG: str too long: MSG("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}")
72 # FILE(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${wxWidgets_LIBRARIES}\n")
74 #ENDIF(wxWidgets_LIBRARIES)
76 ELSE (wxWidgets_FOUND)
77 MESSAGE("wxWidgets requested but not found.")
78 ENDIF(wxWidgets_FOUND)