Merge topic 'cuda_add_12.8_new_sm_support'
[kiteware-cmake.git] / Modules / FindwxWindows.cmake
blob1e345d09b19c0f00196f7622b69814db7a843e86
1 # Distributed under the OSI-approved BSD 3-Clause License.  See accompanying
2 # file Copyright.txt or https://cmake.org/licensing for details.
4 #[=======================================================================[.rst:
5 FindwxWindows
6 -------------
8 .. deprecated:: 3.0
10   Replaced by :module:`FindwxWidgets`.
12 Find wxWindows (wxWidgets) installation
14 This module finds if wxWindows/wxWidgets is installed and determines
15 where the include files and libraries are.  It also determines what
16 the name of the library is.  This code sets the following variables:
20   WXWINDOWS_FOUND     = system has WxWindows
21   WXWINDOWS_LIBRARIES = path to the wxWindows libraries
22                         on Unix/Linux with additional
23                         linker flags from
24                         "wx-config --libs"
25   CMAKE_WXWINDOWS_CXX_FLAGS  = Compiler flags for wxWindows,
26                                essentially "`wx-config --cxxflags`"
27                                on Linux
28   WXWINDOWS_INCLUDE_DIR      = where to find "wx/wx.h" and "wx/setup.h"
29   WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on
30                                 Unix
31   WXWINDOWS_DEFINITIONS      = extra defines
35 OPTIONS If you need OpenGL support please
37 .. code-block:: cmake
39   set(WXWINDOWS_USE_GL 1)
41 in your CMakeLists.txt *before* you include this file.
45   HAVE_ISYSTEM      - true required to replace -I by -isystem on g++
49 For convenience include Use_wxWindows.cmake in your project's
50 CMakeLists.txt using
51 include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.cmake).
53 USAGE
55 .. code-block:: cmake
57   set(WXWINDOWS_USE_GL 1)
58   find_package(wxWindows)
62 NOTES wxWidgets 2.6.x is supported for monolithic builds e.g.
63 compiled in wx/build/msw dir as:
67   nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONOLITHIC=1
71 DEPRECATED
75   CMAKE_WX_CAN_COMPILE
76   WXWINDOWS_LIBRARY
77   CMAKE_WX_CXX_FLAGS
78   WXWINDOWS_INCLUDE_PATH
82 AUTHOR Jan Woetzel (07/2003-01/2006)
83 #]=======================================================================]
85 # ------------------------------------------------------------------
87 # -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it before calling this.
88 # -major update for wx 2.6.2 and monolithic build option. (10/2005)
90 # STATUS
91 # tested with:
92 #  cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95
93 #  cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3
94 #  cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1,  gcc 3.3
95 #  cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7 2002 (static build)
96 #  cmake 2.0.5 on Windows XP and Suse Linux 9.2
97 #  cmake 2.0.6 on Windows XP and Suse Linux 9.2, wxWidgets 2.6.2 MONOLITHIC build
98 #  cmake 2.2.2 on Windows XP, MS Visual Studio .net 2003 7.1 wxWidgets 2.6.2 MONOLITHIC build
100 # TODO
101 #  -OPTION for unicode builds
102 #  -further testing of DLL linking under MS WIN32
103 #  -better support for non-monolithic builds
107 if(WIN32)
108   set(WIN32_STYLE_FIND 1)
109 endif()
110 if(MINGW)
111   set(WIN32_STYLE_FIND 0)
112   set(UNIX_STYLE_FIND 1)
113 endif()
114 if(UNIX)
115   set(UNIX_STYLE_FIND 1)
116 endif()
119 if(WIN32_STYLE_FIND)
121   ## ######################################################################
122   ##
123   ## Windows specific:
124   ##
125   ## candidates for root/base directory of wxwindows
126   ## should have subdirs include and lib containing include/wx/wx.h
127   ## fix the root dir to avoid mixing of headers/libs from different
128   ## versions/builds:
130   ## WX supports monolithic and multiple smaller libs (since 2.5.x), we prefer monolithic for now.
131   ## monolithic = WX is built as a single big library
132   ## e.g. compile on WIN32 as  "nmake -f makefile.vc MONOLITHIC=1 BUILD=debug SHARED=0 USE_OPENGL=1" (JW)
133   option(WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON)
134   mark_as_advanced(WXWINDOWS_USE_MONOLITHIC)
136   ## GL libs used?
137   option(WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON)
138   mark_as_advanced(WXWINDOWS_USE_GL)
141   ## avoid mixing of headers and libs between multiple installed WX versions,
142   ## select just one tree here:
143   find_path(WXWINDOWS_ROOT_DIR  include/wx/wx.h
144     HINTS
145       ENV WXWIN
146       "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]"  ## WX 2.6.x
147       "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]"  ## WX 2.4.x
148     PATHS
149       C:/wxWidgets-2.6.2
150       D:/wxWidgets-2.6.2
151       C:/wxWidgets-2.6.1
152       D:/wxWidgets-2.6.1
153       C:/wxWindows-2.4.2
154       D:/wxWindows-2.4.2
155   )
156   # message("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}")
159   ## find libs for combination of static/shared with release/debug
160   ## be careful if you add something here,
161   ## avoid mixing of headers and libs of different wx versions,
162   ## there may be multiple WX versions installed.
163   set (WXWINDOWS_POSSIBLE_LIB_PATHS
164     "${WXWINDOWS_ROOT_DIR}/lib"
165     )
167   ## monolithic?
168   if (WXWINDOWS_USE_MONOLITHIC)
170     find_library(WXWINDOWS_STATIC_LIBRARY
171       NAMES wx wxmsw wxmsw26
172       PATHS
173       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
174       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
175       DOC "wxWindows static release build library" )
177     find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY
178       NAMES wxd wxmswd wxmsw26d
179       PATHS
180       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
181       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
182       DOC "wxWindows static debug build library" )
184     find_library(WXWINDOWS_SHARED_LIBRARY
185       NAMES wxmsw26 wxmsw262 wxmsw24 wxmsw242 wxmsw241 wxmsw240 wx23_2 wx22_9
186       PATHS
187       "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
188       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
189       DOC "wxWindows shared release build library" )
191     find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY
192       NAMES wxmsw26d wxmsw262d wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d
193       PATHS
194       "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
195       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
196       DOC "wxWindows shared debug build library " )
199     ##
200     ## required for WXWINDOWS_USE_GL
201     ## gl lib is always build separate:
202     ##
203     find_library(WXWINDOWS_STATIC_LIBRARY_GL
204       NAMES wx_gl wxmsw_gl wxmsw26_gl
205       PATHS
206       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
207       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
208       DOC "wxWindows static release build GL library" )
210     find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
211       NAMES wxd_gl wxmswd_gl wxmsw26d_gl
212       PATHS
213       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
214       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
215       DOC "wxWindows static debug build GL library" )
218     find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
219       NAMES wxpngd
220       PATHS
221       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
222       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
223       DOC "wxWindows static debug png library" )
225     find_library(WXWINDOWS_STATIC_LIBRARY_PNG
226       NAMES wxpng
227       PATHS
228       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
229       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
230       DOC "wxWindows static png library" )
232     find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
233       NAMES wxtiffd
234       PATHS
235       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
236       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
237       DOC "wxWindows static debug tiff library" )
239     find_library(WXWINDOWS_STATIC_LIBRARY_TIFF
240       NAMES wxtiff
241       PATHS
242       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
243       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
244       DOC "wxWindows static tiff library" )
246     find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
247       NAMES wxjpegd  wxjpgd
248       PATHS
249       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
250       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
251       DOC "wxWindows static debug jpeg library" )
253     find_library(WXWINDOWS_STATIC_LIBRARY_JPEG
254       NAMES wxjpeg wxjpg
255       PATHS
256       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
257       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
258       DOC "wxWindows static jpeg library" )
260     find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
261       NAMES wxzlibd
262       PATHS
263       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
264       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
265       DOC "wxWindows static debug zlib library" )
267     find_library(WXWINDOWS_STATIC_LIBRARY_ZLIB
268       NAMES wxzlib
269       PATHS
270       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
271       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
272       DOC "wxWindows static zib library" )
274     find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
275       NAMES wxregexd
276       PATHS
277       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
278       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
279       DOC "wxWindows static debug regex library" )
281     find_library(WXWINDOWS_STATIC_LIBRARY_REGEX
282       NAMES wxregex
283       PATHS
284       "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
285       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
286       DOC "wxWindows static regex library" )
290     ## untested:
291     find_library(WXWINDOWS_SHARED_LIBRARY_GL
292       NAMES wx_gl wxmsw_gl wxmsw26_gl
293       PATHS
294       "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
295       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
296       DOC "wxWindows shared release build GL library" )
298     find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
299       NAMES wxd_gl wxmswd_gl wxmsw26d_gl
300       PATHS
301       "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
302       ${WXWINDOWS_POSSIBLE_LIB_PATHS}
303       DOC "wxWindows shared debug build GL library" )
306   else ()
307     ## WX is built as multiple small pieces libraries instead of monolithic
309     ## DEPRECATED (jw) replaced by more general WXWINDOWS_USE_MONOLITHIC ON/OFF
310     # option(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF)
312     ## HACK: This is very dirty.
313     ## because the libs of a particular version are explicitly listed
314     ## and NOT searched/verified.
315     ## TODO:  Really search for each lib, then decide for
316     ## monolithic x debug x shared x GL (=16 combinations) for at least 18 libs
317     ## -->  about 288 combinations
318     ## thus we need a different approach so solve this correctly ...
320     message(STATUS "Warning: You are trying to use wxWidgets without monolithic build (WXWINDOWS_SEPARATE_LIBS_BUILD). This is a HACK, libraries are not verified! (JW).")
322     set(WXWINDOWS_STATIC_LIBS ${WXWINDOWS_STATIC_LIBS}
323       wxbase26
324       wxbase26_net
325       wxbase26_odbc
326       wxbase26_xml
327       wxmsw26_adv
328       wxmsw26_core
329       wxmsw26_dbgrid
330       wxmsw26_gl
331       wxmsw26_html
332       wxmsw26_media
333       wxmsw26_qa
334       wxmsw26_xrc
335       wxexpat
336       wxjpeg
337       wxpng
338       wxregex
339       wxtiff
340       wxzlib
341       comctl32
342       rpcrt4
343       wsock32
344       )
345     ## HACK: feed in to optimized / debug libraries if both were FOUND.
346     set(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS}
347       wxbase26d
348       wxbase26d_net
349       wxbase26d_odbc
350       wxbase26d_xml
351       wxmsw26d_adv
352       wxmsw26d_core
353       wxmsw26d_dbgrid
354       wxmsw26d_gl
355       wxmsw26d_html
356       wxmsw26d_media
357       wxmsw26d_qa
358       wxmsw26d_xrc
359       wxexpatd
360       wxjpegd
361       wxpngd
362       wxregexd
363       wxtiffd
364       wxzlibd
365       comctl32
366       rpcrt4
367       wsock32
368       )
369   endif ()
372   ##
373   ## now we should have found all WX libs available on the system.
374   ## let the user decide which of the available onse to use.
375   ##
377   ## if there is at least one shared lib available
378   ## let user choose whether to use shared or static wxwindows libs
379   if(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
380     ## default value OFF because wxWindows MSVS default build is static
381     option(WXWINDOWS_USE_SHARED_LIBS
382       "Use shared versions (dll) of wxWindows libraries?" OFF)
383     mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS)
384   endif()
386   ## add system libraries wxwindows always seems to depend on
387   set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
388     comctl32
389     rpcrt4
390     wsock32
391     )
393   if (NOT WXWINDOWS_USE_SHARED_LIBS)
394     set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
395       ##  these ones don't seem required, in particular  ctl3d32 is not necessary (Jan Woetzel 07/2003)
396       #   ctl3d32
397       debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB}   optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB}
398       debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX}  optimized ${WXWINDOWS_STATIC_LIBRARY_REGEX}
399       debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG}    optimized ${WXWINDOWS_STATIC_LIBRARY_PNG}
400       debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG}   optimized ${WXWINDOWS_STATIC_LIBRARY_JPEG}
401       debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF}   optimized ${WXWINDOWS_STATIC_LIBRARY_TIFF}
402       )
403   endif ()
405   ## opengl/glu: TODO/FIXME: better use FindOpenGL.cmake here
406   ## assume release versions of glu an dopengl, here.
407   if (WXWINDOWS_USE_GL)
408     set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
409       opengl32
410       glu32 )
411   endif ()
413   ##
414   ## select between use of  shared or static wxWindows lib then set libs to use
415   ## for debug and optimized build.  so the user can switch between debug and
416   ## release build e.g. within MS Visual Studio without running cmake with a
417   ## different build directory again.
418   ##
419   ## then add the build specific include dir for wx/setup.h
420   ##
422   if(WXWINDOWS_USE_SHARED_LIBS)
423     ##message("DBG wxWindows use shared lib selected.")
424     ## assume that both builds use the same setup(.h) for simplicity
426     ## shared: both wx (debug and release) found?
427     ## assume that both builds use the same setup(.h) for simplicity
428     if(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
429       ##message("DBG wx shared: debug and optimized found.")
430       find_path(WXWINDOWS_INCLUDE_DIR_SETUPH  wx/setup.h
431         ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
432         ${WXWINDOWS_ROOT_DIR}/lib/mswdll
433         ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd
434         ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw )
435       set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
436         debug     ${WXWINDOWS_SHARED_DEBUG_LIBRARY}
437         optimized ${WXWINDOWS_SHARED_LIBRARY} )
438       if (WXWINDOWS_USE_GL)
439         set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
440           debug     ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL}
441           optimized ${WXWINDOWS_SHARED_LIBRARY_GL} )
442       endif ()
443     endif()
445     ## shared: only debug wx lib found?
446     if(WXWINDOWS_SHARED_DEBUG_LIBRARY)
447       if(NOT WXWINDOWS_SHARED_LIBRARY)
448         ##message("DBG wx shared: debug (but no optimized) found.")
449         find_path(WXWINDOWS_INCLUDE_DIR_SETUPH  wx/setup.h
450           ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
451           ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd  )
452         set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
453           ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
454         if (WXWINDOWS_USE_GL)
455           set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
456             ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
457         endif ()
458       endif()
459     endif()
461     ## shared: only release wx lib found?
462     if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
463       if(WXWINDOWS_SHARED_LIBRARY)
464         ##message("DBG wx shared: optimized (but no debug) found.")
465         find_path(WXWINDOWS_INCLUDE_DIR_SETUPH  wx/setup.h
466           ${WXWINDOWS_ROOT_DIR}/lib/mswdll
467           ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw  )
468         set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
469           ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
470         if (WXWINDOWS_USE_GL)
471           set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
472             ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
473         endif ()
474       endif()
475     endif()
477     ## shared: none found?
478     if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
479       if(NOT WXWINDOWS_SHARED_LIBRARY)
480         message(STATUS
481           "No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
482       endif()
483     endif()
485     #########################################################################################
486   else()
488     ##jw: DEPRECATED if(NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
490     ## static: both wx (debug and release) found?
491     ## assume that both builds use the same setup(.h) for simplicity
492     if(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
493       ##message("DBG wx static: debug and optimized found.")
494       find_path(WXWINDOWS_INCLUDE_DIR_SETUPH  wx/setup.h
495         ${WXWINDOWS_ROOT_DIR}/lib/mswd
496         ${WXWINDOWS_ROOT_DIR}/lib/msw
497         ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd
498         ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
499       set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
500         debug     ${WXWINDOWS_STATIC_DEBUG_LIBRARY}
501         optimized ${WXWINDOWS_STATIC_LIBRARY} )
502       if (WXWINDOWS_USE_GL)
503         set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
504           debug     ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL}
505           optimized ${WXWINDOWS_STATIC_LIBRARY_GL} )
506       endif ()
507     endif()
509     ## static: only debug wx lib found?
510     if(WXWINDOWS_STATIC_DEBUG_LIBRARY)
511       if(NOT WXWINDOWS_STATIC_LIBRARY)
512         ##message("DBG wx static: debug (but no optimized) found.")
513         find_path(WXWINDOWS_INCLUDE_DIR_SETUPH  wx/setup.h
514           ${WXWINDOWS_ROOT_DIR}/lib/mswd
515           ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd  )
516         set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
517           ${WXWINDOWS_STATIC_DEBUG_LIBRARY} )
518         if (WXWINDOWS_USE_GL)
519           set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
520             ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL} )
521         endif ()
522       endif()
523     endif()
525     ## static: only release wx lib found?
526     if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
527       if(WXWINDOWS_STATIC_LIBRARY)
528         ##message("DBG wx static: optimized (but no debug) found.")
529         find_path(WXWINDOWS_INCLUDE_DIR_SETUPH  wx/setup.h
530           ${WXWINDOWS_ROOT_DIR}/lib/msw
531           ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
532         set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
533           ${WXWINDOWS_STATIC_LIBRARY} )
534         if (WXWINDOWS_USE_GL)
535           set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
536             ${WXWINDOWS_STATIC_LIBRARY_GL} )
537         endif ()
538       endif()
539     endif()
541     ## static: none found?
542     if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
543       if(NOT WXWINDOWS_STATIC_LIBRARY)
544         message(STATUS
545           "No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
546       endif()
547     endif()
548   endif()
551   ## not necessary in wxWindows 2.4.1 and 2.6.2
552   ## but it may fix a previous bug, see
553   ## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap
554   option(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF)
555   mark_as_advanced(WXWINDOWS_SET_DEFINITIONS)
556   if (WXWINDOWS_SET_DEFINITIONS)
557     set(WXWINDOWS_DEFINITIONS "-DWINVER=0x400")
558   else ()
559     # clear:
560     set(WXWINDOWS_DEFINITIONS "")
561   endif ()
565   ## Find the include directories for wxwindows
566   ## the first, build specific for wx/setup.h was determined before.
567   ## add inc dir for general for "wx/wx.h"
568   find_path(WXWINDOWS_INCLUDE_DIR  wx/wx.h
569     "${WXWINDOWS_ROOT_DIR}/include" )
570   ## append the build specific include dir for wx/setup.h:
571   if (WXWINDOWS_INCLUDE_DIR_SETUPH)
572     set(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} )
573   endif ()
577   mark_as_advanced(
578     WXWINDOWS_ROOT_DIR
579     WXWINDOWS_INCLUDE_DIR
580     WXWINDOWS_INCLUDE_DIR_SETUPH
581     WXWINDOWS_STATIC_LIBRARY
582     WXWINDOWS_STATIC_LIBRARY_GL
583     WXWINDOWS_STATIC_DEBUG_LIBRARY
584     WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
585     WXWINDOWS_STATIC_LIBRARY_ZLIB
586     WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
587     WXWINDOWS_STATIC_LIBRARY_REGEX
588     WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
589     WXWINDOWS_STATIC_LIBRARY_PNG
590     WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
591     WXWINDOWS_STATIC_LIBRARY_JPEG
592     WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
593     WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
594     WXWINDOWS_STATIC_LIBRARY_TIFF
595     WXWINDOWS_SHARED_LIBRARY
596     WXWINDOWS_SHARED_DEBUG_LIBRARY
597     WXWINDOWS_SHARED_LIBRARY_GL
598     WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
599     )
602 else()
604   if (UNIX_STYLE_FIND)
605     ## ######################################################################
606     ##
607     ## UNIX/Linux specific:
608     ##
609     ## use backquoted wx-config to query and set flags and libs:
610     ## 06/2003 Jan Woetzel
611     ##
613     option(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON)
614     mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS)
616     # JW removed option and force the developer to SET it.
617     # option(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional
618     # --gl-libs for wx-config)?" OFF)
620     # wx-config should be in your path anyhow, usually no need to set WXWIN or
621     # search in ../wx or ../../wx
622     find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
623       NAMES $ENV{WX_CONFIG} wx-config
624       HINTS
625         ENV WXWIN
626         $ENV{WXWIN}/bin
627       PATHS
628       ../wx/bin
629       ../../wx/bin )
631     # check whether wx-config was found:
632     if(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
634       # use shared/static wx lib?
635       # remember: always link shared to use systems GL etc. libs (no static
636       # linking, just link *against* static .a libs)
637       if(WXWINDOWS_USE_SHARED_LIBS)
638         set(WX_CONFIG_ARGS_LIBS --libs)
639       else()
640         set(WX_CONFIG_ARGS_LIBS --static --libs)
641       endif()
643       # do we need additionial wx GL stuff like GLCanvas ?
644       if(WXWINDOWS_USE_GL)
645         list(APPEND WX_CONFIG_ARGS_LIBS --gl-libs)
646       endif()
647       ##message("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===")
649       # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user:
650       if (HAVE_ISYSTEM) # does the compiler support -isystem ?
651               if (NOT APPLE) # -isystem seems to be unsupported on Mac
652                 if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
653             if (CMAKE_CXX_COMPILER MATCHES g\\+\\+)
654               set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`")
655             else()
656               set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`")
657             endif()
658                 endif()
659               endif ()
660       endif ()
661       ##message("DBG: for compilation:
662       ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===")
664       # keep the back-quoted string for clarity
665       string(REPLACE ";" " " _wx_config_args_libs "${WX_CONFIG_ARGS_LIBS}")
666       set(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${_wx_config_args_libs}`")
667       ##message("DBG2: for linking:
668       ##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===")
670       # evaluate wx-config output to separate linker flags and linkdirs for
671       # rpath:
672       execute_process(COMMAND ${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
673         ${WX_CONFIG_ARGS_LIBS}
674         OUTPUT_VARIABLE WX_CONFIG_LIBS )
676       ## extract linkdirs (-L) for rpath
677       ## use regular expression to match wildcard equivalent "-L*<endchar>"
678       ## with <endchar> is a space or a semicolon
679       string(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" )
680       # message("DBG  WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}")
682       ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES
683       ## replace -L by ; because the separator seems to be lost otherwise (bug or
684       ## feature?)
685       if(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
686         string(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} )
687         # message("DBG  WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}")
688       endif()
691       ## replace space separated string by semicolon separated vector to make it
692       ## work with LINK_DIRECTORIES
693       separate_arguments(WXWINDOWS_LINK_DIRECTORIES)
695       mark_as_advanced(
696         CMAKE_WXWINDOWS_CXX_FLAGS
697         WXWINDOWS_INCLUDE_DIR
698         WXWINDOWS_LIBRARIES
699         CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
700         )
703       ## we really need wx-config...
704     else()
705       message(STATUS "Cannot find wx-config anywhere on the system. Please put the file into your path or specify it in CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE.")
706       mark_as_advanced(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
707     endif()
711   else()
712     message(STATUS "FindwxWindows.cmake:  Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX")
713   endif()
714 endif()
717 if(WXWINDOWS_LIBRARIES)
718   if(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
719     ## found all we need.
720     set(WXWINDOWS_FOUND 1)
722     ## set deprecated variables for backward compatibility:
723     set(CMAKE_WX_CAN_COMPILE   ${WXWINDOWS_FOUND})
724     set(WXWINDOWS_LIBRARY     ${WXWINDOWS_LIBRARIES})
725     set(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR})
726     set(WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES})
727     set(CMAKE_WX_CXX_FLAGS     ${CMAKE_WXWINDOWS_CXX_FLAGS})
729   endif()
730 endif()