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)
50 #=============================================================================
51 # Copyright 2000-2009 Kitware, Inc.
52 # Copyright 2003-2006 Jan Woetzel
54 # Distributed under the OSI-approved BSD License (the "License");
55 # see accompanying file Copyright.txt for details.
57 # This software is distributed WITHOUT ANY WARRANTY; without even the
58 # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
59 # See the License for more information.
60 #=============================================================================
61 # (To distribute this file outside of CMake, substitute the full
62 # License text for the above reference.)
64 # ------------------------------------------------------------------
66 # -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it before calling this.
67 # -major update for wx 2.6.2 and monolithic build option. (10/2005)
71 # cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95
72 # cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3
73 # cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1, gcc 3.3
74 # cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7 2002 (static build)
75 # cmake 2.0.5 on Windows XP and Suse Linux 9.2
76 # cmake 2.0.6 on Windows XP and Suse Linux 9.2, wxWidgets 2.6.2 MONOLITHIC build
77 # cmake 2.2.2 on Windows XP, MS Visual Studio .net 2003 7.1 wxWidgets 2.6.2 MONOLITHIC build
80 # -OPTION for unicode builds
81 # -further testing of DLL linking under MS WIN32
82 # -better support for non-monolithic builds
87 set(WIN32_STYLE_FIND 1)
90 set(WIN32_STYLE_FIND 0)
91 set(UNIX_STYLE_FIND 1)
94 set(UNIX_STYLE_FIND 1)
100 ## ######################################################################
104 ## candidates for root/base directory of wxwindows
105 ## should have subdirs include and lib containing include/wx/wx.h
106 ## fix the root dir to avoid mixing of headers/libs from different
109 ## WX supports monolithic and multiple smaller libs (since 2.5.x), we prefer monolithic for now.
110 ## monolithic = WX is built as a single big library
111 ## e.g. compile on WIN32 as "nmake -f makefile.vc MONOLITHIC=1 BUILD=debug SHARED=0 USE_OPENGL=1" (JW)
112 option(WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON)
113 mark_as_advanced(WXWINDOWS_USE_MONOLITHIC)
116 option(WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON)
117 mark_as_advanced(WXWINDOWS_USE_GL)
120 ## avoid mixing of headers and libs between multiple installed WX versions,
121 ## select just one tree here:
122 find_path(WXWINDOWS_ROOT_DIR include/wx/wx.h
125 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" ## WX 2.6.x
126 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" ## WX 2.4.x
135 # message("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}")
138 ## find libs for combination of static/shared with release/debug
139 ## be careful if you add something here,
140 ## avoid mixing of headers and libs of different wx versions,
141 ## there may be multiple WX versions installed.
142 set (WXWINDOWS_POSSIBLE_LIB_PATHS
143 "${WXWINDOWS_ROOT_DIR}/lib"
147 if (WXWINDOWS_USE_MONOLITHIC)
149 find_library(WXWINDOWS_STATIC_LIBRARY
150 NAMES wx wxmsw wxmsw26
152 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
153 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
154 DOC "wxWindows static release build library" )
156 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY
157 NAMES wxd wxmswd wxmsw26d
159 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
160 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
161 DOC "wxWindows static debug build library" )
163 find_library(WXWINDOWS_SHARED_LIBRARY
164 NAMES wxmsw26 wxmsw262 wxmsw24 wxmsw242 wxmsw241 wxmsw240 wx23_2 wx22_9
166 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
167 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
168 DOC "wxWindows shared release build library" )
170 find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY
171 NAMES wxmsw26d wxmsw262d wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d
173 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
174 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
175 DOC "wxWindows shared debug build library " )
179 ## required for WXWINDOWS_USE_GL
180 ## gl lib is always build separate:
182 find_library(WXWINDOWS_STATIC_LIBRARY_GL
183 NAMES wx_gl wxmsw_gl wxmsw26_gl
185 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
186 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
187 DOC "wxWindows static release build GL library" )
189 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
190 NAMES wxd_gl wxmswd_gl wxmsw26d_gl
192 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
193 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
194 DOC "wxWindows static debug build GL library" )
197 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
200 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
201 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
202 DOC "wxWindows static debug png library" )
204 find_library(WXWINDOWS_STATIC_LIBRARY_PNG
207 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
208 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
209 DOC "wxWindows static png library" )
211 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
214 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
215 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
216 DOC "wxWindows static debug tiff library" )
218 find_library(WXWINDOWS_STATIC_LIBRARY_TIFF
221 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
222 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
223 DOC "wxWindows static tiff library" )
225 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
228 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
229 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
230 DOC "wxWindows static debug jpeg library" )
232 find_library(WXWINDOWS_STATIC_LIBRARY_JPEG
235 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
236 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
237 DOC "wxWindows static jpeg library" )
239 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
242 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
243 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
244 DOC "wxWindows static debug zlib library" )
246 find_library(WXWINDOWS_STATIC_LIBRARY_ZLIB
249 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
250 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
251 DOC "wxWindows static zib library" )
253 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
256 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
257 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
258 DOC "wxWindows static debug regex library" )
260 find_library(WXWINDOWS_STATIC_LIBRARY_REGEX
263 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
264 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
265 DOC "wxWindows static regex library" )
270 find_library(WXWINDOWS_SHARED_LIBRARY_GL
271 NAMES wx_gl wxmsw_gl wxmsw26_gl
273 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
274 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
275 DOC "wxWindows shared release build GL library" )
277 find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
278 NAMES wxd_gl wxmswd_gl wxmsw26d_gl
280 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
281 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
282 DOC "wxWindows shared debug build GL library" )
286 ## WX is built as multiple small pieces libraries instead of monolithic
288 ## DEPECATED (jw) replaced by more general WXWINDOWS_USE_MONOLITHIC ON/OFF
289 # option(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF)
291 ## HACK: This is very dirty.
292 ## because the libs of a particular version are explicitly listed
293 ## and NOT searched/verified.
294 ## TODO: Really search for each lib, then decide for
295 ## monolithic x debug x shared x GL (=16 combinations) for at least 18 libs
296 ## --> about 288 combinations
297 ## thus we need a different approach so solve this correctly ...
299 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).")
301 set(WXWINDOWS_STATIC_LIBS ${WXWINDOWS_STATIC_LIBS}
324 ## HACK: feed in to optimized / debug libaries if both were FOUND.
325 set(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS}
352 ## now we should have found all WX libs available on the system.
353 ## let the user decide which of the available onse to use.
356 ## if there is at least one shared lib available
357 ## let user choose wether to use shared or static wxwindows libs
358 if(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
359 ## default value OFF because wxWindows MSVS default build is static
360 option(WXWINDOWS_USE_SHARED_LIBS
361 "Use shared versions (dll) of wxWindows libraries?" OFF)
362 mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS)
365 ## add system libraries wxwindows always seems to depend on
366 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
372 if (NOT WXWINDOWS_USE_SHARED_LIBS)
373 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
374 ## these ones dont seem required, in particular ctl3d32 is not neccesary (Jan Woetzel 07/2003)
376 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB} optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB}
377 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX} optimized ${WXWINDOWS_STATIC_LIBRARY_REGEX}
378 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG} optimized ${WXWINDOWS_STATIC_LIBRARY_PNG}
379 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG} optimized ${WXWINDOWS_STATIC_LIBRARY_JPEG}
380 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF} optimized ${WXWINDOWS_STATIC_LIBRARY_TIFF}
384 ## opengl/glu: TODO/FIXME: better use FindOpenGL.cmake here
385 ## assume release versions of glu an dopengl, here.
386 if (WXWINDOWS_USE_GL)
387 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
393 ## select between use of shared or static wxWindows lib then set libs to use
394 ## for debug and optimized build. so the user can switch between debug and
395 ## release build e.g. within MS Visual Studio without running cmake with a
396 ## different build directory again.
398 ## then add the build specific include dir for wx/setup.h
401 if(WXWINDOWS_USE_SHARED_LIBS)
402 ##message("DBG wxWindows use shared lib selected.")
403 ## assume that both builds use the same setup(.h) for simplicity
405 ## shared: both wx (debug and release) found?
406 ## assume that both builds use the same setup(.h) for simplicity
407 if(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
408 ##message("DBG wx shared: debug and optimized found.")
409 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
410 ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
411 ${WXWINDOWS_ROOT_DIR}/lib/mswdll
412 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd
413 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw )
414 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
415 debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY}
416 optimized ${WXWINDOWS_SHARED_LIBRARY} )
417 if (WXWINDOWS_USE_GL)
418 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
419 debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL}
420 optimized ${WXWINDOWS_SHARED_LIBRARY_GL} )
424 ## shared: only debug wx lib found?
425 if(WXWINDOWS_SHARED_DEBUG_LIBRARY)
426 if(NOT WXWINDOWS_SHARED_LIBRARY)
427 ##message("DBG wx shared: debug (but no optimized) found.")
428 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
429 ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
430 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd )
431 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
432 ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
433 if (WXWINDOWS_USE_GL)
434 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
435 ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
440 ## shared: only release wx lib found?
441 if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
442 if(WXWINDOWS_SHARED_LIBRARY)
443 ##message("DBG wx shared: optimized (but no debug) found.")
444 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
445 ${WXWINDOWS_ROOT_DIR}/lib/mswdll
446 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw )
447 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
448 ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
449 if (WXWINDOWS_USE_GL)
450 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
451 ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
456 ## shared: none found?
457 if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
458 if(NOT WXWINDOWS_SHARED_LIBRARY)
460 "No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
464 #########################################################################################
467 ##jw: DEPRECATED if(NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
469 ## static: both wx (debug and release) found?
470 ## assume that both builds use the same setup(.h) for simplicity
471 if(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
472 ##message("DBG wx static: debug and optimized found.")
473 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
474 ${WXWINDOWS_ROOT_DIR}/lib/mswd
475 ${WXWINDOWS_ROOT_DIR}/lib/msw
476 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd
477 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
478 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
479 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY}
480 optimized ${WXWINDOWS_STATIC_LIBRARY} )
481 if (WXWINDOWS_USE_GL)
482 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
483 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL}
484 optimized ${WXWINDOWS_STATIC_LIBRARY_GL} )
488 ## static: only debug wx lib found?
489 if(WXWINDOWS_STATIC_DEBUG_LIBRARY)
490 if(NOT WXWINDOWS_STATIC_LIBRARY)
491 ##message("DBG wx static: debug (but no optimized) found.")
492 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
493 ${WXWINDOWS_ROOT_DIR}/lib/mswd
494 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd )
495 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
496 ${WXWINDOWS_STATIC_DEBUG_LIBRARY} )
497 if (WXWINDOWS_USE_GL)
498 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
499 ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL} )
504 ## static: only release wx lib found?
505 if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
506 if(WXWINDOWS_STATIC_LIBRARY)
507 ##message("DBG wx static: optimized (but no debug) found.")
508 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
509 ${WXWINDOWS_ROOT_DIR}/lib/msw
510 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
511 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
512 ${WXWINDOWS_STATIC_LIBRARY} )
513 if (WXWINDOWS_USE_GL)
514 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
515 ${WXWINDOWS_STATIC_LIBRARY_GL} )
520 ## static: none found?
521 if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
522 if(NOT WXWINDOWS_STATIC_LIBRARY)
524 "No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
530 ## not neccessary in wxWindows 2.4.1 and 2.6.2
531 ## but it may fix a previous bug, see
532 ## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap
533 option(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF)
534 mark_as_advanced(WXWINDOWS_SET_DEFINITIONS)
535 if (WXWINDOWS_SET_DEFINITIONS)
536 set(WXWINDOWS_DEFINITIONS "-DWINVER=0x400")
539 set(WXWINDOWS_DEFINITIONS "")
544 ## Find the include directories for wxwindows
545 ## the first, build specific for wx/setup.h was determined before.
546 ## add inc dir for general for "wx/wx.h"
547 find_path(WXWINDOWS_INCLUDE_DIR wx/wx.h
548 "${WXWINDOWS_ROOT_DIR}/include" )
549 ## append the build specific include dir for wx/setup.h:
550 if (WXWINDOWS_INCLUDE_DIR_SETUPH)
551 set(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} )
558 WXWINDOWS_INCLUDE_DIR
559 WXWINDOWS_INCLUDE_DIR_SETUPH
560 WXWINDOWS_STATIC_LIBRARY
561 WXWINDOWS_STATIC_LIBRARY_GL
562 WXWINDOWS_STATIC_DEBUG_LIBRARY
563 WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
564 WXWINDOWS_STATIC_LIBRARY_ZLIB
565 WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
566 WXWINDOWS_STATIC_LIBRARY_REGEX
567 WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
568 WXWINDOWS_STATIC_LIBRARY_PNG
569 WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
570 WXWINDOWS_STATIC_LIBRARY_JPEG
571 WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
572 WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
573 WXWINDOWS_STATIC_LIBRARY_TIFF
574 WXWINDOWS_SHARED_LIBRARY
575 WXWINDOWS_SHARED_DEBUG_LIBRARY
576 WXWINDOWS_SHARED_LIBRARY_GL
577 WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
584 ## ######################################################################
586 ## UNIX/Linux specific:
588 ## use backquoted wx-config to query and set flags and libs:
589 ## 06/2003 Jan Woetzel
592 option(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON)
593 mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS)
595 # JW removed option and force the develper th SET it.
596 # option(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional
597 # --gl-libs for wx-config)?" OFF)
599 # wx-config should be in your path anyhow, usually no need to set WXWIN or
600 # search in ../wx or ../../wx
601 find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config
609 # check wether wx-config was found:
610 if(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
612 # use shared/static wx lib?
613 # remember: always link shared to use systems GL etc. libs (no static
614 # linking, just link *against* static .a libs)
615 if(WXWINDOWS_USE_SHARED_LIBS)
616 set(WX_CONFIG_ARGS_LIBS "--libs")
618 set(WX_CONFIG_ARGS_LIBS "--static --libs")
621 # do we need additionial wx GL stuff like GLCanvas ?
623 set(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" )
625 ##message("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===")
627 # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user:
628 if (HAVE_ISYSTEM) # does the compiler support -isystem ?
629 if (NOT APPLE) # -isystem seem sto be unsuppored on Mac
630 if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
631 if (CMAKE_CXX_COMPILER MATCHES g\\+\\+)
632 set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`")
634 set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`")
639 ##message("DBG: for compilation:
640 ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===")
642 # keep the back-quoted string for clarity
643 set(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`")
644 ##message("DBG2: for linking:
645 ##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===")
647 # evaluate wx-config output to separate linker flags and linkdirs for
649 exec_program(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
650 ARGS ${WX_CONFIG_ARGS_LIBS}
651 OUTPUT_VARIABLE WX_CONFIG_LIBS )
653 ## extract linkdirs (-L) for rpath
654 ## use regular expression to match wildcard equivalent "-L*<endchar>"
655 ## with <endchar> is a space or a semicolon
656 string(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" )
657 # message("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}")
659 ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES
660 ## replace -L by ; because the separator seems to be lost otherwise (bug or
662 if(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
663 string(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} )
664 # message("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}")
668 ## replace space separated string by semicolon separated vector to make it
669 ## work with LINK_DIRECTORIES
670 separate_arguments(WXWINDOWS_LINK_DIRECTORIES)
673 CMAKE_WXWINDOWS_CXX_FLAGS
674 WXWINDOWS_INCLUDE_DIR
676 CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
680 ## we really need wx-config...
682 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.")
683 mark_as_advanced(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
689 message(STATUS "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX")
694 if(WXWINDOWS_LIBRARIES)
695 if(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
696 ## found all we need.
697 set(WXWINDOWS_FOUND 1)
699 ## set deprecated variables for backward compatibility:
700 set(CMAKE_WX_CAN_COMPILE ${WXWINDOWS_FOUND})
701 set(WXWINDOWS_LIBRARY ${WXWINDOWS_LIBRARIES})
702 set(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR})
703 set(WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES})
704 set(CMAKE_WX_CXX_FLAGS ${CMAKE_WXWINDOWS_CXX_FLAGS})