ENH: add support for g77 extra _ at the end of functions that have an _ in the name...
[cmake.git] / Modules / UsewxWidgets.cmake
blob6f5cb264248df59b25a3d46ec51784cceadb1dcf
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
5 # are called.
7 # USAGE
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})
14 # DEPRECATED
15 #  LINK_LIBRARIES is not called in favor of adding dependencies per target.
17 # AUTHOR
18 #  Jan Woetzel <jw -at- mip.informatik.uni-kiel.de>
21 # debug message and logging.
22 # comment these out for distribution
23 IF    (NOT LOGFILE )
24   #  SET(LOGFILE "${PROJECT_BINARY_DIR}/CMakeOutput.log")
25 ENDIF (NOT LOGFILE )
26 MACRO(MSG _MSG)
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}")
29 ENDMACRO(MSG)
32 MSG("wxWidgets_FOUND=${wxWidgets_FOUND}")
33 IF   (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     ADD_DEFINITIONS( ${wxWidgets_DEFINITIONS} )
50     MSG("wxWidgets_DEFINITIONS=${wxWidgets_DEFINITIONS}")
51   ENDIF(wxWidgets_DEFINITIONS)
53   IF   (wxWidgets_CXX_FLAGS)
54     SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${wxWidgets_CXX_FLAGS}")
55     MSG("wxWidgets_CXX_FLAGS=${wxWidgets_CXX_FLAGS}")
56   ENDIF(wxWidgets_CXX_FLAGS)
58   # DEPRECATED JW
59   # just for backward compatibility: add deps to all targets
60   # library projects better use advanced FIND_PACKAGE(wxWidgets) directly.
61   #IF(wxWidgets_LIBRARIES)
62   #  LINK_LIBRARIES(${wxWidgets_LIBRARIES})
63   #  # BUG: str too long:  MSG("wxWidgets_LIBRARIES=${wxWidgets_LIBRARIES}")
64   #  IF(LOGFILE)
65   #    FILE(APPEND ${LOGFILE} "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}):   ${wxWidgets_LIBRARIES}\n")
66   #  ENDIF(LOGFILE)
67   #ENDIF(wxWidgets_LIBRARIES)
69 ELSE (wxWidgets_FOUND)
70   MESSAGE("wxWidgets requested but not found.")
71 ENDIF(wxWidgets_FOUND)