source: trunk/tmdmcreator/build/cmake/FindwxWidgets.cmake @ 38

Revision 6, 28.6 KB checked in by lucsch, 12 years ago (diff)

preliminary code for tmdmcreator

  • Property svn:executable set to *
RevLine 
[6]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
4# the library is. This code sets the following variables:
5
6#  WXWINDOWS_FOUND     = system has WxWindows
7#  WXWINDOWS_LIBRARIES = path to the wxWindows libraries
8#                        on Unix/Linux with additional
9#                        linker flags from
10#                        "wx-config --libs"
11#  CMAKE_WXWINDOWS_CXX_FLAGS  = Compiler flags for wxWindows,
12#                               essentially "`wx-config --cxxflags`"
13#                               on Linux
14#  WXWINDOWS_INCLUDE_DIR      = where to find "wx/wx.h" and "wx/setup.h"
15#  WXWINDOWS_LINK_DIRECTORIES = link directories, useful for rpath on
16#                                Unix
17#  WXWINDOWS_DEFINITIONS      = extra defines
18#
19# DEPRECATED
20#  CMAKE_WX_CAN_COMPILE
21#  WXWINDOWS_LIBRARY
22#  CMAKE_WX_CXX_FLAGS
23#  WXWINDOWS_INCLUDE_PATH
24#
25# OPTIONS
26# If you need OpenGL support please
27#  SET(WXWINDOWS_USE_GL 1)
28# in your CMakeLists.txt *before* you include this file.
29#
30# For convenience include Use_wxWindows.cmake in your project's
31# CMakeLists.txt using INCLUDE(Use_wxWindows).
32#
33# USAGE
34#  SET(WXWINDOWS_USE_GL 1)
35#  FIND_PACKAGE(wxWindows)
36#
37# NOTES
38# wxWidgets 2.6.x is supported for monolithic builds
39# e.g. compiled  in wx/build/msw dir as: 
40#  nmake -f makefile.vc BUILD=debug SHARED=0 USE_OPENGL=1 MONOLITHIC=1
41#
42# AUTHOR
43# Jan Woetzel <http://www.mip.informatik.uni-kiel.de/~jw> (07/2003-01/2006)
44
45
46# ------------------------------------------------------------------
47#
48# -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it before calling this.
49# -major update for wx 2.6.2 and monolithic build option. (10/2005)
50#
51# STATUS
52# tested with:
53#  cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95
54#  cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3
55#  cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1,  gcc 3.3
56#  cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7 2002 (static build)
57#  cmake 2.0.5 on Windows XP and Suse Linux 9.2
58#  cmake 2.0.6 on Windows XP and Suse Linux 9.2, wxWidgets 2.6.2 MONOLITHIC build
59#  cmake 2.2.2 on Windows XP, MS Visual Studio .net 2003 7.1 wxWidgets 2.6.2 MONOLITHIC build
60#
61# TODO
62#  -OPTION for unicode builds
63#  -further testing of DLL linking under MS WIN32
64#  -better support for non-monolithic builds
65#
66
67
68IF(WIN32)
69  SET(WIN32_STYLE_FIND 1)
70ENDIF(WIN32)
71IF(MINGW)
72  SET(WIN32_STYLE_FIND 0)
73  SET(UNIX_STYLE_FIND 1)
74ENDIF(MINGW)
75IF(UNIX)
76  SET(UNIX_STYLE_FIND 1)
77ENDIF(UNIX)
78
79
80IF(WIN32_STYLE_FIND)
81
82  ## ######################################################################
83  ##
84  ## Windows specific:
85  ##
86  ## candidates for root/base directory of wxwindows
87  ## should have subdirs include and lib containing include/wx/wx.h
88  ## fix the root dir to avoid mixing of headers/libs from different
89  ## versions/builds:
90 
91  SET (WXWINDOWS_POSSIBLE_ROOT_PATHS
92    $ENV{WXWIN}
93    "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno Setup: App Path]"  ## WX 2.6.x
94    "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWindows_is1;Inno Setup: App Path]"  ## WX 2.4.x
95    C:\\wxWidgets-2.6.2
96    D:\\wxWidgets-2.6.2
97    C:\\wxWidgets-2.6.1
98    D:\\wxWidgets-2.6.1
99    C:\\wxWindows-2.4.2
100    D:\\wxWindows-2.4.2
101    )
102 
103  ## WX supports monolithic and multiple smaller libs (since 2.5.x), we prefer monolithic for now.
104  ## monolithic = WX is built as a single big library
105  ## e.g. compile on WIN32 as  "nmake -f makefile.vc MONOLITHIC=1 BUILD=debug SHARED=0 USE_OPENGL=1" (JW)
106  OPTION(WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON)
107  MARK_AS_ADVANCED(WXWINDOWS_USE_MONOLITHIC)
108
109  ## GL libs used?
110  OPTION(WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON)
111  MARK_AS_ADVANCED(WXWINDOWS_USE_GL)
112
113
114  ## avoid mixing of headers and libs between multiple installed WX versions,
115  ## select just one tree here:
116  FIND_PATH(WXWINDOWS_ROOT_DIR  include/wx/wx.h
117    ${WXWINDOWS_POSSIBLE_ROOT_PATHS} ) 
118  # MESSAGE("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}")
119 
120 
121  ## find libs for combination of static/shared with release/debug
122  ## be careful if you add something here,
123  ## avoid mixing of headers and libs of different wx versions,
124  ## there may be multiple WX version s installed.
125  SET (WXWINDOWS_POSSIBLE_LIB_PATHS
126    "${WXWINDOWS_ROOT_DIR}/lib"
127    )
128 
129  ## monolithic?
130  IF (WXWINDOWS_USE_MONOLITHIC)
131   
132    FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY
133      NAMES wx wxmsw wxmsw26 wxmsw27 wxmsw28 wxmsw29 wxmsw28u wxmsw29u
134      PATHS
135      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
136      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
137      DOC "wxWindows static release build library" )
138   
139    FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY
140      NAMES wxd wxmswd wxmsw26d  wxmsw27d wxmsw28d wxmsw29 wxmsw28ud wxmsw29ud
141      PATHS
142      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
143      ${WXWINDOWS_POSSIBLE_LIB_PATHS}       
144      DOC "wxWindows static debug build library" )
145   
146    FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY
147      NAMES wxmsw26 wxmsw262 wxmsw24 wxmsw242 wxmsw241 wxmsw240 wx23_2 wx22_9
148      PATHS
149      "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
150      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
151      DOC "wxWindows shared release build library" )
152   
153    FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY
154      NAMES wxmsw26d wxmsw262d wxmsw24d wxmsw241d wxmsw240d wx23_2d wx22_9d
155      PATHS
156      "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
157      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
158      DOC "wxWindows shared debug build library " )
159         
160       
161
162
163    ##
164    ## required for WXWINDOWS_USE_GL
165    ## gl lib is always build separate:
166    ##
167    FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_GL
168      NAMES wx_gl wxmsw_gl wxmsw26_gl wxmsw28u_gl wxmsw28_gl wxmsw29_gl
169      PATHS
170      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
171      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
172      DOC "wxWindows static release build GL library" )
173
174    FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
175      NAMES wxd_gl wxmswd_gl wxmsw26d_gl wxmsw28ud_gl wxmsw28d_gl wxmsw28d_gl
176      PATHS
177      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
178      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
179      DOC "wxWindows static debug build GL library" )
180   
181
182    FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
183      NAMES wxpngd
184      PATHS
185      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
186      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
187      DOC "wxWindows static debug png library" )
188
189    FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_PNG
190      NAMES wxpng
191      PATHS
192      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
193      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
194      DOC "wxWindows static png library" )
195   
196    FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
197      NAMES wxtiffd
198      PATHS
199      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
200      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
201      DOC "wxWindows static debug tiff library" )
202
203    FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_TIFF
204      NAMES wxtiff
205      PATHS
206      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
207      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
208      DOC "wxWindows static tiff library" )
209   
210    FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
211      NAMES wxjpegd  wxjpgd
212      PATHS
213      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
214      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
215      DOC "wxWindows static debug jpeg library" )
216
217    FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_JPEG
218      NAMES wxjpeg wxjpg
219      PATHS
220      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
221      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
222      DOC "wxWindows static jpeg library" )
223   
224    FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
225      NAMES wxzlibd
226      PATHS
227      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
228      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
229      DOC "wxWindows static debug zlib library" )
230
231    FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_ZLIB
232      NAMES wxzlib
233      PATHS
234      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
235      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
236      DOC "wxWindows static zib library" )
237
238    FIND_LIBRARY(WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
239      NAMES wxregexd wxregexud
240      PATHS
241      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
242      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
243      DOC "wxWindows static debug regex library" )
244
245    FIND_LIBRARY(WXWINDOWS_STATIC_LIBRARY_REGEX
246      NAMES wxregex wxregexu
247      PATHS
248      "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
249      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
250      DOC "wxWindows static regex library" )
251 
252       
253        FIND_LIBRARY (WXWINDOWS_STATIC_DEBUG_LIBRARY_EXPAT
254                NAMES wxexpatd wxexpatud
255                PATHS
256                "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
257                ${WXWINDOWS_POSSIBLE_LIB_PATHS}
258                DOC "wxWindows expat (XML) library" )
259       
260        FIND_LIBRARY (WXWINDOWS_STATIC_LIBRARY_EXPAT
261                NAMES wxexpat wxexpatu
262                PATHS
263                "${WXWINDOWS_ROOT_DIR}/lib/vc_lib"
264                ${WXWINDOWS_POSSIBLE_LIB_PATHS}
265                DOC "wxWindows expat XML library" )
266
267   
268    ## untested:
269    FIND_LIBRARY(WXWINDOWS_SHARED_LIBRARY_GL
270      NAMES wx_gl wxmsw_gl wxmsw26_gl
271      PATHS
272      "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"
273      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
274      DOC "wxWindows shared release build GL library" )
275
276    FIND_LIBRARY(WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
277      NAMES wxd_gl wxmswd_gl wxmsw26d_gl
278      PATHS
279      "${WXWINDOWS_ROOT_DIR}/lib/vc_dll"     
280      ${WXWINDOWS_POSSIBLE_LIB_PATHS}
281      DOC "wxWindows shared debug build GL library" )           
282   
283 
284    ELSE (WXWINDOWS_USE_MONOLITHIC)
285    ## WX is built as multiple small pieces libraries instead of monolithic
286   
287    ## DEPECATED (jw) replaced by more general WXWINDOWS_USE_MONOLITHIC ON/OFF
288    # OPTION(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF)   
289   
290    ## HACK: This is very dirty.
291    ## because the libs of a particular version are explicitly listed
292    ## and NOT searched/verified.
293    ## TODO:  Really search for each lib, then decide for
294    ## monolithic x debug x shared x GL (=16 combinations) for at least 18 libs
295    ## -->  about 288 combinations
296    ## thus we need a different approach so solve this correctly ...
297   
298    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).")
299   
300    SET(WXWINDOWS_STATIC_LIBS ${WXWINDOWS_STATIC_LIBS}
301      wxbase26
302      wxbase26_net
303      wxbase26_odbc
304      wxbase26_xml
305      wxmsw26_adv
306      wxmsw26_core
307      wxmsw26_dbgrid
308      wxmsw26_gl
309      wxmsw26_html
310      wxmsw26_media
311      wxmsw26_qa
312      wxmsw26_xrc
313      wxexpat
314      wxjpeg
315      wxpng
316      wxregex
317      wxtiff
318      wxzlib
319      comctl32
320      rpcrt4
321      wsock32
322      )
323    ## HACK: feed in to optimized / debug libaries if both were FOUND.
324    SET(WXWINDOWS_STATIC_DEBUG_LIBS ${WXWINDOWS_STATIC_DEBUG_LIBS}
325      wxbase26d
326      wxbase26d_net
327      wxbase26d_odbc
328      wxbase26d_xml
329      wxmsw26d_adv
330      wxmsw26d_core
331      wxmsw26d_dbgrid
332      wxmsw26d_gl
333      wxmsw26d_html
334      wxmsw26d_media
335      wxmsw26d_qa
336      wxmsw26d_xrc
337      wxexpatd
338      wxjpegd
339      wxpngd
340      wxregexd
341      wxtiffd
342      wxzlibd
343      comctl32
344      rpcrt4
345      wsock32
346      )
347  ENDIF (WXWINDOWS_USE_MONOLITHIC)
348 
349 
350  ##
351  ## now we should have found all WX libs available on the system.
352  ## let the user decide which of the available onse to use.
353  ##
354 
355  ## if there is at least one shared lib available
356  ## let user choose wether to use shared or static wxwindows libs
357  IF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)
358    ## default value OFF because wxWindows MSVS default build is static
359    OPTION(WXWINDOWS_USE_SHARED_LIBS
360      "Use shared versions (dll) of wxWindows libraries?" OFF)
361    MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS)
362  ENDIF(WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY)   
363 
364  ## add system libraries wxwindows always seems to depend on
365  SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
366    comctl32
367    rpcrt4
368    wsock32
369    ) 
370 
371  IF (NOT WXWINDOWS_USE_SHARED_LIBS)
372    SET(WXWINDOWS_LIBRARIES ${WXWINDOWS_LIBRARIES}
373      ##  these ones dont seem required, in particular  ctl3d32 is not neccesary (Jan Woetzel 07/2003)
374      #   ctl3d32
375      debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB}   optimized ${WXWINDOWS_STATIC_LIBRARY_ZLIB}
376      debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX}  optimized ${WXWINDOWS_STATIC_LIBRARY_REGEX}
377          debug ${WXWINDOWS_STATIC_DEBUG_LIBRARY_EXPAT}  optimized ${WXWINDOWS_STATIC_LIBRARY_EXPAT}
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}
381      )
382  ENDIF (NOT WXWINDOWS_USE_SHARED_LIBS)
383
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}
388      opengl32
389      glu32 )
390  ENDIF (WXWINDOWS_USE_GL)
391 
392  ##
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.
397  ##
398  ## then add the build specific include dir for wx/setup.h
399  ##
400 
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
404   
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} )
421      ENDIF (WXWINDOWS_USE_GL)
422    ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY)
423   
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} )
436        ENDIF (WXWINDOWS_USE_GL)
437      ENDIF(NOT WXWINDOWS_SHARED_LIBRARY)
438    ENDIF(WXWINDOWS_SHARED_DEBUG_LIBRARY)
439   
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} )
452        ENDIF (WXWINDOWS_USE_GL)
453      ENDIF(WXWINDOWS_SHARED_LIBRARY)   
454    ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
455   
456    ## shared: none found?
457    IF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
458      IF(NOT WXWINDOWS_SHARED_LIBRARY)
459        MESSAGE(STATUS 
460          "No shared wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
461      ENDIF(NOT WXWINDOWS_SHARED_LIBRARY)
462    ENDIF(NOT WXWINDOWS_SHARED_DEBUG_LIBRARY)
463
464    #########################################################################################
465  ELSE(WXWINDOWS_USE_SHARED_LIBS)
466
467    ##jw: DEPRECATED IF(NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
468   
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} )
485      ENDIF (WXWINDOWS_USE_GL)         
486    ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY)
487   
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} )
500        ENDIF (WXWINDOWS_USE_GL)
501      ENDIF(NOT WXWINDOWS_STATIC_LIBRARY)
502    ENDIF(WXWINDOWS_STATIC_DEBUG_LIBRARY)
503   
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} )
516        ENDIF (WXWINDOWS_USE_GL)               
517      ENDIF(WXWINDOWS_STATIC_LIBRARY)
518    ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY)
519   
520    ## static: none found?
521    IF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
522      IF(NOT WXWINDOWS_STATIC_LIBRARY)
523        MESSAGE(STATUS
524          "No static wxWindows lib found, but WXWINDOWS_USE_SHARED_LIBS=${WXWINDOWS_USE_SHARED_LIBS}.")
525      ENDIF(NOT WXWINDOWS_STATIC_LIBRARY)
526    ENDIF(NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD)     
527  ENDIF(WXWINDOWS_USE_SHARED_LIBS) 
528 
529 
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")
537  ELSE (WXWINDOWS_SET_DEFINITIONS)
538    # clear:
539    SET(WXWINDOWS_DEFINITIONS "")
540  ENDIF (WXWINDOWS_SET_DEFINITIONS)
541 
542 
543 
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} )
552  ENDIF (WXWINDOWS_INCLUDE_DIR_SETUPH)
553 
554 
555  MARK_AS_ADVANCED(
556    WXWINDOWS_ROOT_DIR
557    WXWINDOWS_INCLUDE_DIR
558    WXWINDOWS_INCLUDE_DIR_SETUPH
559    WXWINDOWS_STATIC_LIBRARY
560    WXWINDOWS_STATIC_LIBRARY_GL
561    WXWINDOWS_STATIC_DEBUG_LIBRARY
562    WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
563    WXWINDOWS_STATIC_LIBRARY_ZLIB
564    WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
565    WXWINDOWS_STATIC_LIBRARY_REGEX
566    WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
567        WXWINDOWS_STATIC_LIBRARY_EXPAT
568        WXWINDOWS_STATIC_DEBUG_LIBRARY_EXPAT
569    WXWINDOWS_STATIC_LIBRARY_PNG
570    WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
571    WXWINDOWS_STATIC_LIBRARY_JPEG
572    WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
573    WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
574    WXWINDOWS_STATIC_LIBRARY_TIFF
575    WXWINDOWS_SHARED_LIBRARY
576    WXWINDOWS_SHARED_DEBUG_LIBRARY
577    WXWINDOWS_SHARED_LIBRARY_GL
578    WXWINDOWS_SHARED_DEBUG_LIBRARY_GL   
579    )
580 
581 
582ELSE(WIN32_STYLE_FIND)
583
584  IF (UNIX_STYLE_FIND)
585    ## ######################################################################
586    ##
587    ## UNIX/Linux specific:
588    ##
589    ## use backquoted wx-config to query and set flags and libs:
590    ## 06/2003 Jan Woetzel
591    ##
592   
593    OPTION(WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON)
594    MARK_AS_ADVANCED(WXWINDOWS_USE_SHARED_LIBS)
595
596    # JW removed option and force the develper th SET it.
597    # OPTION(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional
598      # --gl-libs for wx-config)?" OFF)
599   
600    # wx-config should be in your path anyhow, usually no need to set WXWIN or
601    # search in ../wx or ../../wx
602    FIND_PROGRAM(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE wx-config
603      $ENV{WXWIN}
604      $ENV{WXWIN}/bin
605      ../wx/bin
606      ../../wx/bin )
607   
608    # check wether wx-config was found:
609    IF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)   
610
611      # use shared/static wx lib?
612      # remember: always link shared to use systems GL etc. libs (no static
613        # linking, just link *against* static .a libs)
614      IF(WXWINDOWS_USE_SHARED_LIBS)
615        SET(WX_CONFIG_ARGS_LIBS "--libs all")
616      ELSE(WXWINDOWS_USE_SHARED_LIBS)
617        SET(WX_CONFIG_ARGS_LIBS "--static --libs all")
618      ENDIF(WXWINDOWS_USE_SHARED_LIBS)
619     
620      # do we need additionial wx GL stuff like GLCanvas ?
621      IF(WXWINDOWS_USE_GL)
622        SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --gl-libs" )
623      ENDIF(WXWINDOWS_USE_GL)
624      ##MESSAGE("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===")
625
626     
627      SET(WX_CONFIG_CXXFLAGS_ARGS "--cxxflags")
628     
629      IF(CMAKE_BUILD_TYPE STREQUAL "Debug")
630        SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --debug=yes" )
631        SET(WX_CONFIG_CXXFLAGS_ARGS "${WX_CONFIG_CXXFLAGS_ARGS} --debug=yes")
632      ENDIF(CMAKE_BUILD_TYPE STREQUAL "Debug")
633
634      IF(CMAKE_BUILD_TYPE STREQUAL "Release")
635        SET(WX_CONFIG_ARGS_LIBS "${WX_CONFIG_ARGS_LIBS} --debug=no" )
636        SET(WX_CONFIG_CXXFLAGS_ARGS "${WX_CONFIG_CXXFLAGS_ARGS} --debug=no")
637      ENDIF(CMAKE_BUILD_TYPE STREQUAL "Release")
638
639          MESSAGE("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}")
640
641     
642      #### LUCIEN CHANGE FOR XCODE COMPATIBILITY ############################################
643         
644      # set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user:
645      #SET(CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`")
646      ##MESSAGE("DBG: for compilation:
647        ##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===")
648
649      # keep the back-quoted string for clarity
650      #SET(WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`")
651      #MESSAGE("DBG2: for linking WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===")
652     
653      # evaluate wx-config output to separate linker flags and linkdirs for
654      # rpath:
655      #EXEC_PROGRAM(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
656      #  ARGS ${WX_CONFIG_ARGS_LIBS}
657      #  OUTPUT_VARIABLE WX_CONFIG_LIBS )
658     
659      ## extract linkdirs (-L) for rpath
660      ## use regular expression to match wildcard equivalent "-L*<endchar>"
661      ## with <endchar> is a space or a semicolon
662      #STRING(REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" )
663      # MESSAGE("DBG  WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}")
664     
665      ## remove prefix -L because we need the pure directory for LINK_DIRECTORIES
666      ## replace -L by ; because the separator seems to be lost otherwise (bug or
667        ## feature?)
668      #IF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
669       # STRING(REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX} )
670        # MESSAGE("DBG  WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}")
671      #ENDIF(WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX)
672     
673     
674      ## replace space separated string by semicolon separated vector to make it
675      ## work with LINK_DIRECTORIES
676      #SEPARATE_ARGUMENTS(WXWINDOWS_LINK_DIRECTORIES)
677     
678     
679        EXEC_PROGRAM(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
680        ARGS ${WX_CONFIG_CXXFLAGS_ARGS}
681        OUTPUT_VARIABLE CMAKE_WXWINDOWS_CXX_FLAGS)
682        MESSAGE("DBG: ${CMAKE_WXWINDOWS_CXX_FLAGS}")
683       
684        EXEC_PROGRAM(${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE}
685        ARGS ${WX_CONFIG_ARGS_LIBS}
686        OUTPUT_VARIABLE WXWINDOWS_LIBRARIES)
687
688                SET(WX_USE_XML CACHE BOOL "Use Expat library for XML ?" 1)
689                IF(WX_USE_XML)
690                        SET(WXWINDOWS_LIBRARIES "${WXWINDOWS_LIBRARIES} -lexpat")
691                ENDIF(WX_USE_XML)
692
693        MESSAGE("DBG: ${WXWINDOWS_LIBRARIES}")
694
695     
696     #   IF(WX_CONFIG_LIBS)
697    #           LINK_LIBRARIES(${WX_CONFIG_LIBS})
698        #       ENDIF(WX_CONFIG_LIBS)
699 
700        #       IF (WX_CONFIG_CXXFLAGS)
701    #           SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WX_CONFIG_CXXFLAGS}")
702        #       ENDIF(WX_CONFIG_CXXFLAGS)
703     
704     
705     
706     
707      MARK_AS_ADVANCED(
708        CMAKE_WXWINDOWS_CXX_FLAGS
709        WXWINDOWS_INCLUDE_DIR
710        WXWINDOWS_LIBRARIES
711        CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
712        )
713     
714     
715      ## we really need wx-config...
716    ELSE(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)   
717      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.")
718      MARK_AS_ADVANCED(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
719    ENDIF(CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE)
720
721   
722   
723  ELSE(UNIX_STYLE_FIND)
724    MESSAGE(STATUS "FindwxWindows.cmake:  Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX")
725  ENDIF(UNIX_STYLE_FIND)
726ENDIF(WIN32_STYLE_FIND)
727
728
729IF(WXWINDOWS_LIBRARIES)
730  IF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
731    ## found all we need.
732    SET(WXWINDOWS_FOUND 1)
733   
734    ## set deprecated variables for backward compatibility:
735    SET(CMAKE_WX_CAN_COMPILE   ${WXWINDOWS_FOUND})
736    SET(WXWINDOWS_LIBRARY     ${WXWINDOWS_LIBRARIES})
737    SET(WXWINDOWS_INCLUDE_PATH ${WXWINDOWS_INCLUDE_DIR})
738    SET(WXWINDOWS_LINK_DIRECTORIES ${WXWINDOWS_LINK_DIRECTORIES})
739    SET(CMAKE_WX_CXX_FLAGS     ${CMAKE_WXWINDOWS_CXX_FLAGS})
740   
741  ENDIF(WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS)
742ENDIF(WXWINDOWS_LIBRARIES)
743
744
745
746
747IF(WXWINDOWS_FOUND)
748 
749  #MESSAGE("DBG Use_wxWindows.cmake:  WXWINDOWS_INCLUDE_DIR=${WXWINDOWS_INCLUDE_DIR} WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}     WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}  CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS} WXWINDOWS_DEFINITIONS=${WXWINDOWS_DEFINITIONS}")
750 
751  IF(WXWINDOWS_INCLUDE_DIR)
752    INCLUDE_DIRECTORIES(${WXWINDOWS_INCLUDE_DIR})
753  ENDIF(WXWINDOWS_INCLUDE_DIR)
754 
755  IF(WXWINDOWS_LINK_DIRECTORIES)
756    LINK_DIRECTORIES(${WXWINDOWS_LINK_DIRECTORIES})
757  ENDIF(WXWINDOWS_LINK_DIRECTORIES)
758 
759  IF(WXWINDOWS_LIBRARIES)
760    LINK_LIBRARIES(${WXWINDOWS_LIBRARIES})
761  ENDIF(WXWINDOWS_LIBRARIES)
762 
763  IF (CMAKE_WXWINDOWS_CXX_FLAGS)
764    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_WXWINDOWS_CXX_FLAGS}")
765  ENDIF(CMAKE_WXWINDOWS_CXX_FLAGS)
766 
767  IF(WXWINDOWS_DEFINITIONS)
768    ADD_DEFINITIONS(${WXWINDOWS_DEFINITIONS})
769  ENDIF(WXWINDOWS_DEFINITIONS)
770
771ELSE(WXWINDOWS_FOUND)
772  MESSAGE(SEND_ERROR "wxWindows not found by Use_wxWindows.cmake")
773ENDIF(WXWINDOWS_FOUND)
774
Note: See TracBrowser for help on using the repository browser.