1 # - Find wxWindows (wxWidgets) installation
2 # This module finds if wxWindows/wxWidgets is installed and determines where
3 # the include files and libraries are. It also determines what the name of
5 # Please note this file is DEPRECATED and replaced by FindwxWidgets.cmake.
6 # This code sets the following variables:
8 # WXWINDOWS_FOUND = system has WxWindows
9 # WXWINDOWS_LIBRARIES = path to the wxWindows libraries
10 # on Unix/Linux with additional
13 # CMAKE_WXWINDOWS_CXX_FLAGS = Compiler flags for wxWindows,
14 # essentially "`wx-config --cxxflags`"
16 # WXWINDOWS_INCLUDE_DIR = where to find "wx/wx.h" and "wx/setup.h"
17 # WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on
19 # WXWINDOWS_DEFINITIONS = extra defines
22 # If you need OpenGL support please
23 # SET(WXWINDOWS_USE_GL 1)
24 # in your CMakeLists.txt *before* you include this file.
26 # HAVE_ISYSTEM - true required to replace -I by -isystem on g++
28 # For convenience include Use_wxWindows.cmake in your project's
29 # CMakeLists.txt using INCLUDE(Use_wxWindows).
32 # SET(WXWINDOWS_USE_GL 1)
33 # FIND_PACKAGE(wxWindows)
36 # wxWidgets 2.6.x is supported for monolithic builds
37 # e.g. compiled in wx/build/msw dir as:
38 # nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONOLITHIC=1
42 # CMAKE_WX_CAN_COMPILE
45 # WXWINDOWS_INCLUDE_PATH
48 # Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw> (07/2003-01/2006)
51 # ------------------------------------------------------------------
53 # -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it before calling this.
54 # -major update for wx 2.6.2 and monolithic build option. (10/2005)
58 # cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95
59 # cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3
60 # cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1, gcc 3.3
61 # cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7 2002 (static build)
62 # cmake 2.0.5 on Windows XP and Suse Linux 9.2
63 # cmake 2.0.6 on Windows XP and Suse Linux 9.2, wxWidgets 2.6.2 MONOLITHIC build
64 # cmake 2.2.2 on Windows XP, MS Visual Studio .net 2003 7.1 wxWidgets 2.6.2 MONOLITHIC build
67 # -OPTION for unicode builds
68 # -further testing of DLL linking under MS WIN32
69 # -better support for non-monolithic builds
74 SET(WIN32_STYLE_FIND 1)
77 SET(WIN32_STYLE_FIND 0)
78 SET(UNIX_STYLE_FIND 1)
81 SET(UNIX_STYLE_FIND 1)
87 ## ######################################################################
91 ## candidates for root/base directory of wxwindows
92 ## should have subdirs include and lib containing include/wx/wx.h
93 ## fix the root dir to avoid mixing of headers/libs from different
96 SET (WXWINDOWS_POSSIBLE_ROOT_PATHS
98 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" ## WX 2.6.x
99 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" ## WX 2.4.x
108 ## WX supports monolithic and multiple smaller libs (since 2.5.x), we prefer monolithic for now.
109 ## monolithic = WX is built as a single big library
110 ## e.g. compile on WIN32 as "nmake -f makefile.vc MONOLITHIC=1 BUILD=debug SHARED=0 USE_OPENGL=1" (JW)
111 OPTION(WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON)
112 MARK_AS_ADVANCED(WXWINDOWS_USE_MONOLITHIC)
115 OPTION(WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON)
116 MARK_AS_ADVANCED(WXWINDOWS_USE_GL)
119 ## avoid mixing of headers and libs between multiple installed WX versions,
120 ## select just one tree here:
121 FIND_PATH(WXWINDOWS_ROOT_DIR include/wx/wx.h
122 ${WXWINDOWS_POSSIBLE_ROOT_PATHS} )
123 # MESSAGE("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}")
126 ## find libs for combination of static/shared with release/debug
127 ## be careful if you add something here,
128 ## avoid mixing of headers and libs of different wx versions,
129 ## there may be multiple WX version s installed.
130 SET (WXWINDOWS_POSSIBLE_LIB_PATHS
131 "${WXWINDOWS_ROOT_DIR}/lib"
135 IF (WXWINDOWS_USE_MONOLITHIC)
137 FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY
138 NAMES wx wxmsw wxmsw26
140 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
141 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
142 DOC "wxWindows static release build library" )
144 FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY
145 NAMES wxd wxmswd wxmsw26d
147 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
148 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
149 DOC "wxWindows static debug build library" )
151 FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY
152 NAMES wxmsw26 wxmsw262 wxmsw24 wxmsw242 wxmsw241 wxmsw240 wx23_2 wx22_9
154 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
155 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
156 DOC "wxWindows shared release build library" )
158 FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY
159 NAMES wxmsw26d wxmsw262d wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d
161 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
162 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
163 DOC "wxWindows shared debug build library " )
167 ## required for WXWINDOWS_USE_GL
168 ## gl lib is always build separate:
170 FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_GL
171 NAMES wx_gl wxmsw_gl wxmsw26_gl
173 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
174 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
175 DOC "wxWindows static release build GL library" )
177 FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
178 NAMES wxd_gl wxmswd_gl wxmsw26d_gl
180 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
181 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
182 DOC "wxWindows static debug build GL library" )
185 FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
188 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
189 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
190 DOC "wxWindows static debug png library" )
192 FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_PNG
195 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
196 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
197 DOC "wxWindows static png library" )
199 FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
202 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
203 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
204 DOC "wxWindows static debug tiff library" )
206 FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_TIFF
209 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
210 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
211 DOC "wxWindows static tiff library" )
213 FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
216 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
217 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
218 DOC "wxWindows static debug jpeg library" )
220 FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_JPEG
223 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
224 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
225 DOC "wxWindows static jpeg library" )
227 FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
230 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
231 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
232 DOC "wxWindows static debug zlib library" )
234 FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_ZLIB
237 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
238 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
239 DOC "wxWindows static zib library" )
241 FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
244 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
245 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
246 DOC "wxWindows static debug regex library" )
248 FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_REGEX
251 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
252 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
253 DOC "wxWindows static regex library" )
258 FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY_GL
259 NAMES wx_gl wxmsw_gl wxmsw26_gl
261 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
262 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
263 DOC "wxWindows shared release build GL library" )
265 FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
266 NAMES wxd_gl wxmswd_gl wxmsw26d_gl
268 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
269 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
270 DOC "wxWindows shared debug build GL library" )
273 ELSE (WXWINDOWS_USE_MONOLITHIC)
274 ## WX is built as multiple small pieces libraries instead of monolithic
276 ## DEPECATED (jw) replaced by more general WXWINDOWS_USE_MONOLITHIC ON/OFF
277 # OPTION(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF)
279 ## HACK: This is very dirty.
280 ## because the libs of a particular version are explicitly listed
281 ## and NOT searched/verified.
282 ## TODO: Really search for each lib, then decide for
283 ## monolithic x debug x shared x GL (=16 combinations) for at least 18 libs
284 ## --> about 288 combinations
285 ## thus we need a different approach so solve this correctly ...
287 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).")
289 SET(WXWINDOWS_STATIC_LIBS ${WXWINDOWS_STATIC_LIBS}
312 ## HACK: feed in to optimized / debug libaries if both were FOUND.
313 SET(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS}
336 ENDIF (WXWINDOWS_USE_MONOLITHIC)
340 ## now we should have found all WX libs available on the system.
341 ## let the user decide which of the available onse to use.
344 ## if there is at least one shared lib available
345 ## let user choose wether to use shared or static wxwindows libs
346 IF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
347 ## default value OFF because wxWindows MSVS default build is static
348 OPTION(WXWINDOWS_USE_SHARED_LIBS
349 "Use shared versions (dll) of wxWindows libraries?" OFF)
350 MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS)
351 ENDIF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
353 ## add system libraries wxwindows always seems to depend on
354 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
360 IF (NOT WXWINDOWS_USE_SHARED_LIBS)
361 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
362 ## these ones dont seem required, in particular ctl3d32 is not neccesary (Jan Woetzel 07/2003)
364 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB} optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB}
365 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX} optimized ${WXWINDOWS_STATIC_LIBRARY_REGEX}
366 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG} optimized ${WXWINDOWS_STATIC_LIBRARY_PNG}
367 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG} optimized ${WXWINDOWS_STATIC_LIBRARY_JPEG}
368 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF} optimized ${WXWINDOWS_STATIC_LIBRARY_TIFF}
370 ENDIF (NOT WXWINDOWS_USE_SHARED_LIBS)
372 ## opengl/glu: TODO/FIXME: better use FindOpenGL.cmake here
373 ## assume release versions of glu an dopengl, here.
374 IF (WXWINDOWS_USE_GL)
375 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
378 ENDIF (WXWINDOWS_USE_GL)
381 ## select between use of shared or static wxWindows lib then set libs to use
382 ## for debug and optimized build. so the user can switch between debug and
383 ## release build e.g. within MS Visual Studio without running cmake with a
384 ## different build directory again.
386 ## then add the build specific include dir for wx/setup.h
389 IF(WXWINDOWS_USE_SHARED_LIBS)
390 ##MESSAGE("DBG wxWindows use shared lib selected.")
391 ## assume that both builds use the same setup(.h) for simplicity
393 ## shared: both wx (debug and release) found?
394 ## assume that both builds use the same setup(.h) for simplicity
395 IF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
396 ##MESSAGE("DBG wx shared: debug and optimized found.")
397 FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
398 ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
399 ${WXWINDOWS_ROOT_DIR}/lib/mswdll
400 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd
401 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw )
402 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
403 debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY}
404 optimized ${WXWINDOWS_SHARED_LIBRARY} )
405 IF (WXWINDOWS_USE_GL)
406 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
407 debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL}
408 optimized ${WXWINDOWS_SHARED_LIBRARY_GL} )
409 ENDIF (WXWINDOWS_USE_GL)
410 ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
412 ## shared: only debug wx lib found?
413 IF(WXWINDOWS_SHARED_DEBUG_LIBRARY)
414 IF(NOT WXWINDOWS_SHARED_LIBRARY)
415 ##MESSAGE("DBG wx shared: debug (but no optimized) found.")
416 FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
417 ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
418 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd )
419 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
420 ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
421 IF (WXWINDOWS_USE_GL)
422 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
423 ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
424 ENDIF (WXWINDOWS_USE_GL)
425 ENDIF(NOT WXWINDOWS_SHARED_LIBRARY)
426 ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY)
428 ## shared: only release wx lib found?
429 IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
430 IF(WXWINDOWS_SHARED_LIBRARY)
431 ##MESSAGE("DBG wx shared: optimized (but no debug) found.")
432 FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
433 ${WXWINDOWS_ROOT_DIR}/lib/mswdll
434 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw )
435 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
436 ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
437 IF (WXWINDOWS_USE_GL)
438 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
439 ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
440 ENDIF (WXWINDOWS_USE_GL)
441 ENDIF(WXWINDOWS_SHARED_LIBRARY)
442 ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
444 ## shared: none found?
445 IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
446 IF(NOT WXWINDOWS_SHARED_LIBRARY)
448 "No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
449 ENDIF(NOT WXWINDOWS_SHARED_LIBRARY)
450 ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
452 #########################################################################################
453 ELSE(WXWINDOWS_USE_SHARED_LIBS)
455 ##jw: DEPRECATED IF(NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
457 ## static: both wx (debug and release) found?
458 ## assume that both builds use the same setup(.h) for simplicity
459 IF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
460 ##MESSAGE("DBG wx static: debug and optimized found.")
461 FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
462 ${WXWINDOWS_ROOT_DIR}/lib/mswd
463 ${WXWINDOWS_ROOT_DIR}/lib/msw
464 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd
465 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
466 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
467 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY}
468 optimized ${WXWINDOWS_STATIC_LIBRARY} )
469 IF (WXWINDOWS_USE_GL)
470 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
471 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL}
472 optimized ${WXWINDOWS_STATIC_LIBRARY_GL} )
473 ENDIF (WXWINDOWS_USE_GL)
474 ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
476 ## static: only debug wx lib found?
477 IF(WXWINDOWS_STATIC_DEBUG_LIBRARY)
478 IF(NOT WXWINDOWS_STATIC_LIBRARY)
479 ##MESSAGE("DBG wx static: debug (but no optimized) found.")
480 FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
481 ${WXWINDOWS_ROOT_DIR}/lib/mswd
482 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd )
483 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
484 ${WXWINDOWS_STATIC_DEBUG_LIBRARY} )
485 IF (WXWINDOWS_USE_GL)
486 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
487 ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL} )
488 ENDIF (WXWINDOWS_USE_GL)
489 ENDIF(NOT WXWINDOWS_STATIC_LIBRARY)
490 ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY)
492 ## static: only release wx lib found?
493 IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
494 IF(WXWINDOWS_STATIC_LIBRARY)
495 ##MESSAGE("DBG wx static: optimized (but no debug) found.")
496 FIND_PATH(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
497 ${WXWINDOWS_ROOT_DIR}/lib/msw
498 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
499 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
500 ${WXWINDOWS_STATIC_LIBRARY} )
501 IF (WXWINDOWS_USE_GL)
502 SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
503 ${WXWINDOWS_STATIC_LIBRARY_GL} )
504 ENDIF (WXWINDOWS_USE_GL)
505 ENDIF(WXWINDOWS_STATIC_LIBRARY)
506 ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
508 ## static: none found?
509 IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
510 IF(NOT WXWINDOWS_STATIC_LIBRARY)
512 "No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
513 ENDIF(NOT WXWINDOWS_STATIC_LIBRARY)
514 ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
515 ENDIF(WXWINDOWS_USE_SHARED_LIBS)
518 ## not neccessary in wxWindows 2.4.1 and 2.6.2
519 ## but it may fix a previous bug, see
520 ## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap
521 OPTION(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF)
522 MARK_AS_ADVANCED(WXWINDOWS_SET_DEFINITIONS)
523 IF (WXWINDOWS_SET_DEFINITIONS)
524 SET(WXWINDOWS_DEFINITIONS "-DWINVER=0x400")
525 ELSE (WXWINDOWS_SET_DEFINITIONS)
527 SET(WXWINDOWS_DEFINITIONS "")
528 ENDIF (WXWINDOWS_SET_DEFINITIONS)
532 ## Find the include directories for wxwindows
533 ## the first, build specific for wx/setup.h was determined before.
534 ## add inc dir for general for "wx/wx.h"
535 FIND_PATH(WXWINDOWS_INCLUDE_DIR wx/wx.h
536 "${WXWINDOWS_ROOT_DIR}/include" )
537 ## append the build specific include dir for wx/setup.h:
538 IF (WXWINDOWS_INCLUDE_DIR_SETUPH)
539 SET(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} )
540 ENDIF (WXWINDOWS_INCLUDE_DIR_SETUPH)
546 WXWINDOWS_INCLUDE_DIR
547 WXWINDOWS_INCLUDE_DIR_SETUPH
548 WXWINDOWS_STATIC_LIBRARY
549 WXWINDOWS_STATIC_LIBRARY_GL
550 WXWINDOWS_STATIC_DEBUG_LIBRARY
551 WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
552 WXWINDOWS_STATIC_LIBRARY_ZLIB
553 WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
554 WXWINDOWS_STATIC_LIBRARY_REGEX
555 WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
556 WXWINDOWS_STATIC_LIBRARY_PNG
557 WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
558 WXWINDOWS_STATIC_LIBRARY_JPEG
559 WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
560 WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
561 WXWINDOWS_STATIC_LIBRARY_TIFF
562 WXWINDOWS_SHARED_LIBRARY
563 WXWINDOWS_SHARED_DEBUG_LIBRARY
564 WXWINDOWS_SHARED_LIBRARY_GL
565 WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
569 ELSE(WIN32_STYLE_FIND)
572 ## ######################################################################
574 ## UNIX/Linux specific:
576 ## use backquoted wx-config to query and set flags and libs:
577 ## 06/2003 Jan Woetzel
580 OPTION(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON)
581 MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS)
583 # JW removed option and force the develper th SET it.
584 # OPTION(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional
585 # --gl-libs for wx-config)?" OFF)
587 # wx-config should be in your path anyhow, usually no need to set WXWIN or
588 # search in ../wx or ../../wx
589 FIND_PROGRAM(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config
595 # check wether wx-config was found:
596 IF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
598 # use shared/static wx lib?
599 # remember: always link shared to use systems GL etc. libs (no static
600 # linking, just link *against* static .a libs)
601 IF(WXWINDOWS_USE_SHARED_LIBS)
602 SET(WX_CONFIG_ARGS_LIBS "--libs")
603 ELSE(WXWINDOWS_USE_SHARED_LIBS)
604 SET(WX_CONFIG_ARGS_LIBS "--static --libs")
605 ENDIF(WXWINDOWS_USE_SHARED_LIBS)
607 # do we need additionial wx GL stuff like GLCanvas ?
609 SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" )
610 ENDIF(WXWINDOWS_USE_GL)
611 ##MESSAGE("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===")
613 # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user:
614 IF (HAVE_ISYSTEM) # does the compiler support -isystem ?
615 IF (NOT APPLE) # -isystem seem sto be unsuppored on Mac
616 IF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
617 IF (CMAKE_CXX_COMPILER MATCHES g\\+\\+)
618 SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`")
619 ELSE(CMAKE_CXX_COMPILER MATCHES g\\+\\+)
620 SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`")
621 ENDIF(CMAKE_CXX_COMPILER MATCHES g\\+\\+)
622 ENDIF(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
625 ##MESSAGE("DBG: for compilation:
626 ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===")
628 # keep the back-quoted string for clarity
629 SET(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`")
630 ##MESSAGE("DBG2: for linking:
631 ##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===")
633 # evaluate wx-config output to separate linker flags and linkdirs for
635 EXEC_PROGRAM(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
636 ARGS ${WX_CONFIG_ARGS_LIBS}
637 OUTPUT_VARIABLE WX_CONFIG_LIBS )
639 ## extract linkdirs (-L) for rpath
640 ## use regular expression to match wildcard equivalent "-L*<endchar>"
641 ## with <endchar> is a space or a semicolon
642 STRING(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" )
643 # MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}")
645 ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES
646 ## replace -L by ; because the separator seems to be lost otherwise (bug or
648 IF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
649 STRING(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} )
650 # MESSAGE("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}")
651 ENDIF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
654 ## replace space separated string by semicolon separated vector to make it
655 ## work with LINK_DIRECTORIES
656 SEPARATE_ARGUMENTS(WXWINDOWS_LINK_DIRECTORIES)
659 CMAKE_WXWINDOWS_CXX_FLAGS
660 WXWINDOWS_INCLUDE_DIR
662 CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
666 ## we really need wx-config...
667 ELSE(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
668 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.")
669 MARK_AS_ADVANCED(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
670 ENDIF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
674 ELSE(UNIX_STYLE_FIND)
675 MESSAGE(STATUS "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX")
676 ENDIF(UNIX_STYLE_FIND)
677 ENDIF(WIN32_STYLE_FIND)
680 IF(WXWINDOWS_LIBRARIES)
681 IF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
682 ## found all we need.
683 SET(WXWINDOWS_FOUND 1)
685 ## set deprecated variables for backward compatibility:
686 SET(CMAKE_WX_CAN_COMPILE ${WXWINDOWS_FOUND})
687 SET(WXWINDOWS_LIBRARY ${WXWINDOWS_LIBRARIES})
688 SET(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR})
689 SET(WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES})
690 SET(CMAKE_WX_CXX_FLAGS ${CMAKE_WXWINDOWS_CXX_FLAGS})
692 ENDIF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
693 ENDIF(WXWINDOWS_LIBRARIES)