# Distributed under the OSI-approved BSD 3-Clause License. See accompanying
# file Copyright.txt or https://cmake.org/licensing for details.
#[=======================================================================[.rst:
F i n d w x W i n d o w s
- - - - - - - - - - - - -
. . d e p r e c a t e d : : 3 . 0
R e p l a c e d b y : m o d u l e : ` F i n d w x W i d g e t s ` .
F i n d wxWindows ( wxWidgets ) i n s t a l l a t i o n
T h i s m o d u l e f i n d s i f w x W i n d o w s / w x W i d g e t s i s i n s t a l l e d a n d d e t e r m i n e s
w h e r e t h e i n c l u d e f i l e s a n d l i b r a r i e s a r e . I t a l s o d e t e r m i n e s w h a t
t h e n a m e o f t h e l i b r a r y i s . T h i s c o d e s e t s t h e f o l l o w i n g v a r i a b l e s :
: :
W X W I N D O W S _ F O U N D = s y s t e m h a s W x W i n d o w s
W X W I N D O W S _ L I B R A R I E S = p a t h t o t h e w x W i n d o w s l i b r a r i e s
o n U n i x / L i n u x w i t h a d d i t i o n a l
l i n k e r f l a g s f r o m
" w x - c o n f i g - - l i b s "
C M A K E _ W X W I N D O W S _ C X X _ F L A G S = C o m p i l e r f l a g s f o r w x W i n d o w s ,
e s s e n t i a l l y " ` w x - c o n f i g - - c x x f l a g s ` "
o n L i n u x
W X W I N D O W S _ I N C L U D E _ D I R = w h e r e t o f i n d " w x / w x . h " a n d " w x / s e t u p . h "
W X W I N D O W S _ L I N K _ D I R E C T O R I E S = l i n k d i r e c t o r i e s , u s e f u l f o r r p a t h o n
U n i x
W X W I N D O W S _ D E F I N I T I O N S = e x t r a d e f i n e s
O P T I O N S I f y o u n e e d O p e n G L s u p p o r t p l e a s e
: :
set ( WXWINDOWS_USE_GL 1 )
i n y o u r C M a k e L i s t s . t x t * b e f o r e * y o u i n c l u d e t h i s f i l e .
: :
H A V E _ I S Y S T E M - t r u e r e q u i r e d t o r e p l a c e - I b y - i s y s t e m o n g + +
F o r c o n v e n i e n c e i n c l u d e U s e _ w x W i n d o w s . c m a k e i n y o u r p r o j e c t ' s
C M a k e L i s t s . t x t u s i n g
include ( ${ CMAKE_CURRENT_LIST_DIR } /Use_wxWindows.cmake ) .
U S A G E
: :
set ( WXWINDOWS_USE_GL 1 )
find_package ( wxWindows )
N O T E S w x W i d g e t s 2 . 6 . x i s s u p p o r t e d f o r m o n o l i t h i c b u i l d s e . g .
c o m p i l e d i n w x / b u i l d / m s w d i r a s :
: :
n m a k e - f m a k e f i l e . v c B U I L D = d e b u g S H A R E D = 0 U S E _ O P E N G L = 1 M O N O L I T H I C = 1
D E P R E C A T E D
: :
C M A K E _ W X _ C A N _ C O M P I L E
W X W I N D O W S _ L I B R A R Y
C M A K E _ W X _ C X X _ F L A G S
W X W I N D O W S _ I N C L U D E _ P A T H
A U T H O R J a n W o e t z e l < h t t p : / / w w w . m i p . i n f o r m a t i k . u n i - k i e l . d e / ~ j w >
( 0 7 / 2 0 0 3 - 0 1 / 2 0 0 6 )
#]=======================================================================]
# ------------------------------------------------------------------
#
# -removed OPTION for CMAKE_WXWINDOWS_USE_GL. Force the developer to SET it before calling this.
# -major update for wx 2.6.2 and monolithic build option. (10/2005)
#
# STATUS
# tested with:
# cmake 1.6.7, Linux (Suse 7.3), wxWindows 2.4.0, gcc 2.95
# cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.0, gcc 3.3
# cmake 1.6.7, Linux (Suse 8.2), wxWindows 2.4.1-patch1, gcc 3.3
# cmake 1.6.7, MS Windows XP home, wxWindows 2.4.1, MS Visual Studio .net 7 2002 (static build)
# cmake 2.0.5 on Windows XP and Suse Linux 9.2
# cmake 2.0.6 on Windows XP and Suse Linux 9.2, wxWidgets 2.6.2 MONOLITHIC build
# cmake 2.2.2 on Windows XP, MS Visual Studio .net 2003 7.1 wxWidgets 2.6.2 MONOLITHIC build
#
# TODO
# -OPTION for unicode builds
# -further testing of DLL linking under MS WIN32
# -better support for non-monolithic builds
#
if ( WIN32 )
set ( WIN32_STYLE_FIND 1 )
endif ( )
if ( MINGW )
set ( WIN32_STYLE_FIND 0 )
set ( UNIX_STYLE_FIND 1 )
endif ( )
if ( UNIX )
set ( UNIX_STYLE_FIND 1 )
endif ( )
if ( WIN32_STYLE_FIND )
## ######################################################################
##
## Windows specific:
##
## candidates for root/base directory of wxwindows
## should have subdirs include and lib containing include/wx/wx.h
## fix the root dir to avoid mixing of headers/libs from different
## versions/builds:
## WX supports monolithic and multiple smaller libs (since 2.5.x), we prefer monolithic for now.
## monolithic = WX is built as a single big library
## e.g. compile on WIN32 as "nmake -f makefile.vc MONOLITHIC=1 BUILD=debug SHARED=0 USE_OPENGL=1" (JW)
option ( WXWINDOWS_USE_MONOLITHIC "Use monolithic build of WX??" ON )
mark_as_advanced ( WXWINDOWS_USE_MONOLITHIC )
## GL libs used?
option ( WXWINDOWS_USE_GL "Use Wx with GL support(glcanvas)?" ON )
mark_as_advanced ( WXWINDOWS_USE_GL )
## avoid mixing of headers and libs between multiple installed WX versions,
## select just one tree here:
find_path ( WXWINDOWS_ROOT_DIR include/wx/wx.h
H I N T S
E N V W X W I N
" [ H K E Y _ L O C A L _ M A C H I N E \ \ S O F T W A R E \ \ M i c r o s o f t \ \ W i n d o w s \ \ C u r r e n t V e r s i o n \ \ U n i n s t a l l \ \ w x W i d g e t s _ i s 1 ; I n n o S e t u p : A p p P a t h ] " ## WX 2.6.x
" [ H K E Y _ L O C A L _ M A C H I N E \ \ S O F T W A R E \ \ M i c r o s o f t \ \ W i n d o w s \ \ C u r r e n t V e r s i o n \ \ U n i n s t a l l \ \ w x W i n d o w s _ i s 1 ; I n n o S e t u p : A p p P a t h ] " ## WX 2.4.x
P A T H S
C : / w x W i d g e t s - 2 . 6 . 2
D : / w x W i d g e t s - 2 . 6 . 2
C : / w x W i d g e t s - 2 . 6 . 1
D : / w x W i d g e t s - 2 . 6 . 1
C : / w x W i n d o w s - 2 . 4 . 2
D : / w x W i n d o w s - 2 . 4 . 2
)
# message("DBG found WXWINDOWS_ROOT_DIR: ${WXWINDOWS_ROOT_DIR}")
## find libs for combination of static/shared with release/debug
## be careful if you add something here,
## avoid mixing of headers and libs of different wx versions,
## there may be multiple WX versions installed.
set ( WXWINDOWS_POSSIBLE_LIB_PATHS
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b "
)
## monolithic?
if ( WXWINDOWS_USE_MONOLITHIC )
find_library ( WXWINDOWS_STATIC_LIBRARY
N A M E S w x w x m s w w x m s w 2 6
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c r e l e a s e b u i l d l i b r a r y " )
find_library ( WXWINDOWS_STATIC_DEBUG_LIBRARY
N A M E S w x d w x m s w d w x m s w 2 6 d
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c d e b u g b u i l d l i b r a r y " )
find_library ( WXWINDOWS_SHARED_LIBRARY
N A M E S w x m s w 2 6 w x m s w 2 6 2 w x m s w 2 4 w x m s w 2 4 2 w x m s w 2 4 1 w x m s w 2 4 0 w x 2 3 _ 2 w x 2 2 _ 9
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ d l l "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s h a r e d r e l e a s e b u i l d l i b r a r y " )
find_library ( WXWINDOWS_SHARED_DEBUG_LIBRARY
N A M E S w x m s w 2 6 d w x m s w 2 6 2 d w x m s w 2 4 d w x m s w 2 4 1 d w x m s w 2 4 0 d w x 2 3 _ 2 d w x 2 2 _ 9 d
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ d l l "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s h a r e d d e b u g b u i l d l i b r a r y " )
##
## required for WXWINDOWS_USE_GL
## gl lib is always build separate:
##
find_library ( WXWINDOWS_STATIC_LIBRARY_GL
N A M E S w x _ g l w x m s w _ g l w x m s w 2 6 _ g l
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c r e l e a s e b u i l d G L l i b r a r y " )
find_library ( WXWINDOWS_STATIC_DEBUG_LIBRARY_GL
N A M E S w x d _ g l w x m s w d _ g l w x m s w 2 6 d _ g l
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c d e b u g b u i l d G L l i b r a r y " )
find_library ( WXWINDOWS_STATIC_DEBUG_LIBRARY_PNG
N A M E S w x p n g d
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c d e b u g p n g l i b r a r y " )
find_library ( WXWINDOWS_STATIC_LIBRARY_PNG
N A M E S w x p n g
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c p n g l i b r a r y " )
find_library ( WXWINDOWS_STATIC_DEBUG_LIBRARY_TIFF
N A M E S w x t i f f d
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c d e b u g t i f f l i b r a r y " )
find_library ( WXWINDOWS_STATIC_LIBRARY_TIFF
N A M E S w x t i f f
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c t i f f l i b r a r y " )
find_library ( WXWINDOWS_STATIC_DEBUG_LIBRARY_JPEG
N A M E S w x j p e g d w x j p g d
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c d e b u g j p e g l i b r a r y " )
find_library ( WXWINDOWS_STATIC_LIBRARY_JPEG
N A M E S w x j p e g w x j p g
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c j p e g l i b r a r y " )
find_library ( WXWINDOWS_STATIC_DEBUG_LIBRARY_ZLIB
N A M E S w x z l i b d
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c d e b u g z l i b l i b r a r y " )
find_library ( WXWINDOWS_STATIC_LIBRARY_ZLIB
N A M E S w x z l i b
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c z i b l i b r a r y " )
find_library ( WXWINDOWS_STATIC_DEBUG_LIBRARY_REGEX
N A M E S w x r e g e x d
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c d e b u g r e g e x l i b r a r y " )
find_library ( WXWINDOWS_STATIC_LIBRARY_REGEX
N A M E S w x r e g e x
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s t a t i c r e g e x l i b r a r y " )
## untested:
find_library ( WXWINDOWS_SHARED_LIBRARY_GL
N A M E S w x _ g l w x m s w _ g l w x m s w 2 6 _ g l
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ d l l "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s h a r e d r e l e a s e b u i l d G L l i b r a r y " )
find_library ( WXWINDOWS_SHARED_DEBUG_LIBRARY_GL
N A M E S w x d _ g l w x m s w d _ g l w x m s w 2 6 d _ g l
P A T H S
" $ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ d l l "
$ { W X W I N D O W S _ P O S S I B L E _ L I B _ P A T H S }
D O C " w x W i n d o w s s h a r e d d e b u g b u i l d G L l i b r a r y " )
else ( )
## WX is built as multiple small pieces libraries instead of monolithic
## DEPECATED (jw) replaced by more general WXWINDOWS_USE_MONOLITHIC ON/OFF
# option(WXWINDOWS_SEPARATE_LIBS_BUILD "Is wxWindows build with separate libs?" OFF)
## HACK: This is very dirty.
## because the libs of a particular version are explicitly listed
## and NOT searched/verified.
## TODO: Really search for each lib, then decide for
## monolithic x debug x shared x GL (=16 combinations) for at least 18 libs
## --> about 288 combinations
## thus we need a different approach so solve this correctly ...
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)." )
set ( WXWINDOWS_STATIC_LIBS ${ WXWINDOWS_STATIC_LIBS }
w x b a s e 2 6
w x b a s e 2 6 _ n e t
w x b a s e 2 6 _ o d b c
w x b a s e 2 6 _ x m l
w x m s w 2 6 _ a d v
w x m s w 2 6 _ c o r e
w x m s w 2 6 _ d b g r i d
w x m s w 2 6 _ g l
w x m s w 2 6 _ h t m l
w x m s w 2 6 _ m e d i a
w x m s w 2 6 _ q a
w x m s w 2 6 _ x r c
w x e x p a t
w x j p e g
w x p n g
w x r e g e x
w x t i f f
w x z l i b
c o m c t l 3 2
r p c r t 4
w s o c k 3 2
)
## HACK: feed in to optimized / debug libraries if both were FOUND.
set ( WXWINDOWS_STATIC_DEBUG_LIBS ${ WXWINDOWS_STATIC_DEBUG_LIBS }
w x b a s e 2 6 d
w x b a s e 2 6 d _ n e t
w x b a s e 2 6 d _ o d b c
w x b a s e 2 6 d _ x m l
w x m s w 2 6 d _ a d v
w x m s w 2 6 d _ c o r e
w x m s w 2 6 d _ d b g r i d
w x m s w 2 6 d _ g l
w x m s w 2 6 d _ h t m l
w x m s w 2 6 d _ m e d i a
w x m s w 2 6 d _ q a
w x m s w 2 6 d _ x r c
w x e x p a t d
w x j p e g d
w x p n g d
w x r e g e x d
w x t i f f d
w x z l i b d
c o m c t l 3 2
r p c r t 4
w s o c k 3 2
)
endif ( )
##
## now we should have found all WX libs available on the system.
## let the user decide which of the available onse to use.
##
## if there is at least one shared lib available
## let user choose whether to use shared or static wxwindows libs
if ( WXWINDOWS_SHARED_LIBRARY OR WXWINDOWS_SHARED_DEBUG_LIBRARY )
## default value OFF because wxWindows MSVS default build is static
option ( WXWINDOWS_USE_SHARED_LIBS
" U s e s h a r e d versions ( dll ) o f w x W i n d o w s l i b r a r i e s ? " O F F )
mark_as_advanced ( WXWINDOWS_USE_SHARED_LIBS )
endif ( )
## add system libraries wxwindows always seems to depend on
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
c o m c t l 3 2
r p c r t 4
w s o c k 3 2
)
if ( NOT WXWINDOWS_USE_SHARED_LIBS )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
## these ones don't seem required, in particular ctl3d32 is not necessary (Jan Woetzel 07/2003)
# ctl3d32
d e b u g $ { W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ Z L I B } o p t i m i z e d $ { W X W I N D O W S _ S T A T I C _ L I B R A R Y _ Z L I B }
d e b u g $ { W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ R E G E X } o p t i m i z e d $ { W X W I N D O W S _ S T A T I C _ L I B R A R Y _ R E G E X }
d e b u g $ { W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ P N G } o p t i m i z e d $ { W X W I N D O W S _ S T A T I C _ L I B R A R Y _ P N G }
d e b u g $ { W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ J P E G } o p t i m i z e d $ { W X W I N D O W S _ S T A T I C _ L I B R A R Y _ J P E G }
d e b u g $ { W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ T I F F } o p t i m i z e d $ { W X W I N D O W S _ S T A T I C _ L I B R A R Y _ T I F F }
)
endif ( )
## opengl/glu: TODO/FIXME: better use FindOpenGL.cmake here
## assume release versions of glu an dopengl, here.
if ( WXWINDOWS_USE_GL )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
o p e n g l 3 2
g l u 3 2 )
endif ( )
##
## select between use of shared or static wxWindows lib then set libs to use
## for debug and optimized build. so the user can switch between debug and
## release build e.g. within MS Visual Studio without running cmake with a
## different build directory again.
##
## then add the build specific include dir for wx/setup.h
##
if ( WXWINDOWS_USE_SHARED_LIBS )
##message("DBG wxWindows use shared lib selected.")
## assume that both builds use the same setup(.h) for simplicity
## shared: both wx (debug and release) found?
## assume that both builds use the same setup(.h) for simplicity
if ( WXWINDOWS_SHARED_DEBUG_LIBRARY AND WXWINDOWS_SHARED_LIBRARY )
##message("DBG wx shared: debug and optimized found.")
find_path ( WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / m s w d l l d
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / m s w d l l
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ d l l / m s w d
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ d l l / m s w )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
d e b u g $ { W X W I N D O W S _ S H A R E D _ D E B U G _ L I B R A R Y }
o p t i m i z e d $ { W X W I N D O W S _ S H A R E D _ L I B R A R Y } )
if ( WXWINDOWS_USE_GL )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
d e b u g $ { W X W I N D O W S _ S H A R E D _ D E B U G _ L I B R A R Y _ G L }
o p t i m i z e d $ { W X W I N D O W S _ S H A R E D _ L I B R A R Y _ G L } )
endif ( )
endif ( )
## shared: only debug wx lib found?
if ( WXWINDOWS_SHARED_DEBUG_LIBRARY )
if ( NOT WXWINDOWS_SHARED_LIBRARY )
##message("DBG wx shared: debug (but no optimized) found.")
find_path ( WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / m s w d l l d
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ d l l / m s w d )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
$ { W X W I N D O W S _ S H A R E D _ D E B U G _ L I B R A R Y } )
if ( WXWINDOWS_USE_GL )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
$ { W X W I N D O W S _ S H A R E D _ D E B U G _ L I B R A R Y _ G L } )
endif ( )
endif ( )
endif ( )
## shared: only release wx lib found?
if ( NOT WXWINDOWS_SHARED_DEBUG_LIBRARY )
if ( WXWINDOWS_SHARED_LIBRARY )
##message("DBG wx shared: optimized (but no debug) found.")
find_path ( WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / m s w d l l
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ d l l / m s w )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
$ { W X W I N D O W S _ S H A R E D _ D E B U G _ L I B R A R Y } )
if ( WXWINDOWS_USE_GL )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
$ { W X W I N D O W S _ S H A R E D _ D E B U G _ L I B R A R Y _ G L } )
endif ( )
endif ( )
endif ( )
## shared: none found?
if ( NOT WXWINDOWS_SHARED_DEBUG_LIBRARY )
if ( NOT WXWINDOWS_SHARED_LIBRARY )
message ( STATUS
" N o s h a r e d w x W i n d o w s l i b f o u n d , b u t W X W I N D O W S _ U S E _ S H A R E D _ L I B S = $ { W X W I N D O W S _ U S E _ S H A R E D _ L I B S } . " )
endif ( )
endif ( )
#########################################################################################
else ( )
##jw: DEPRECATED if(NOT WXWINDOWS_SEPARATE_LIBS_BUILD)
## static: both wx (debug and release) found?
## assume that both builds use the same setup(.h) for simplicity
if ( WXWINDOWS_STATIC_DEBUG_LIBRARY AND WXWINDOWS_STATIC_LIBRARY )
##message("DBG wx static: debug and optimized found.")
find_path ( WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / m s w d
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / m s w
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b / m s w d
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b / m s w )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
d e b u g $ { W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y }
o p t i m i z e d $ { W X W I N D O W S _ S T A T I C _ L I B R A R Y } )
if ( WXWINDOWS_USE_GL )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
d e b u g $ { W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ G L }
o p t i m i z e d $ { W X W I N D O W S _ S T A T I C _ L I B R A R Y _ G L } )
endif ( )
endif ( )
## static: only debug wx lib found?
if ( WXWINDOWS_STATIC_DEBUG_LIBRARY )
if ( NOT WXWINDOWS_STATIC_LIBRARY )
##message("DBG wx static: debug (but no optimized) found.")
find_path ( WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / m s w d
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b / m s w d )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
$ { W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y } )
if ( WXWINDOWS_USE_GL )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
$ { W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ G L } )
endif ( )
endif ( )
endif ( )
## static: only release wx lib found?
if ( NOT WXWINDOWS_STATIC_DEBUG_LIBRARY )
if ( WXWINDOWS_STATIC_LIBRARY )
##message("DBG wx static: optimized (but no debug) found.")
find_path ( WXWINDOWS_INCLUDE_DIR_SETUPH wx/setup.h
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / m s w
$ { W X W I N D O W S _ R O O T _ D I R } / l i b / v c _ l i b / m s w )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
$ { W X W I N D O W S _ S T A T I C _ L I B R A R Y } )
if ( WXWINDOWS_USE_GL )
set ( WXWINDOWS_LIBRARIES ${ WXWINDOWS_LIBRARIES }
$ { W X W I N D O W S _ S T A T I C _ L I B R A R Y _ G L } )
endif ( )
endif ( )
endif ( )
## static: none found?
if ( NOT WXWINDOWS_STATIC_DEBUG_LIBRARY AND NOT WXWINDOWS_SEPARATE_LIBS_BUILD )
if ( NOT WXWINDOWS_STATIC_LIBRARY )
message ( STATUS
" N o s t a t i c w x W i n d o w s l i b f o u n d , b u t W X W I N D O W S _ U S E _ S H A R E D _ L I B S = $ { W X W I N D O W S _ U S E _ S H A R E D _ L I B S } . " )
endif ( )
endif ( )
endif ( )
## not necessary in wxWindows 2.4.1 and 2.6.2
## but it may fix a previous bug, see
## http://lists.wxwindows.org/cgi-bin/ezmlm-cgi?8:mss:37574:200305:mpdioeneabobmgjenoap
option ( WXWINDOWS_SET_DEFINITIONS "Set additional defines for wxWindows" OFF )
mark_as_advanced ( WXWINDOWS_SET_DEFINITIONS )
if ( WXWINDOWS_SET_DEFINITIONS )
set ( WXWINDOWS_DEFINITIONS "-DWINVER=0x400" )
else ( )
# clear:
set ( WXWINDOWS_DEFINITIONS "" )
endif ( )
## Find the include directories for wxwindows
## the first, build specific for wx/setup.h was determined before.
## add inc dir for general for "wx/wx.h"
find_path ( WXWINDOWS_INCLUDE_DIR wx/wx.h
" $ { W X W I N D O W S _ R O O T _ D I R } / i n c l u d e " )
## append the build specific include dir for wx/setup.h:
if ( WXWINDOWS_INCLUDE_DIR_SETUPH )
set ( WXWINDOWS_INCLUDE_DIR ${ WXWINDOWS_INCLUDE_DIR } ${ WXWINDOWS_INCLUDE_DIR_SETUPH } )
endif ( )
mark_as_advanced (
W X W I N D O W S _ R O O T _ D I R
W X W I N D O W S _ I N C L U D E _ D I R
W X W I N D O W S _ I N C L U D E _ D I R _ S E T U P H
W X W I N D O W S _ S T A T I C _ L I B R A R Y
W X W I N D O W S _ S T A T I C _ L I B R A R Y _ G L
W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y
W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ G L
W X W I N D O W S _ S T A T I C _ L I B R A R Y _ Z L I B
W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ Z L I B
W X W I N D O W S _ S T A T I C _ L I B R A R Y _ R E G E X
W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ R E G E X
W X W I N D O W S _ S T A T I C _ L I B R A R Y _ P N G
W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ P N G
W X W I N D O W S _ S T A T I C _ L I B R A R Y _ J P E G
W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ J P E G
W X W I N D O W S _ S T A T I C _ D E B U G _ L I B R A R Y _ T I F F
W X W I N D O W S _ S T A T I C _ L I B R A R Y _ T I F F
W X W I N D O W S _ S H A R E D _ L I B R A R Y
W X W I N D O W S _ S H A R E D _ D E B U G _ L I B R A R Y
W X W I N D O W S _ S H A R E D _ L I B R A R Y _ G L
W X W I N D O W S _ S H A R E D _ D E B U G _ L I B R A R Y _ G L
)
else ( )
if ( UNIX_STYLE_FIND )
## ######################################################################
##
## UNIX/Linux specific:
##
## use backquoted wx-config to query and set flags and libs:
## 06/2003 Jan Woetzel
##
option ( WXWINDOWS_USE_SHARED_LIBS "Use shared versions (.so) of wxWindows libraries" ON )
mark_as_advanced ( WXWINDOWS_USE_SHARED_LIBS )
# JW removed option and force the develper th SET it.
# option(WXWINDOWS_USE_GL "use wxWindows with GL support (use additional
# --gl-libs for wx-config)?" OFF)
# wx-config should be in your path anyhow, usually no need to set WXWIN or
# search in ../wx or ../../wx
find_program ( CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE
N A M E S $ E N V { W X _ C O N F I G } w x - c o n f i g
H I N T S
E N V W X W I N
$ E N V { W X W I N } / b i n
P A T H S
. . / w x / b i n
. . / . . / w x / b i n )
# check whether wx-config was found:
if ( CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE )
# use shared/static wx lib?
# remember: always link shared to use systems GL etc. libs (no static
# linking, just link *against* static .a libs)
if ( WXWINDOWS_USE_SHARED_LIBS )
set ( WX_CONFIG_ARGS_LIBS "--libs" )
else ( )
set ( WX_CONFIG_ARGS_LIBS "--static --libs" )
endif ( )
# do we need additionial wx GL stuff like GLCanvas ?
if ( WXWINDOWS_USE_GL )
string ( APPEND WX_CONFIG_ARGS_LIBS " --gl-libs" )
endif ( )
##message("DBG: WX_CONFIG_ARGS_LIBS=${WX_CONFIG_ARGS_LIBS}===")
# set CXXFLAGS to be fed into CMAKE_CXX_FLAGS by the user:
if ( HAVE_ISYSTEM ) # does the compiler support -isystem ?
if ( NOT APPLE ) # -isystem seem sto be unsuppored on Mac
if ( CMAKE_COMPILER_IS_GNUCC AND CMAKE_COMPILER_IS_GNUCXX )
if ( CMAKE_CXX_COMPILER MATCHES g\\+\\+ )
set ( CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags|sed -e s/-I/-isystem/g`" )
else ( )
set ( CMAKE_WXWINDOWS_CXX_FLAGS "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} --cxxflags`" )
endif ( )
endif ( )
endif ( )
endif ( )
##message("DBG: for compilation:
##CMAKE_WXWINDOWS_CXX_FLAGS=${CMAKE_WXWINDOWS_CXX_FLAGS}===")
# keep the back-quoted string for clarity
set ( WXWINDOWS_LIBRARIES "`${CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE} ${WX_CONFIG_ARGS_LIBS}`" )
##message("DBG2: for linking:
##WXWINDOWS_LIBRARIES=${WXWINDOWS_LIBRARIES}===")
# evaluate wx-config output to separate linker flags and linkdirs for
# rpath:
exec_program ( ${ CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE }
A R G S $ { W X _ C O N F I G _ A R G S _ L I B S }
O U T P U T _ V A R I A B L E W X _ C O N F I G _ L I B S )
## extract linkdirs (-L) for rpath
## use regular expression to match wildcard equivalent "-L*<endchar>"
## with <endchar> is a space or a semicolon
string ( REGEX MATCHALL "[-][L]([^ ;])+" WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX "${WX_CONFIG_LIBS}" )
# message("DBG WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX=${WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX}")
## remove prefix -L because we need the pure directory for LINK_DIRECTORIES
## replace -L by ; because the separator seems to be lost otherwise (bug or
## feature?)
if ( WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX )
string ( REGEX REPLACE "[-][L]" ";" WXWINDOWS_LINK_DIRECTORIES ${ WXWINDOWS_LINK_DIRECTORIES_WITH_PREFIX } )
# message("DBG WXWINDOWS_LINK_DIRECTORIES=${WXWINDOWS_LINK_DIRECTORIES}")
endif ( )
## replace space separated string by semicolon separated vector to make it
## work with LINK_DIRECTORIES
separate_arguments ( WXWINDOWS_LINK_DIRECTORIES )
mark_as_advanced (
C M A K E _ W X W I N D O W S _ C X X _ F L A G S
W X W I N D O W S _ I N C L U D E _ D I R
W X W I N D O W S _ L I B R A R I E S
C M A K E _ W X W I N D O W S _ W X C O N F I G _ E X E C U T A B L E
)
## we really need wx-config...
else ( )
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." )
mark_as_advanced ( CMAKE_WXWINDOWS_WXCONFIG_EXECUTABLE )
endif ( )
else ( )
message ( STATUS "FindwxWindows.cmake: Platform unknown/unsupported by FindwxWindows.cmake. It's neither WIN32 nor UNIX" )
endif ( )
endif ( )
if ( WXWINDOWS_LIBRARIES )
if ( WXWINDOWS_INCLUDE_DIR OR CMAKE_WXWINDOWS_CXX_FLAGS )
## found all we need.
set ( WXWINDOWS_FOUND 1 )
## set deprecated variables for backward compatibility:
set ( CMAKE_WX_CAN_COMPILE ${ WXWINDOWS_FOUND } )
set ( WXWINDOWS_LIBRARY ${ WXWINDOWS_LIBRARIES } )
set ( WXWINDOWS_INCLUDE_PATH ${ WXWINDOWS_INCLUDE_DIR } )
set ( WXWINDOWS_LINK_DIRECTORIES ${ WXWINDOWS_LINK_DIRECTORIES } )
set ( CMAKE_WX_CXX_FLAGS ${ CMAKE_WXWINDOWS_CXX_FLAGS } )
endif ( )
endif ( )