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:
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
25 CMAKE_WXWINDOWS_CXX_FLAGS = Compiler flags for wxWindows,
26 essentially "`wx-config --cxxflags`"
28 WXWINDOWS_INCLUDE_DIR = where to find "wx/wx.h" and "wx/setup.h"
29 WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on
31 WXWINDOWS_DEFINITIONS = extra defines
35 OPTIONS If you need OpenGL support please
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
51 include(${CMAKE_CURRENT_LIST_DIR}/Use_wxWindows.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
78 WXWINDOWS_INCLUDE_PATH
82 AUTHOR Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw>
84 #]=======================================================================]
86 # ------------------------------------------------------------------
88 # -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it before calling this.
89 # -major update for wx 2.6.2 and monolithic build option. (10/2005)
93 # cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95
94 # cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3
95 # cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1, gcc 3.3
96 # cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7 2002 (static build)
97 # cmake 2.0.5 on Windows XP and Suse Linux 9.2
98 # cmake 2.0.6 on Windows XP and Suse Linux 9.2, wxWidgets 2.6.2 MONOLITHIC build
99 # cmake 2.2.2 on Windows XP, MS Visual Studio .net 2003 7.1 wxWidgets 2.6.2 MONOLITHIC build
102 # -OPTION for unicode builds
103 # -further testing of DLL linking under MS WIN32
104 # -better support for non-monolithic builds
109 set(WIN32_STYLE_FIND 1)
112 set(WIN32_STYLE_FIND 0)
113 set(UNIX_STYLE_FIND 1)
116 set(UNIX_STYLE_FIND 1)
122 ## ######################################################################
126 ## candidates for root/base directory of wxwindows
127 ## should have subdirs include and lib containing include/wx/wx.h
128 ## fix the root dir to avoid mixing of headers/libs from different
131 ## WX supports monolithic and multiple smaller libs (since 2.5.x), we prefer monolithic for now.
132 ## monolithic = WX is built as a single big library
133 ## e.g. compile on WIN32 as "nmake -f makefile.vc MONOLITHIC=1 BUILD=debug SHARED=0 USE_OPENGL=1" (JW)
134 option(WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON)
135 mark_as_advanced(WXWINDOWS_USE_MONOLITHIC)
138 option(WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON)
139 mark_as_advanced(WXWINDOWS_USE_GL)
142 ## avoid mixing of headers and libs between multiple installed WX versions,
143 ## select just one tree here:
144 find_path(WXWINDOWS_ROOT_DIR include/wx/wx.h
147 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]" ## WX 2.6.x
148 "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]" ## WX 2.4.x
157 # message("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}")
160 ## find libs for combination of static/shared with release/debug
161 ## be careful if you add something here,
162 ## avoid mixing of headers and libs of different wx versions,
163 ## there may be multiple WX versions installed.
164 set (WXWINDOWS_POSSIBLE_LIB_PATHS
165 "${WXWINDOWS_ROOT_DIR}/lib"
169 if (WXWINDOWS_USE_MONOLITHIC)
171 find_library(WXWINDOWS_STATIC_LIBRARY
172 NAMES wx wxmsw wxmsw26
174 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
175 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
176 DOC "wxWindows static release build library" )
178 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY
179 NAMES wxd wxmswd wxmsw26d
181 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
182 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
183 DOC "wxWindows static debug build library" )
185 find_library(WXWINDOWS_SHARED_LIBRARY
186 NAMES wxmsw26 wxmsw262 wxmsw24 wxmsw242 wxmsw241 wxmsw240 wx23_2 wx22_9
188 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
189 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
190 DOC "wxWindows shared release build library" )
192 find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY
193 NAMES wxmsw26d wxmsw262d wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d
195 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
196 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
197 DOC "wxWindows shared debug build library " )
201 ## required for WXWINDOWS_USE_GL
202 ## gl lib is always build separate:
204 find_library(WXWINDOWS_STATIC_LIBRARY_GL
205 NAMES wx_gl wxmsw_gl wxmsw26_gl
207 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
208 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
209 DOC "wxWindows static release build GL library" )
211 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
212 NAMES wxd_gl wxmswd_gl wxmsw26d_gl
214 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
215 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
216 DOC "wxWindows static debug build GL library" )
219 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
222 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
223 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
224 DOC "wxWindows static debug png library" )
226 find_library(WXWINDOWS_STATIC_LIBRARY_PNG
229 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
230 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
231 DOC "wxWindows static png library" )
233 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
236 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
237 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
238 DOC "wxWindows static debug tiff library" )
240 find_library(WXWINDOWS_STATIC_LIBRARY_TIFF
243 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
244 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
245 DOC "wxWindows static tiff library" )
247 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
250 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
251 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
252 DOC "wxWindows static debug jpeg library" )
254 find_library(WXWINDOWS_STATIC_LIBRARY_JPEG
257 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
258 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
259 DOC "wxWindows static jpeg library" )
261 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
264 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
265 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
266 DOC "wxWindows static debug zlib library" )
268 find_library(WXWINDOWS_STATIC_LIBRARY_ZLIB
271 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
272 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
273 DOC "wxWindows static zib library" )
275 find_library(WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
278 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
279 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
280 DOC "wxWindows static debug regex library" )
282 find_library(WXWINDOWS_STATIC_LIBRARY_REGEX
285 "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
286 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
287 DOC "wxWindows static regex library" )
292 find_library(WXWINDOWS_SHARED_LIBRARY_GL
293 NAMES wx_gl wxmsw_gl wxmsw26_gl
295 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
296 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
297 DOC "wxWindows shared release build GL library" )
299 find_library(WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
300 NAMES wxd_gl wxmswd_gl wxmsw26d_gl
302 "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
303 ${WXWINDOWS_POSSIBLE_LIB_PATHS}
304 DOC "wxWindows shared debug build GL library" )
308 ## WX is built as multiple small pieces libraries instead of monolithic
310 ## DEPRECATED (jw) replaced by more general WXWINDOWS_USE_MONOLITHIC ON/OFF
311 # option(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF)
313 ## HACK: This is very dirty.
314 ## because the libs of a particular version are explicitly listed
315 ## and NOT searched/verified.
316 ## TODO: Really search for each lib, then decide for
317 ## monolithic x debug x shared x GL (=16 combinations) for at least 18 libs
318 ## --> about 288 combinations
319 ## thus we need a different approach so solve this correctly ...
321 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).")
323 set(WXWINDOWS_STATIC_LIBS ${WXWINDOWS_STATIC_LIBS}
346 ## HACK: feed in to optimized / debug libraries if both were FOUND.
347 set(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS}
374 ## now we should have found all WX libs available on the system.
375 ## let the user decide which of the available onse to use.
378 ## if there is at least one shared lib available
379 ## let user choose whether to use shared or static wxwindows libs
380 if(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
381 ## default value OFF because wxWindows MSVS default build is static
382 option(WXWINDOWS_USE_SHARED_LIBS
383 "Use shared versions (dll) of wxWindows libraries?" OFF)
384 mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS)
387 ## add system libraries wxwindows always seems to depend on
388 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
394 if (NOT WXWINDOWS_USE_SHARED_LIBS)
395 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
396 ## these ones don't seem required, in particular ctl3d32 is not necessary (Jan Woetzel 07/2003)
398 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB} optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB}
399 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX} optimized ${WXWINDOWS_STATIC_LIBRARY_REGEX}
400 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG} optimized ${WXWINDOWS_STATIC_LIBRARY_PNG}
401 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG} optimized ${WXWINDOWS_STATIC_LIBRARY_JPEG}
402 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF} optimized ${WXWINDOWS_STATIC_LIBRARY_TIFF}
406 ## opengl/glu: TODO/FIXME: better use FindOpenGL.cmake here
407 ## assume release versions of glu an dopengl, here.
408 if (WXWINDOWS_USE_GL)
409 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
415 ## select between use of shared or static wxWindows lib then set libs to use
416 ## for debug and optimized build. so the user can switch between debug and
417 ## release build e.g. within MS Visual Studio without running cmake with a
418 ## different build directory again.
420 ## then add the build specific include dir for wx/setup.h
423 if(WXWINDOWS_USE_SHARED_LIBS)
424 ##message("DBG wxWindows use shared lib selected.")
425 ## assume that both builds use the same setup(.h) for simplicity
427 ## shared: both wx (debug and release) found?
428 ## assume that both builds use the same setup(.h) for simplicity
429 if(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
430 ##message("DBG wx shared: debug and optimized found.")
431 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
432 ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
433 ${WXWINDOWS_ROOT_DIR}/lib/mswdll
434 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd
435 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw )
436 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
437 debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY}
438 optimized ${WXWINDOWS_SHARED_LIBRARY} )
439 if (WXWINDOWS_USE_GL)
440 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
441 debug ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL}
442 optimized ${WXWINDOWS_SHARED_LIBRARY_GL} )
446 ## shared: only debug wx lib found?
447 if(WXWINDOWS_SHARED_DEBUG_LIBRARY)
448 if(NOT WXWINDOWS_SHARED_LIBRARY)
449 ##message("DBG wx shared: debug (but no optimized) found.")
450 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
451 ${WXWINDOWS_ROOT_DIR}/lib/mswdlld
452 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/mswd )
453 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
454 ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
455 if (WXWINDOWS_USE_GL)
456 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
457 ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
462 ## shared: only release wx lib found?
463 if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
464 if(WXWINDOWS_SHARED_LIBRARY)
465 ##message("DBG wx shared: optimized (but no debug) found.")
466 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
467 ${WXWINDOWS_ROOT_DIR}/lib/mswdll
468 ${WXWINDOWS_ROOT_DIR}/lib/vc_dll/msw )
469 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
470 ${WXWINDOWS_SHARED_DEBUG_LIBRARY} )
471 if (WXWINDOWS_USE_GL)
472 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
473 ${WXWINDOWS_SHARED_DEBUG_LIBRARY_GL} )
478 ## shared: none found?
479 if(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
480 if(NOT WXWINDOWS_SHARED_LIBRARY)
482 "No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
486 #########################################################################################
489 ##jw: DEPRECATED if(NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
491 ## static: both wx (debug and release) found?
492 ## assume that both builds use the same setup(.h) for simplicity
493 if(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
494 ##message("DBG wx static: debug and optimized found.")
495 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
496 ${WXWINDOWS_ROOT_DIR}/lib/mswd
497 ${WXWINDOWS_ROOT_DIR}/lib/msw
498 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd
499 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
500 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
501 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY}
502 optimized ${WXWINDOWS_STATIC_LIBRARY} )
503 if (WXWINDOWS_USE_GL)
504 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
505 debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL}
506 optimized ${WXWINDOWS_STATIC_LIBRARY_GL} )
510 ## static: only debug wx lib found?
511 if(WXWINDOWS_STATIC_DEBUG_LIBRARY)
512 if(NOT WXWINDOWS_STATIC_LIBRARY)
513 ##message("DBG wx static: debug (but no optimized) found.")
514 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
515 ${WXWINDOWS_ROOT_DIR}/lib/mswd
516 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/mswd )
517 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
518 ${WXWINDOWS_STATIC_DEBUG_LIBRARY} )
519 if (WXWINDOWS_USE_GL)
520 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
521 ${WXWINDOWS_STATIC_DEBUG_LIBRARY_GL} )
526 ## static: only release wx lib found?
527 if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
528 if(WXWINDOWS_STATIC_LIBRARY)
529 ##message("DBG wx static: optimized (but no debug) found.")
530 find_path(WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
531 ${WXWINDOWS_ROOT_DIR}/lib/msw
532 ${WXWINDOWS_ROOT_DIR}/lib/vc_lib/msw )
533 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
534 ${WXWINDOWS_STATIC_LIBRARY} )
535 if (WXWINDOWS_USE_GL)
536 set(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
537 ${WXWINDOWS_STATIC_LIBRARY_GL} )
542 ## static: none found?
543 if(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
544 if(NOT WXWINDOWS_STATIC_LIBRARY)
546 "No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
552 ## not necessary in wxWindows 2.4.1 and 2.6.2
553 ## but it may fix a previous bug, see
554 ## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap
555 option(WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF)
556 mark_as_advanced(WXWINDOWS_SET_DEFINITIONS)
557 if (WXWINDOWS_SET_DEFINITIONS)
558 set(WXWINDOWS_DEFINITIONS "-DWINVER=0x400")
561 set(WXWINDOWS_DEFINITIONS "")
566 ## Find the include directories for wxwindows
567 ## the first, build specific for wx/setup.h was determined before.
568 ## add inc dir for general for "wx/wx.h"
569 find_path(WXWINDOWS_INCLUDE_DIR wx/wx.h
570 "${WXWINDOWS_ROOT_DIR}/include" )
571 ## append the build specific include dir for wx/setup.h:
572 if (WXWINDOWS_INCLUDE_DIR_SETUPH)
573 set(WXWINDOWS_INCLUDE_DIR ${WXWINDOWS_INCLUDE_DIR} ${WXWINDOWS_INCLUDE_DIR_SETUPH} )
580 WXWINDOWS_INCLUDE_DIR
581 WXWINDOWS_INCLUDE_DIR_SETUPH
582 WXWINDOWS_STATIC_LIBRARY
583 WXWINDOWS_STATIC_LIBRARY_GL
584 WXWINDOWS_STATIC_DEBUG_LIBRARY
585 WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
586 WXWINDOWS_STATIC_LIBRARY_ZLIB
587 WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
588 WXWINDOWS_STATIC_LIBRARY_REGEX
589 WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
590 WXWINDOWS_STATIC_LIBRARY_PNG
591 WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
592 WXWINDOWS_STATIC_LIBRARY_JPEG
593 WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
594 WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
595 WXWINDOWS_STATIC_LIBRARY_TIFF
596 WXWINDOWS_SHARED_LIBRARY
597 WXWINDOWS_SHARED_DEBUG_LIBRARY
598 WXWINDOWS_SHARED_LIBRARY_GL
599 WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
606 ## ######################################################################
608 ## UNIX/Linux specific:
610 ## use backquoted wx-config to query and set flags and libs:
611 ## 06/2003 Jan Woetzel
614 option(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON)
615 mark_as_advanced(WXWINDOWS_USE_SHARED_LIBS)
617 # JW removed option and force the develper th SET it.
618 # option(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional
619 # --gl-libs for wx-config)?" OFF)
621 # wx-config should be in your path anyhow, usually no need to set WXWIN or
622 # search in ../wx or ../../wx
623 find_program(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
624 NAMES $ENV{WX_CONFIG} wx-config
632 # check whether wx-config was found:
633 if(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
635 # use shared/static wx lib?
636 # remember: always link shared to use systems GL etc. libs (no static
637 # linking, just link *against* static .a libs)
638 if(WXWINDOWS_USE_SHARED_LIBS)
639 set(WX_CONFIG_ARGS_LIBS "--libs")
641 set(WX_CONFIG_ARGS_LIBS "--static --libs")
644 # do we need additionial wx GL stuff like GLCanvas ?
646 string(APPEND WX_CONFIG_ARGS_LIBS " --gl-libs" )
648 ##message("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===")
650 # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user:
651 if (HAVE_ISYSTEM) # does the compiler support -isystem ?
652 if (NOT APPLE) # -isystem seem sto be unsuppored on Mac
653 if(CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
654 if (CMAKE_CXX_COMPILER MATCHES g\\+\\+)
655 set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`")
657 set(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`")
662 ##message("DBG: for compilation:
663 ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===")
665 # keep the back-quoted string for clarity
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
672 exec_program(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
673 ARGS ${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
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}")
691 ## replace space separated string by semicolon separated vector to make it
692 ## work with LINK_DIRECTORIES
693 separate_arguments(WXWINDOWS_LINK_DIRECTORIES)
696 CMAKE_WXWINDOWS_CXX_FLAGS
697 WXWINDOWS_INCLUDE_DIR
699 CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
703 ## we really need wx-config...
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)
712 message(STATUS "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX")
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})