2023-11-01 06:11:15 +08:00
# 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 Q t 4
- - - - - - -
F i n d i n g a n d U s i n g Q t 4
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
T h i s m o d u l e c a n b e u s e d t o f i n d Q t 4 . T h e m o s t i m p o r t a n t i s s u e i s t h a t
t h e Q t 4 q m a k e i s a v a i l a b l e v i a t h e s y s t e m p a t h . T h i s q m a k e i s t h e n
u s e d t o d e t e c t b a s i c a l l y e v e r y t h i n g e l s e . T h i s m o d u l e d e f i n e s a
n u m b e r o f : p r o p _ t g t : ` I M P O R T E D ` t a r g e t s , m a c r o s a n d v a r i a b l e s .
T y p i c a l u s a g e c o u l d b e s o m e t h i n g l i k e :
. . c o d e - b l o c k : : c m a k e
set ( CMAKE_AUTOMOC ON )
set ( CMAKE_INCLUDE_CURRENT_DIR ON )
find_package ( Qt4 4.4.3 REQUIRED QtGui QtXml )
add_executable ( myexe main.cpp )
target_link_libraries ( myexe Qt4::QtGui Qt4::QtXml )
. . n o t e : :
W h e n u s i n g : p r o p _ t g t : ` I M P O R T E D ` t a r g e t s , t h e q t m a i n . l i b s t a t i c l i b r a r y i s
a u t o m a t i c a l l y l i n k e d o n W i n d o w s f o r : p r o p _ t g t : ` WIN32 < W I N 3 2 _ E X E C U T A B L E > `
e x e c u t a b l e s . T o d i s a b l e t h a t g l o b a l l y , s e t t h e
` ` Q T 4 _ N O _ L I N K _ Q T M A I N ` ` v a r i a b l e b e f o r e f i n d i n g Q t 4 . T o d i s a b l e t h a t
f o r a p a r t i c u l a r e x e c u t a b l e , s e t t h e ` ` Q T 4 _ N O _ L I N K _ Q T M A I N ` ` t a r g e t
p r o p e r t y t o ` ` T R U E ` ` o n t h e e x e c u t a b l e .
Q t B u i l d T o o l s
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
Q t r e l i e s o n s o m e b u n d l e d t o o l s f o r c o d e g e n e r a t i o n , s u c h a s ` ` m o c ` ` f o r
m e t a - o b j e c t c o d e g e n e r a t i o n , ` ` u i c ` ` f o r w i d g e t l a y o u t a n d p o p u l a t i o n ,
a n d ` ` r c c ` ` f o r v i r t u a l f i l e s y s t e m c o n t e n t g e n e r a t i o n . T h e s e t o o l s m a y b e
a u t o m a t i c a l l y i n v o k e d b y : m a n u a l : ` cmake ( 1 ) ` i f t h e a p p r o p r i a t e c o n d i t i o n s
a r e m e t . S e e : m a n u a l : ` c m a k e - qt ( 7 ) ` f o r m o r e .
Q t M a c r o s
^ ^ ^ ^ ^ ^ ^ ^ ^
I n s o m e c a s e s i t c a n b e n e c e s s a r y o r u s e f u l t o i n v o k e t h e Q t b u i l d t o o l s i n a
m o r e - m a n u a l w a y . S e v e r a l m a c r o s a r e a v a i l a b l e t o a d d t a r g e t s f o r s u c h u s e s .
: :
m a c r o QT4_WRAP_CPP ( outfiles inputfile ... [TARGET tgt] OPTIONS ... )
c r e a t e m o c c o d e f r o m a l i s t o f f i l e s c o n t a i n i n g Q t c l a s s w i t h
t h e Q _ O B J E C T d e c l a r a t i o n . P e r - d i r e c t o r y p r e p r o c e s s o r d e f i n i t i o n s
a r e a l s o a d d e d . I f t h e < t g t > i s s p e c i f i e d , t h e
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S a n d I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S f r o m
t h e < t g t > a r e p a s s e d t o m o c . O p t i o n s m a y b e g i v e n t o m o c , s u c h a s
t h o s e f o u n d w h e n e x e c u t i n g " m o c - h e l p " .
: :
m a c r o QT4_WRAP_UI ( outfiles inputfile ... OPTIONS ... )
c r e a t e c o d e f r o m a l i s t o f Q t d e s i g n e r u i f i l e s .
O p t i o n s m a y b e g i v e n t o u i c , s u c h a s t h o s e f o u n d
w h e n e x e c u t i n g " u i c - h e l p "
: :
m a c r o QT4_ADD_RESOURCES ( outfiles inputfile ... OPTIONS ... )
c r e a t e c o d e f r o m a l i s t o f Q t r e s o u r c e f i l e s .
O p t i o n s m a y b e g i v e n t o r c c , s u c h a s t h o s e f o u n d
w h e n e x e c u t i n g " r c c - h e l p "
: :
m a c r o QT4_GENERATE_MOC ( inputfile outputfile [TARGET tgt] )
c r e a t e s a r u l e t o r u n m o c o n i n f i l e a n d c r e a t e o u t f i l e .
U s e t h i s i f f o r s o m e r e a s o n QT4_WRAP_CPP ( ) i s n ' t a p p r o p r i a t e , e . g .
b e c a u s e y o u n e e d a c u s t o m f i l e n a m e f o r t h e m o c f i l e o r s o m e t h i n g
s i m i l a r . I f t h e < t g t > i s s p e c i f i e d , t h e
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S a n d I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S f r o m
t h e < t g t > a r e p a s s e d t o m o c .
: :
m a c r o QT4_ADD_DBUS_INTERFACE ( outfiles interface basename )
C r e a t e t h e i n t e r f a c e h e a d e r a n d i m p l e m e n t a t i o n f i l e s w i t h t h e
g i v e n b a s e n a m e f r o m t h e g i v e n i n t e r f a c e x m l f i l e a n d a d d i t t o
t h e l i s t o f s o u r c e s .
Y o u c a n p a s s a d d i t i o n a l p a r a m e t e r s t o t h e q d b u s x m l 2 c p p c a l l b y s e t t i n g
p r o p e r t i e s o n t h e i n p u t f i l e :
I N C L U D E t h e g i v e n f i l e w i l l b e i n c l u d e d i n t h e g e n e r a t e i n t e r f a c e h e a d e r
C L A S S N A M E t h e g e n e r a t e d c l a s s i s n a m e d a c c o r d i n g l y
N O _ N A M E S P A C E t h e g e n e r a t e d c l a s s i s n o t w r a p p e d i n a n a m e s p a c e
: :
m a c r o QT4_ADD_DBUS_INTERFACES ( outfiles inputfile ... )
C r e a t e t h e i n t e r f a c e h e a d e r a n d i m p l e m e n t a t i o n f i l e s
f o r a l l l i s t e d i n t e r f a c e x m l f i l e s .
T h e b a s e n a m e w i l l b e a u t o m a t i c a l l y d e t e r m i n e d f r o m t h e n a m e
o f t h e x m l f i l e .
T h e s o u r c e f i l e p r o p e r t i e s d e s c r i b e d f o r
Q T 4 _ A D D _ D B U S _ I N T E R F A C E a l s o a p p l y h e r e .
: :
m a c r o QT4_ADD_DBUS_ADAPTOR ( outfiles xmlfile parentheader parentclassname
[ b a s e n a m e ] [ c l a s s n a m e ] )
c r e a t e a d b u s adaptor ( header and implementation file ) f r o m t h e x m l f i l e
d e s c r i b i n g t h e i n t e r f a c e , a n d a d d i t t o t h e l i s t o f s o u r c e s . T h e a d a p t o r
f o r w a r d s t h e c a l l s t o a p a r e n t c l a s s , d e f i n e d i n p a r e n t h e a d e r a n d n a m e d
p a r e n t c l a s s n a m e . T h e n a m e o f t h e g e n e r a t e d f i l e s w i l l b e
< b a s e n a m e > a d a p t o r . { c p p , h } w h e r e b a s e n a m e d e f a u l t s t o t h e b a s e n a m e o f t h e
x m l f i l e .
I f < c l a s s n a m e > i s p r o v i d e d , t h e n i t w i l l b e u s e d a s t h e c l a s s n a m e o f t h e
a d a p t o r i t s e l f .
: :
m a c r o QT4_GENERATE_DBUS_INTERFACE ( header [interfacename] OPTIONS ... )
g e n e r a t e t h e x m l i n t e r f a c e f i l e f r o m t h e g i v e n h e a d e r .
I f t h e o p t i o n a l a r g u m e n t i n t e r f a c e n a m e i s o m i t t e d , t h e n a m e o f t h e
i n t e r f a c e f i l e i s c o n s t r u c t e d f r o m t h e b a s e n a m e o f t h e h e a d e r w i t h
t h e s u f f i x . x m l a p p e n d e d .
O p t i o n s m a y b e g i v e n t o q d b u s c p p 2 x m l , s u c h a s t h o s e f o u n d w h e n
e x e c u t i n g " q d b u s c p p 2 x m l - - h e l p "
: :
m a c r o QT4_CREATE_TRANSLATION ( qm_files directories ... sources ...
t s _ f i l e s . . . O P T I O N S . . . )
o u t : q m _ f i l e s
i n : d i r e c t o r i e s s o u r c e s t s _ f i l e s
o p t i o n s : f l a g s t o p a s s t o l u p d a t e , s u c h a s - e x t e n s i o n s t o s p e c i f y
e x t e n s i o n s f o r a d i r e c t o r y s c a n .
g e n e r a t e s c o m m a n d s t o c r e a t e . ts ( vie lupdate ) a n d . q m
( v i a l r e l e a s e ) - f i l e s f r o m d i r e c t o r i e s a n d / o r s o u r c e s . T h e t s f i l e s a r e
c r e a t e d a n d / o r u p d a t e d i n t h e s o u r c e tree ( unless given with full paths ) .
T h e q m f i l e s a r e g e n e r a t e d i n t h e b u i l d t r e e .
U p d a t i n g t h e t r a n s l a t i o n s c a n b e d o n e b y a d d i n g t h e q m _ f i l e s
t o t h e s o u r c e l i s t o f y o u r l i b r a r y / e x e c u t a b l e , s o t h e y a r e
a l w a y s u p d a t e d , o r b y a d d i n g a c u s t o m t a r g e t t o c o n t r o l w h e n
t h e y g e t u p d a t e d / g e n e r a t e d .
: :
m a c r o QT4_ADD_TRANSLATION ( qm_files ts_files ... )
o u t : q m _ f i l e s
i n : t s _ f i l e s
g e n e r a t e s c o m m a n d s t o c r e a t e . q m f r o m . t s - f i l e s . T h e g e n e r a t e d
f i l e n a m e s c a n b e f o u n d i n q m _ f i l e s . T h e t s _ f i l e s
m u s t e x i s t a n d a r e n o t u p d a t e d i n a n y w a y .
: :
m a c r o QT4_AUTOMOC ( sourcefile1 sourcefile2 ... [TARGET tgt] )
T h e q t 4 _ a u t o m o c m a c r o i s o b s o l e t e . U s e t h e C M A K E _ A U T O M O C f e a t u r e i n s t e a d .
T h i s m a c r o i s s t i l l e x p e r i m e n t a l .
I t c a n b e u s e d t o h a v e m o c a u t o m a t i c a l l y h a n d l e d .
S o i f y o u h a v e t h e f i l e s f o o . h a n d f o o . c p p , a n d i n f o o . h a
a c l a s s u s e s t h e Q _ O B J E C T m a c r o , m o c h a s t o r u n o n i t . I f y o u d o n ' t
w a n t t o u s e QT4_WRAP_CPP ( ) ( w h i c h i s r e l i a b l e a n d m a t u r e ) , y o u c a n i n s e r t
#include "foo.moc"
i n f o o . c p p a n d t h e n g i v e f o o . c p p a s a r g u m e n t t o QT4_AUTOMOC ( ) . T h i s w i l l
s c a n a l l l i s t e d f i l e s a t c m a k e - t i m e f o r s u c h i n c l u d e d m o c f i l e s a n d i f i t
f i n d s t h e m c a u s e a r u l e t o b e g e n e r a t e d t o r u n m o c a t b u i l d t i m e o n t h e
a c c o m p a n y i n g h e a d e r f i l e f o o . h .
I f a s o u r c e f i l e h a s t h e S K I P _ A U T O M O C p r o p e r t y s e t i t w i l l b e i g n o r e d b y
t h i s m a c r o .
I f t h e < t g t > i s s p e c i f i e d , t h e I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S a n d
I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S f r o m t h e < t g t > a r e p a s s e d t o m o c .
: :
f u n c t i o n QT4_USE_MODULES ( target [link_type] modules... )
T h i s f u n c t i o n i s o b s o l e t e . U s e t a r g e t _ l i n k _ l i b r a r i e s w i t h I M P O R T E D t a r g e t s
i n s t e a d .
M a k e < t a r g e t > u s e t h e < m o d u l e s > f r o m Q t . U s i n g a Q t m o d u l e m e a n s
t o l i n k t o t h e l i b r a r y , a d d t h e r e l e v a n t i n c l u d e d i r e c t o r i e s f o r t h e
m o d u l e , a n d a d d t h e r e l e v a n t c o m p i l e r d e f i n e s f o r u s i n g t h e m o d u l e .
M o d u l e s a r e r o u g h l y e q u i v a l e n t t o c o m p o n e n t s o f Q t 4 , s o u s a g e w o u l d b e
s o m e t h i n g l i k e :
qt4_use_modules ( myexe Core Gui Declarative )
t o u s e Q t C o r e , Q t G u i a n d Q t D e c l a r a t i v e . T h e o p t i o n a l < l i n k _ t y p e > a r g u m e n t
c a n b e s p e c i f i e d a s e i t h e r L I N K _ P U B L I C o r L I N K _ P R I V A T E t o s p e c i f y t h e
s a m e a r g u m e n t t o t h e t a r g e t _ l i n k _ l i b r a r i e s c a l l .
I M P O R T E D T a r g e t s
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
A p a r t i c u l a r Q t l i b r a r y m a y b e u s e d b y u s i n g t h e c o r r e s p o n d i n g
: p r o p _ t g t : ` I M P O R T E D ` t a r g e t w i t h t h e : c o m m a n d : ` t a r g e t _ l i n k _ l i b r a r i e s `
c o m m a n d :
. . c o d e - b l o c k : : c m a k e
target_link_libraries ( myexe Qt4::QtGui Qt4::QtXml )
U s i n g a t a r g e t i n t h i s w a y c a u s e s : cmake ( 1 ) ` t o u s e t h e a p p r o p r i a t e i n c l u d e
d i r e c t o r i e s a n d c o m p i l e d e f i n i t i o n s f o r t h e t a r g e t w h e n c o m p i l i n g ` ` m y e x e ` ` .
T a r g e t s a r e a w a r e o f t h e i r d e p e n d e n c i e s , s o f o r e x a m p l e i t i s n o t n e c e s s a r y
t o l i s t ` ` Q t 4 : : Q t C o r e ` ` i f a n o t h e r Q t l i b r a r y i s l i s t e d , a n d i t i s n o t
n e c e s s a r y t o l i s t ` ` Q t 4 : : Q t G u i ` ` i f ` ` Q t 4 : : Q t D e c l a r a t i v e ` ` i s l i s t e d .
T a r g e t s m a y b e t e s t e d f o r e x i s t e n c e i n t h e u s u a l w a y w i t h t h e
: c o m m a n d : ` if ( TARGET ) ` c o m m a n d .
T h e Q t t o o l k i t m a y c o n t a i n b o t h d e b u g a n d r e l e a s e l i b r a r i e s .
: m a n u a l : ` cmake ( 1 ) ` w i l l c h o o s e t h e a p p r o p r i a t e v e r s i o n b a s e d o n t h e b u i l d
c o n f i g u r a t i o n .
` ` Q t 4 : : Q t C o r e ` `
T h e Q t C o r e t a r g e t
` ` Q t 4 : : Q t G u i ` `
T h e Q t G u i t a r g e t
` ` Q t 4 : : Q t 3 S u p p o r t ` `
T h e Q t 3 S u p p o r t t a r g e t
` ` Q t 4 : : Q t A s s i s t a n t ` `
T h e Q t A s s i s t a n t t a r g e t
` ` Q t 4 : : Q t A s s i s t a n t C l i e n t ` `
T h e Q t A s s i s t a n t C l i e n t t a r g e t
` ` Q t 4 : : Q A x C o n t a i n e r ` `
T h e Q A x C o n t a i n e r target ( Windows only )
` ` Q t 4 : : Q A x S e r v e r ` `
T h e Q A x S e r v e r target ( Windows only )
` ` Q t 4 : : Q t D B u s ` `
T h e Q t D B u s t a r g e t
` ` Q t 4 : : Q t D e c l a r a t i v e ` `
T h e Q t D e c l a r a t i v e t a r g e t
` ` Q t 4 : : Q t D e s i g n e r ` `
T h e Q t D e s i g n e r t a r g e t
` ` Q t 4 : : Q t D e s i g n e r C o m p o n e n t s ` `
T h e Q t D e s i g n e r C o m p o n e n t s t a r g e t
` ` Q t 4 : : Q t H e l p ` `
T h e Q t H e l p t a r g e t
` ` Q t 4 : : Q t M o t i f ` `
T h e Q t M o t i f t a r g e t
` ` Q t 4 : : Q t M u l t i m e d i a ` `
T h e Q t M u l t i m e d i a t a r g e t
` ` Q t 4 : : Q t N e t w o r k ` `
T h e Q t N e t w o r k t a r g e t
` ` Q t 4 : : Q t N s P L u g i n ` `
T h e Q t N s P L u g i n t a r g e t
` ` Q t 4 : : Q t O p e n G L ` `
T h e Q t O p e n G L t a r g e t
` ` Q t 4 : : Q t S c r i p t ` `
T h e Q t S c r i p t t a r g e t
` ` Q t 4 : : Q t S c r i p t T o o l s ` `
T h e Q t S c r i p t T o o l s t a r g e t
` ` Q t 4 : : Q t S q l ` `
T h e Q t S q l t a r g e t
` ` Q t 4 : : Q t S v g ` `
T h e Q t S v g t a r g e t
` ` Q t 4 : : Q t T e s t ` `
T h e Q t T e s t t a r g e t
` ` Q t 4 : : Q t U i T o o l s ` `
T h e Q t U i T o o l s t a r g e t
` ` Q t 4 : : Q t W e b K i t ` `
T h e Q t W e b K i t t a r g e t
` ` Q t 4 : : Q t X m l ` `
T h e Q t X m l t a r g e t
` ` Q t 4 : : Q t X m l P a t t e r n s ` `
T h e Q t X m l P a t t e r n s t a r g e t
` ` Q t 4 : : p h o n o n ` `
T h e p h o n o n t a r g e t
R e s u l t V a r i a b l e s
^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^ ^
B e l o w i s a d e t a i l e d l i s t o f v a r i a b l e s t h a t F i n d Q t 4 . c m a k e s e t s .
` ` Q t 4 _ F O U N D ` `
I f f a l s e , d o n ' t t r y t o u s e Q t 4 .
` ` Q T _ F O U N D ` `
I f f a l s e , d o n ' t t r y t o u s e Q t . T h i s v a r i a b l e i s f o r c o m p a t i b i l i t y o n l y .
` ` Q T 4 _ F O U N D ` `
I f f a l s e , d o n ' t t r y t o u s e Q t 4 . T h i s v a r i a b l e i s f o r c o m p a t i b i l i t y o n l y .
` ` Q T _ V E R S I O N _ M A J O R ` `
T h e m a j o r v e r s i o n o f Q t f o u n d .
` ` Q T _ V E R S I O N _ M I N O R ` `
T h e m i n o r v e r s i o n o f Q t f o u n d .
` ` Q T _ V E R S I O N _ P A T C H ` `
T h e p a t c h v e r s i o n o f Q t f o u n d .
#]=======================================================================]
# Use find_package( Qt4 COMPONENTS ... ) to enable modules
if ( Qt4_FIND_COMPONENTS )
foreach ( component ${ Qt4_FIND_COMPONENTS } )
string ( TOUPPER ${ component } _COMPONENT )
set ( QT_USE_ ${ _COMPONENT } 1 )
endforeach ( )
# To make sure we don't use QtCore or QtGui when not in COMPONENTS
if ( NOT QT_USE_QTCORE )
set ( QT_DONT_USE_QTCORE 1 )
endif ( )
if ( NOT QT_USE_QTGUI )
set ( QT_DONT_USE_QTGUI 1 )
endif ( )
endif ( )
# If Qt3 has already been found, fail.
if ( QT_QT_LIBRARY )
if ( Qt4_FIND_REQUIRED )
message ( FATAL_ERROR "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned." )
else ( )
if ( NOT Qt4_FIND_QUIETLY )
message ( STATUS "Qt3 and Qt4 cannot be used together in one project. If switching to Qt4, the CMakeCache.txt needs to be cleaned." )
endif ( )
return ( )
endif ( )
endif ( )
include ( ${ CMAKE_CURRENT_LIST_DIR } /CheckCXXSymbolExists.cmake )
include ( ${ CMAKE_CURRENT_LIST_DIR } /MacroAddFileDependencies.cmake )
include ( ${ CMAKE_CURRENT_LIST_DIR } /FindPackageHandleStandardArgs.cmake )
include ( ${ CMAKE_CURRENT_LIST_DIR } /CMakePushCheckState.cmake )
set ( QT_USE_FILE ${ CMAKE_ROOT } /Modules/UseQt4.cmake )
set ( QT_DEFINITIONS "" )
# convenience macro for dealing with debug/release library names
macro ( _QT4_ADJUST_LIB_VARS _camelCaseBasename )
string ( TOUPPER "${_camelCaseBasename}" basename )
# The name of the imported targets, i.e. the prefix "Qt4::" must not change,
# since it is stored in EXPORT-files as name of a required library. If the name would change
# here, this would lead to the imported Qt4-library targets not being resolved by cmake anymore.
if ( QT_ ${ basename } _LIBRARY_RELEASE OR QT_ ${ basename } _LIBRARY_DEBUG )
if ( NOT TARGET Qt4:: ${ _camelCaseBasename } )
add_library ( Qt4:: ${ _camelCaseBasename } UNKNOWN IMPORTED )
if ( QT_ ${ basename } _LIBRARY_RELEASE )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } APPEND PROPERTY IMPORTED_CONFIGURATIONS RELEASE )
set ( _location "${QT_${basename}_LIBRARY_RELEASE}" )
if ( QT_USE_FRAMEWORKS AND EXISTS ${ _location } / ${ _camelCaseBasename } )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY IMPORTED_LOCATION_RELEASE "${_location}/${_camelCaseBasename}" )
else ( )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY IMPORTED_LOCATION_RELEASE "${_location}" )
endif ( )
endif ( )
if ( QT_ ${ basename } _LIBRARY_DEBUG )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } APPEND PROPERTY IMPORTED_CONFIGURATIONS DEBUG )
set ( _location "${QT_${basename}_LIBRARY_DEBUG}" )
if ( QT_USE_FRAMEWORKS AND EXISTS ${ _location } / ${ _camelCaseBasename } )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY IMPORTED_LOCATION_DEBUG "${_location}/${_camelCaseBasename}" )
else ( )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY IMPORTED_LOCATION_DEBUG "${_location}" )
endif ( )
endif ( )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S
" $ { Q T _ $ { b a s e n a m e } _ I N C L U D E _ D I R } "
)
string ( REGEX REPLACE "^QT" "" _stemname ${ basename } )
set_property ( TARGET Qt4:: ${ _camelCaseBasename } PROPERTY
I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S
" Q T _ $ { _ s t e m n a m e } _ L I B "
)
endif ( )
# If QT_USE_IMPORTED_TARGETS is enabled, the QT_QTFOO_LIBRARY variables are set to point at these
# imported targets. This works better in general, and is also in almost all cases fully
# backward compatible. The only issue is when a project A which had this enabled then exports its
# libraries via export or export_library_dependencies(). In this case the libraries from project
# A will depend on the imported Qt targets, and the names of these imported targets will be stored
# in the dependency files on disk. This means when a project B then uses project A, these imported
# targets must be created again, otherwise e.g. "Qt4__QtCore" will be interpreted as name of a
# library file on disk, and not as a target, and linking will fail:
if ( QT_USE_IMPORTED_TARGETS )
set ( QT_ ${ basename } _LIBRARY Qt4:: ${ _camelCaseBasename } )
set ( QT_ ${ basename } _LIBRARIES Qt4:: ${ _camelCaseBasename } )
else ( )
# if the release- as well as the debug-version of the library have been found:
if ( QT_ ${ basename } _LIBRARY_DEBUG AND QT_ ${ basename } _LIBRARY_RELEASE )
# if the generator is multi-config or if CMAKE_BUILD_TYPE is set for
# single-config generators, set optimized and debug libraries
get_property ( _isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG )
if ( _isMultiConfig OR CMAKE_BUILD_TYPE )
set ( QT_ ${ basename } _LIBRARY optimized ${ QT_${basename } _LIBRARY_RELEASE} debug ${ QT_${basename } _LIBRARY_DEBUG} )
else ( )
# For single-config generators where CMAKE_BUILD_TYPE has no value,
# just use the release libraries
set ( QT_ ${ basename } _LIBRARY ${ QT_${basename } _LIBRARY_RELEASE} )
endif ( )
set ( QT_ ${ basename } _LIBRARIES optimized ${ QT_${basename } _LIBRARY_RELEASE} debug ${ QT_${basename } _LIBRARY_DEBUG} )
endif ( )
# if only the release version was found, set the debug variable also to the release version
if ( QT_ ${ basename } _LIBRARY_RELEASE AND NOT QT_ ${ basename } _LIBRARY_DEBUG )
set ( QT_ ${ basename } _LIBRARY_DEBUG ${ QT_${basename } _LIBRARY_RELEASE} )
set ( QT_ ${ basename } _LIBRARY ${ QT_${basename } _LIBRARY_RELEASE} )
set ( QT_ ${ basename } _LIBRARIES ${ QT_${basename } _LIBRARY_RELEASE} )
endif ( )
# if only the debug version was found, set the release variable also to the debug version
if ( QT_ ${ basename } _LIBRARY_DEBUG AND NOT QT_ ${ basename } _LIBRARY_RELEASE )
set ( QT_ ${ basename } _LIBRARY_RELEASE ${ QT_${basename } _LIBRARY_DEBUG} )
set ( QT_ ${ basename } _LIBRARY ${ QT_${basename } _LIBRARY_DEBUG} )
set ( QT_ ${ basename } _LIBRARIES ${ QT_${basename } _LIBRARY_DEBUG} )
endif ( )
# put the value in the cache:
set ( QT_ ${ basename } _LIBRARY ${ QT_${basename } _LIBRARY} CACHE STRING "The Qt ${basename} library" FORCE )
endif ( )
set ( QT_ ${ basename } _FOUND 1 )
else ( )
set ( QT_ ${ basename } _LIBRARY "" CACHE STRING "The Qt ${basename} library" FORCE )
endif ( )
if ( QT_ ${ basename } _INCLUDE_DIR )
#add the include directory to QT_INCLUDES
set ( QT_INCLUDES "${QT_${basename}_INCLUDE_DIR}" ${ QT_INCLUDES } )
endif ( )
# Make variables changeable to the advanced user
mark_as_advanced ( QT_ ${ basename } _LIBRARY QT_ ${ basename } _LIBRARY_RELEASE QT_ ${ basename } _LIBRARY_DEBUG QT_ ${ basename } _INCLUDE_DIR )
endmacro ( )
function ( _QT4_QUERY_QMAKE VAR RESULT )
execute_process ( COMMAND "${QT_QMAKE_EXECUTABLE}" -query ${ VAR }
R E S U L T _ V A R I A B L E r e t u r n _ c o d e
O U T P U T _ V A R I A B L E o u t p u t
O U T P U T _ S T R I P _ T R A I L I N G _ W H I T E S P A C E E R R O R _ S T R I P _ T R A I L I N G _ W H I T E S P A C E )
if ( NOT return_code )
file ( TO_CMAKE_PATH "${output}" output )
set ( ${ RESULT } ${ output } PARENT_SCOPE )
endif ( )
endfunction ( )
function ( _QT4_GET_VERSION_COMPONENTS VERSION RESULT_MAJOR RESULT_MINOR RESULT_PATCH )
string ( REGEX REPLACE "^([0-9]+)\\.[0-9]+\\.[0-9]+.*" "\\1" QT_VERSION_MAJOR "${QTVERSION}" )
string ( REGEX REPLACE "^[0-9]+\\.([0-9]+)\\.[0-9]+.*" "\\1" QT_VERSION_MINOR "${QTVERSION}" )
string ( REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]+).*" "\\1" QT_VERSION_PATCH "${QTVERSION}" )
set ( ${ RESULT_MAJOR } ${ QT_VERSION_MAJOR } PARENT_SCOPE )
set ( ${ RESULT_MINOR } ${ QT_VERSION_MINOR } PARENT_SCOPE )
set ( ${ RESULT_PATCH } ${ QT_VERSION_PATCH } PARENT_SCOPE )
endfunction ( )
function ( _QT4_FIND_QMAKE QMAKE_NAMES QMAKE_RESULT VERSION_RESULT )
list ( LENGTH QMAKE_NAMES QMAKE_NAMES_LEN )
if ( ${ QMAKE_NAMES_LEN } EQUAL 0 )
return ( )
endif ( )
list ( GET QMAKE_NAMES 0 QMAKE_NAME )
get_filename_component ( qt_install_version "[HKEY_CURRENT_USER\\Software\\trolltech\\Versions;DefaultQtVersion]" NAME )
find_program ( QT_QMAKE_EXECUTABLE NAMES ${ QMAKE_NAME }
P A T H S
E N V Q T D I R
" [ H K E Y _ C U R R E N T _ U S E R \ \ S o f t w a r e \ \ T r o l l t e c h \ \ V e r s i o n s \ \ $ { q t _ i n s t a l l _ v e r s i o n } ; I n s t a l l D i r ] "
P A T H _ S U F F I X E S b i n
D O C " T h e q m a k e e x e c u t a b l e f o r t h e Q t i n s t a l l a t i o n t o u s e "
)
set ( major 0 )
if ( QT_QMAKE_EXECUTABLE )
_qt4_query_qmake ( QT_VERSION QTVERSION )
_qt4_get_version_components ( "${QTVERSION}" major minor patch )
endif ( )
if ( NOT QT_QMAKE_EXECUTABLE OR NOT "${major}" EQUAL 4 )
set ( curr_qmake "${QT_QMAKE_EXECUTABLE}" )
set ( curr_qt_version "${QTVERSION}" )
set ( QT_QMAKE_EXECUTABLE NOTFOUND CACHE FILEPATH "" FORCE )
list ( REMOVE_AT QMAKE_NAMES 0 )
_qt4_find_qmake ( "${QMAKE_NAMES}" QMAKE QTVERSION )
_qt4_get_version_components ( "${QTVERSION}" major minor patch )
if ( NOT ${ major } EQUAL 4 )
# Restore possibly found qmake and it's version; these are used later
# in error message if incorrect version is found
set ( QT_QMAKE_EXECUTABLE "${curr_qmake}" CACHE FILEPATH "" FORCE )
set ( QTVERSION "${curr_qt_version}" )
endif ( )
endif ( )
set ( ${ QMAKE_RESULT } "${QT_QMAKE_EXECUTABLE}" PARENT_SCOPE )
set ( ${ VERSION_RESULT } "${QTVERSION}" PARENT_SCOPE )
endfunction ( )
set ( QT4_INSTALLED_VERSION_TOO_OLD FALSE )
set ( _QT4_QMAKE_NAMES qmake qmake4 qmake-qt4 qmake-mac )
_qt4_find_qmake ( "${_QT4_QMAKE_NAMES}" QT_QMAKE_EXECUTABLE QTVERSION )
if ( QT_QMAKE_EXECUTABLE AND
Q T V E R S I O N V E R S I O N _ G R E A T E R 3 A N D Q T V E R S I O N V E R S I O N _ L E S S 5 )
if ( Qt5Core_FOUND )
# Qt5CoreConfig sets QT_MOC_EXECUTABLE as a non-cache variable to the Qt 5
# path to moc. Unset that variable when Qt 4 and 5 are used together, so
# that when find_program looks for moc, it is not set to the Qt 5 version.
# If FindQt4 has already put the Qt 4 path in the cache, the unset()
# command 'unhides' the (correct) cache variable.
unset ( QT_MOC_EXECUTABLE )
endif ( )
if ( QT_QMAKE_EXECUTABLE_LAST )
string ( COMPARE NOTEQUAL "${QT_QMAKE_EXECUTABLE_LAST}" "${QT_QMAKE_EXECUTABLE}" QT_QMAKE_CHANGED )
endif ( )
set ( QT_QMAKE_EXECUTABLE_LAST "${QT_QMAKE_EXECUTABLE}" CACHE INTERNAL "" FORCE )
_qt4_get_version_components ( "${QTVERSION}" QT_VERSION_MAJOR QT_VERSION_MINOR QT_VERSION_PATCH )
# ask qmake for the mkspecs directory
# we do this first because QT_LIBINFIX might be set
if ( NOT QT_MKSPECS_DIR OR QT_QMAKE_CHANGED )
_qt4_query_qmake ( QMAKE_MKSPECS qt_mkspecs_dirs )
# do not replace : on windows as it might be a drive letter
# and windows should already use ; as a separator
if ( NOT WIN32 )
string ( REPLACE ":" ";" qt_mkspecs_dirs "${qt_mkspecs_dirs}" )
endif ( )
find_path ( QT_MKSPECS_DIR NAMES qconfig.pri
H I N T S $ { q t _ m k s p e c s _ d i r s }
P A T H _ S U F F I X E S m k s p e c s s h a r e / q t 4 / m k s p e c s
D O C " T h e l o c a t i o n o f t h e Q t m k s p e c s c o n t a i n i n g q c o n f i g . p r i " )
endif ( )
if ( EXISTS "${QT_MKSPECS_DIR}/qconfig.pri" )
file ( READ ${ QT_MKSPECS_DIR } /qconfig.pri _qconfig_FILE_contents )
string ( REGEX MATCH "QT_CONFIG[^\n]+" QT_QCONFIG "${_qconfig_FILE_contents}" )
string ( REGEX MATCH "CONFIG[^\n]+" QT_CONFIG "${_qconfig_FILE_contents}" )
string ( REGEX MATCH "EDITION[^\n]+" QT_EDITION "${_qconfig_FILE_contents}" )
string ( REGEX MATCH "QT_LIBINFIX[^\n]+" _qconfig_qt_libinfix "${_qconfig_FILE_contents}" )
string ( REGEX REPLACE "QT_LIBINFIX *= *([^\n]*)" "\\1" QT_LIBINFIX "${_qconfig_qt_libinfix}" )
endif ( )
if ( "${QT_EDITION}" MATCHES "DesktopLight" )
set ( QT_EDITION_DESKTOPLIGHT 1 )
endif ( )
# ask qmake for the library dir as a hint, then search for QtCore library and use that as a reference for finding the
# others and for setting QT_LIBRARY_DIR
if ( NOT ( QT_QTCORE_LIBRARY_RELEASE OR QT_QTCORE_LIBRARY_DEBUG ) OR QT_QMAKE_CHANGED )
_qt4_query_qmake ( QT_INSTALL_LIBS QT_LIBRARY_DIR_TMP )
set ( QT_QTCORE_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTCORE_LIBRARY_DEBUG NOTFOUND )
find_library ( QT_QTCORE_LIBRARY_RELEASE
N A M E S Q t C o r e $ { Q T _ L I B I N F I X } Q t C o r e $ { Q T _ L I B I N F I X } 4
H I N T S $ { Q T _ L I B R A R Y _ D I R _ T M P }
N O _ D E F A U L T _ P A T H
)
find_library ( QT_QTCORE_LIBRARY_DEBUG
N A M E S Q t C o r e $ { Q T _ L I B I N F I X } _ d e b u g Q t C o r e $ { Q T _ L I B I N F I X } d Q t C o r e $ { Q T _ L I B I N F I X } d 4
H I N T S $ { Q T _ L I B R A R Y _ D I R _ T M P }
N O _ D E F A U L T _ P A T H
)
if ( NOT QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCORE_LIBRARY_DEBUG )
find_library ( QT_QTCORE_LIBRARY_RELEASE
N A M E S Q t C o r e $ { Q T _ L I B I N F I X } Q t C o r e $ { Q T _ L I B I N F I X } 4
H I N T S $ { Q T _ L I B R A R Y _ D I R _ T M P }
)
find_library ( QT_QTCORE_LIBRARY_DEBUG
N A M E S Q t C o r e $ { Q T _ L I B I N F I X } _ d e b u g Q t C o r e $ { Q T _ L I B I N F I X } d Q t C o r e $ { Q T _ L I B I N F I X } d 4
H I N T S $ { Q T _ L I B R A R Y _ D I R _ T M P }
)
endif ( )
# try dropping a hint if trying to use Visual Studio with Qt built by MinGW
if ( NOT QT_QTCORE_LIBRARY_RELEASE AND MSVC )
if ( EXISTS ${ QT_LIBRARY_DIR_TMP } /libqtmain.a )
message ( FATAL_ERROR "It appears you're trying to use Visual Studio with Qt built by MinGW. Those compilers do not produce code compatible with each other." )
endif ( )
endif ( )
endif ( )
# set QT_LIBRARY_DIR based on location of QtCore found.
if ( QT_QTCORE_LIBRARY_RELEASE )
get_filename_component ( QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_RELEASE}" PATH )
set ( QT_LIBRARY_DIR ${ QT_LIBRARY_DIR_TMP } CACHE INTERNAL "Qt library dir" FORCE )
set ( QT_QTCORE_FOUND 1 )
elseif ( QT_QTCORE_LIBRARY_DEBUG )
get_filename_component ( QT_LIBRARY_DIR_TMP "${QT_QTCORE_LIBRARY_DEBUG}" PATH )
set ( QT_LIBRARY_DIR ${ QT_LIBRARY_DIR_TMP } CACHE INTERNAL "Qt library dir" FORCE )
set ( QT_QTCORE_FOUND 1 )
else ( )
if ( NOT Qt4_FIND_QUIETLY )
message ( WARNING
" $ { Q T _ Q M A K E _ E X E C U T A B L E } r e p o r t e d Q T _ I N S T A L L _ L I B S a s "
" \ " $ { Q T _ L I B R A R Y _ D I R _ T M P } \ " "
" b u t Q t C o r e c o u l d n o t b e f o u n d t h e r e . "
" Q t i s N O T i n s t a l l e d c o r r e c t l y f o r t h e t a r g e t b u i l d e n v i r o n m e n t . " )
endif ( )
set ( Qt4_FOUND FALSE )
if ( Qt4_FIND_REQUIRED )
message ( FATAL_ERROR "Could NOT find QtCore. Check ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log for more details." )
else ( )
return ( )
endif ( )
endif ( )
# ask qmake for the binary dir
if ( NOT QT_BINARY_DIR OR QT_QMAKE_CHANGED )
_qt4_query_qmake ( QT_INSTALL_BINS qt_bins )
set ( QT_BINARY_DIR ${ qt_bins } CACHE INTERNAL "" FORCE )
endif ( )
if ( APPLE )
set ( CMAKE_FIND_FRAMEWORK_OLD ${ CMAKE_FIND_FRAMEWORK } )
if ( EXISTS ${ QT_LIBRARY_DIR } /QtCore.framework )
set ( QT_USE_FRAMEWORKS ON CACHE INTERNAL "" FORCE )
set ( CMAKE_FIND_FRAMEWORK FIRST )
else ( )
set ( QT_USE_FRAMEWORKS OFF CACHE INTERNAL "" FORCE )
set ( CMAKE_FIND_FRAMEWORK LAST )
endif ( )
endif ( )
# ask qmake for the include dir
if ( QT_LIBRARY_DIR AND ( NOT QT_QTCORE_INCLUDE_DIR OR NOT QT_HEADERS_DIR OR QT_QMAKE_CHANGED ) )
_qt4_query_qmake ( QT_INSTALL_HEADERS qt_headers )
set ( QT_QTCORE_INCLUDE_DIR NOTFOUND )
find_path ( QT_QTCORE_INCLUDE_DIR QtCore
H I N T S $ { q t _ h e a d e r s } $ { Q T _ L I B R A R Y _ D I R }
P A T H _ S U F F I X E S Q t C o r e q t 4 / Q t C o r e
N O _ D E F A U L T _ P A T H
)
if ( NOT QT_QTCORE_INCLUDE_DIR )
find_path ( QT_QTCORE_INCLUDE_DIR QtCore
H I N T S $ { q t _ h e a d e r s } $ { Q T _ L I B R A R Y _ D I R }
P A T H _ S U F F I X E S Q t C o r e q t 4 / Q t C o r e
)
endif ( )
# Set QT_HEADERS_DIR based on finding QtCore header
if ( QT_QTCORE_INCLUDE_DIR )
if ( QT_USE_FRAMEWORKS )
set ( QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE )
else ( )
get_filename_component ( qt_headers "${QT_QTCORE_INCLUDE_DIR}/../" ABSOLUTE )
set ( QT_HEADERS_DIR "${qt_headers}" CACHE INTERNAL "" FORCE )
endif ( )
2023-11-01 06:20:22 +08:00
else ( )
2023-11-01 06:11:15 +08:00
message ( "Warning: QT_QMAKE_EXECUTABLE reported QT_INSTALL_HEADERS as ${qt_headers}" )
message ( "Warning: But QtCore couldn't be found. Qt must NOT be installed correctly." )
endif ( )
endif ( )
if ( APPLE )
set ( CMAKE_FIND_FRAMEWORK ${ CMAKE_FIND_FRAMEWORK_OLD } )
endif ( )
# Set QT_INCLUDE_DIR based on QT_HEADERS_DIR
if ( QT_HEADERS_DIR )
if ( QT_USE_FRAMEWORKS )
# Qt/Mac frameworks has two include dirs.
# One is the framework include for which CMake will add a -F flag
# and the other is an include dir for non-framework Qt modules
set ( QT_INCLUDE_DIR ${ QT_HEADERS_DIR } ${ QT_QTCORE_LIBRARY_RELEASE } )
else ( )
set ( QT_INCLUDE_DIR ${ QT_HEADERS_DIR } )
endif ( )
endif ( )
# Set QT_INCLUDES
set ( QT_INCLUDES ${ QT_MKSPECS_DIR } /default ${ QT_INCLUDE_DIR } ${ QT_QTCORE_INCLUDE_DIR } )
# ask qmake for the documentation directory
if ( QT_LIBRARY_DIR AND NOT QT_DOC_DIR OR QT_QMAKE_CHANGED )
_qt4_query_qmake ( QT_INSTALL_DOCS qt_doc_dir )
set ( QT_DOC_DIR ${ qt_doc_dir } CACHE PATH "The location of the Qt docs" FORCE )
endif ( )
# ask qmake for the plugins directory
if ( QT_LIBRARY_DIR AND NOT QT_PLUGINS_DIR OR QT_QMAKE_CHANGED )
_qt4_query_qmake ( QT_INSTALL_PLUGINS qt_plugins_dir )
if ( CMAKE_CROSSCOMPILING OR NOT qt_plugins_dir )
find_path ( QT_PLUGINS_DIR
N A M E S a c c e s s i b l e b e a r e r c o d e c s d e s i g n e r g r a p h i c s s y s t e m s i c o n e n g i n e s i m a g e f o r m a t s i n p u t m e t h o d s q m l t o o l i n g s c r i p t s q l d r i v e r s
H I N T S $ { q t _ p l u g i n s _ d i r }
P A T H _ S U F F I X E S p l u g i n s l i b / q t 4 / p l u g i n s
D O C " T h e l o c a t i o n o f t h e Q t p l u g i n s " )
else ( )
set ( QT_PLUGINS_DIR ${ qt_plugins_dir } CACHE PATH "The location of the Qt plugins" )
endif ( )
endif ( )
# ask qmake for the translations directory
if ( QT_LIBRARY_DIR AND NOT QT_TRANSLATIONS_DIR OR QT_QMAKE_CHANGED )
_qt4_query_qmake ( QT_INSTALL_TRANSLATIONS qt_translations_dir )
set ( QT_TRANSLATIONS_DIR ${ qt_translations_dir } CACHE PATH "The location of the Qt translations" FORCE )
endif ( )
# ask qmake for the imports directory
if ( QT_LIBRARY_DIR AND NOT QT_IMPORTS_DIR OR QT_QMAKE_CHANGED )
_qt4_query_qmake ( QT_INSTALL_IMPORTS qt_imports_dir )
if ( CMAKE_CROSSCOMPILING OR NOT qt_imports_dir )
find_path ( QT_IMPORTS_DIR NAMES Qt
H I N T S $ { q t _ i m p o r t s _ d i r }
P A T H _ S U F F I X E S i m p o r t s l i b / q t 4 / i m p o r t s
D O C " T h e l o c a t i o n o f t h e Q t i m p o r t s " )
else ( )
set ( QT_IMPORTS_DIR ${ qt_imports_dir } CACHE PATH "The location of the Qt imports" )
endif ( )
endif ( )
# Make variables changeable to the advanced user
mark_as_advanced ( QT_LIBRARY_DIR QT_DOC_DIR QT_MKSPECS_DIR
Q T _ P L U G I N S _ D I R Q T _ T R A N S L A T I O N S _ D I R )
#############################################
#
# Find out what window system we're using
#
#############################################
cmake_push_check_state ( )
# Add QT_INCLUDE_DIR to CMAKE_REQUIRED_INCLUDES
list ( APPEND CMAKE_REQUIRED_INCLUDES "${QT_INCLUDE_DIR}" )
set ( CMAKE_REQUIRED_QUIET ${ Qt4_FIND_QUIETLY } )
# Check for Window system symbols (note: only one should end up being set)
CHECK_CXX_SYMBOL_EXISTS ( Q_WS_X11 "QtCore/qglobal.h" Q_WS_X11 )
CHECK_CXX_SYMBOL_EXISTS ( Q_WS_WIN "QtCore/qglobal.h" Q_WS_WIN )
CHECK_CXX_SYMBOL_EXISTS ( Q_WS_QWS "QtCore/qglobal.h" Q_WS_QWS )
CHECK_CXX_SYMBOL_EXISTS ( Q_WS_MAC "QtCore/qglobal.h" Q_WS_MAC )
if ( Q_WS_MAC )
if ( QT_QMAKE_CHANGED )
unset ( QT_MAC_USE_COCOA CACHE )
endif ( )
CHECK_CXX_SYMBOL_EXISTS ( QT_MAC_USE_COCOA "QtCore/qconfig.h" QT_MAC_USE_COCOA )
endif ( )
if ( QT_QTCOPY_REQUIRED )
CHECK_CXX_SYMBOL_EXISTS ( QT_IS_QTCOPY "QtCore/qglobal.h" QT_KDE_QT_COPY )
if ( NOT QT_IS_QTCOPY )
message ( FATAL_ERROR "qt-copy is required, but hasn't been found" )
endif ( )
endif ( )
cmake_pop_check_state ( )
#
#############################################
########################################
#
# Setting the INCLUDE-Variables
#
########################################
set ( QT_MODULES QtGui Qt3Support QtSvg QtScript QtTest QtUiTools
Q t H e l p Q t W e b K i t Q t X m l P a t t e r n s p h o n o n Q t N e t w o r k Q t M u l t i m e d i a
Q t N s P l u g i n Q t O p e n G L Q t S q l Q t X m l Q t D e s i g n e r Q t D B u s Q t S c r i p t T o o l s
Q t D e c l a r a t i v e )
if ( Q_WS_X11 )
set ( QT_MODULES ${ QT_MODULES } QtMotif )
endif ( )
if ( QT_QMAKE_CHANGED )
foreach ( QT_MODULE ${ QT_MODULES } )
string ( TOUPPER ${ QT_MODULE } _upper_qt_module )
set ( QT_ ${ _upper_qt_module } _INCLUDE_DIR NOTFOUND )
set ( QT_ ${ _upper_qt_module } _LIBRARY_RELEASE NOTFOUND )
set ( QT_ ${ _upper_qt_module } _LIBRARY_DEBUG NOTFOUND )
endforeach ( )
set ( QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR NOTFOUND )
set ( QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NOTFOUND )
set ( QT_QTASSISTANTCLIENT_INCLUDE_DIR NOTFOUND )
set ( QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NOTFOUND )
set ( QT_QTASSISTANT_INCLUDE_DIR NOTFOUND )
set ( QT_QTASSISTANT_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTASSISTANT_LIBRARY_DEBUG NOTFOUND )
set ( QT_QTCLUCENE_LIBRARY_RELEASE NOTFOUND )
set ( QT_QTCLUCENE_LIBRARY_DEBUG NOTFOUND )
set ( QT_QAXCONTAINER_INCLUDE_DIR NOTFOUND )
set ( QT_QAXCONTAINER_LIBRARY_RELEASE NOTFOUND )
set ( QT_QAXCONTAINER_LIBRARY_DEBUG NOTFOUND )
set ( QT_QAXSERVER_INCLUDE_DIR NOTFOUND )
set ( QT_QAXSERVER_LIBRARY_RELEASE NOTFOUND )
set ( QT_QAXSERVER_LIBRARY_DEBUG NOTFOUND )
if ( Q_WS_WIN )
set ( QT_QTMAIN_LIBRARY_DEBUG NOTFOUND )
set ( QT_QTMAIN_LIBRARY_RELEASE NOTFOUND )
endif ( )
endif ( )
foreach ( QT_MODULE ${ QT_MODULES } )
string ( TOUPPER ${ QT_MODULE } _upper_qt_module )
find_path ( QT_ ${ _upper_qt_module } _INCLUDE_DIR ${ QT_MODULE }
P A T H S
$ { Q T _ H E A D E R S _ D I R } / $ { Q T _ M O D U L E }
$ { Q T _ L I B R A R Y _ D I R } / $ { Q T _ M O D U L E } . f r a m e w o r k / H e a d e r s
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
# phonon doesn't seem consistent, let's try phonondefs.h for some
# installations
if ( ${ QT_MODULE } STREQUAL "phonon" )
find_path ( QT_ ${ _upper_qt_module } _INCLUDE_DIR phonondefs.h
P A T H S
$ { Q T _ H E A D E R S _ D I R } / $ { Q T _ M O D U L E }
$ { Q T _ L I B R A R Y _ D I R } / $ { Q T _ M O D U L E } . f r a m e w o r k / H e a d e r s
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
endif ( )
endforeach ( )
if ( Q_WS_WIN )
set ( QT_MODULES ${ QT_MODULES } QAxContainer QAxServer )
# Set QT_AXCONTAINER_INCLUDE_DIR and QT_AXSERVER_INCLUDE_DIR
find_path ( QT_QAXCONTAINER_INCLUDE_DIR ActiveQt
P A T H S $ { Q T _ H E A D E R S _ D I R } / A c t i v e Q t
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
find_path ( QT_QAXSERVER_INCLUDE_DIR ActiveQt
P A T H S $ { Q T _ H E A D E R S _ D I R } / A c t i v e Q t
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
endif ( )
# Set QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR
find_path ( QT_QTDESIGNERCOMPONENTS_INCLUDE_DIR QDesignerComponents
P A T H S
$ { Q T _ H E A D E R S _ D I R } / Q t D e s i g n e r
$ { Q T _ L I B R A R Y _ D I R } / Q t D e s i g n e r . f r a m e w o r k / H e a d e r s
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
# Set QT_QTASSISTANT_INCLUDE_DIR
find_path ( QT_QTASSISTANT_INCLUDE_DIR QtAssistant
P A T H S
$ { Q T _ H E A D E R S _ D I R } / Q t A s s i s t a n t
$ { Q T _ L I B R A R Y _ D I R } / Q t A s s i s t a n t . f r a m e w o r k / H e a d e r s
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
# Set QT_QTASSISTANTCLIENT_INCLUDE_DIR
find_path ( QT_QTASSISTANTCLIENT_INCLUDE_DIR QAssistantClient
P A T H S
$ { Q T _ H E A D E R S _ D I R } / Q t A s s i s t a n t
$ { Q T _ L I B R A R Y _ D I R } / Q t A s s i s t a n t . f r a m e w o r k / H e a d e r s
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
########################################
#
# Setting the LIBRARY-Variables
#
########################################
# find the libraries
foreach ( QT_MODULE ${ QT_MODULES } )
string ( TOUPPER ${ QT_MODULE } _upper_qt_module )
find_library ( QT_ ${ _upper_qt_module } _LIBRARY_RELEASE
N A M E S $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } 4
P A T H S $ { Q T _ L I B R A R Y _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
find_library ( QT_ ${ _upper_qt_module } _LIBRARY_DEBUG
N A M E S $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } _ d e b u g $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } d $ { Q T _ M O D U L E } $ { Q T _ L I B I N F I X } d 4
P A T H S $ { Q T _ L I B R A R Y _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
if ( QT_ ${ _upper_qt_module } _LIBRARY_RELEASE MATCHES "/${QT_MODULE}\\.framework$" )
if ( NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_RELEASE}/${QT_MODULE}" )
# Release framework library file does not exist... Force to NOTFOUND:
set ( QT_ ${ _upper_qt_module } _LIBRARY_RELEASE "QT_${_upper_qt_module}_LIBRARY_RELEASE-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE )
endif ( )
endif ( )
if ( QT_ ${ _upper_qt_module } _LIBRARY_DEBUG MATCHES "/${QT_MODULE}\\.framework$" )
if ( NOT EXISTS "${QT_${_upper_qt_module}_LIBRARY_DEBUG}/${QT_MODULE}" )
# Debug framework library file does not exist... Force to NOTFOUND:
set ( QT_ ${ _upper_qt_module } _LIBRARY_DEBUG "QT_${_upper_qt_module}_LIBRARY_DEBUG-NOTFOUND" CACHE FILEPATH "Path to a library." FORCE )
endif ( )
endif ( )
endforeach ( )
# QtUiTools is sometimes not in the same directory as the other found libraries
# e.g. on Mac, its never a framework like the others are
if ( QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTUITOOLS_LIBRARY_RELEASE )
find_library ( QT_QTUITOOLS_LIBRARY_RELEASE NAMES QtUiTools ${ QT_LIBINFIX } PATHS ${ QT_LIBRARY_DIR } )
endif ( )
# Set QT_QTDESIGNERCOMPONENTS_LIBRARY
find_library ( QT_QTDESIGNERCOMPONENTS_LIBRARY_RELEASE NAMES QtDesignerComponents ${ QT_LIBINFIX } QtDesignerComponents ${ QT_LIBINFIX } 4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTDESIGNERCOMPONENTS_LIBRARY_DEBUG NAMES QtDesignerComponents ${ QT_LIBINFIX } _debug QtDesignerComponents ${ QT_LIBINFIX } d QtDesignerComponents ${ QT_LIBINFIX } d4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
# Set QT_QTMAIN_LIBRARY
if ( Q_WS_WIN )
find_library ( QT_QTMAIN_LIBRARY_RELEASE NAMES qtmain ${ QT_LIBINFIX } PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTMAIN_LIBRARY_DEBUG NAMES qtmain ${ QT_LIBINFIX } d PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
endif ( )
# Set QT_QTASSISTANTCLIENT_LIBRARY
find_library ( QT_QTASSISTANTCLIENT_LIBRARY_RELEASE NAMES QtAssistantClient ${ QT_LIBINFIX } QtAssistantClient ${ QT_LIBINFIX } 4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTASSISTANTCLIENT_LIBRARY_DEBUG NAMES QtAssistantClient ${ QT_LIBINFIX } _debug QtAssistantClient ${ QT_LIBINFIX } d QtAssistantClient ${ QT_LIBINFIX } d4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
# Set QT_QTASSISTANT_LIBRARY
find_library ( QT_QTASSISTANT_LIBRARY_RELEASE NAMES QtAssistantClient ${ QT_LIBINFIX } QtAssistantClient ${ QT_LIBINFIX } 4 QtAssistant ${ QT_LIBINFIX } QtAssistant ${ QT_LIBINFIX } 4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTASSISTANT_LIBRARY_DEBUG NAMES QtAssistantClient ${ QT_LIBINFIX } _debug QtAssistantClient ${ QT_LIBINFIX } d QtAssistantClient ${ QT_LIBINFIX } d4 QtAssistant ${ QT_LIBINFIX } _debug QtAssistant ${ QT_LIBINFIX } d4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
# Set QT_QTHELP_LIBRARY
find_library ( QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene ${ QT_LIBINFIX } QtCLucene ${ QT_LIBINFIX } 4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
find_library ( QT_QTCLUCENE_LIBRARY_DEBUG NAMES QtCLucene ${ QT_LIBINFIX } _debug QtCLucene ${ QT_LIBINFIX } d QtCLucene ${ QT_LIBINFIX } d4 PATHS ${ QT_LIBRARY_DIR } NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH )
if ( Q_WS_MAC AND QT_QTCORE_LIBRARY_RELEASE AND NOT QT_QTCLUCENE_LIBRARY_RELEASE )
find_library ( QT_QTCLUCENE_LIBRARY_RELEASE NAMES QtCLucene ${ QT_LIBINFIX } PATHS ${ QT_LIBRARY_DIR } )
endif ( )
############################################
#
# Check the existence of the libraries.
#
############################################
macro ( _qt4_add_target_depends_internal _QT_MODULE _PROPERTY )
if ( TARGET Qt4:: ${ _QT_MODULE } )
foreach ( _DEPEND ${ ARGN } )
set ( _VALID_DEPENDS )
if ( TARGET Qt4::Qt ${ _DEPEND } )
list ( APPEND _VALID_DEPENDS Qt4::Qt ${ _DEPEND } )
endif ( )
if ( _VALID_DEPENDS )
set_property ( TARGET Qt4:: ${ _QT_MODULE } APPEND PROPERTY
$ { _ P R O P E R T Y }
" $ { _ V A L I D _ D E P E N D S } "
)
endif ( )
set ( _VALID_DEPENDS )
endforeach ( )
endif ( )
endmacro ( )
macro ( _qt4_add_target_depends _QT_MODULE )
if ( TARGET Qt4:: ${ _QT_MODULE } )
get_target_property ( _configs Qt4:: ${ _QT_MODULE } IMPORTED_CONFIGURATIONS )
_qt4_add_target_depends_internal ( ${ _QT_MODULE } INTERFACE_LINK_LIBRARIES ${ ARGN } )
foreach ( _config ${ _configs } )
_qt4_add_target_depends_internal ( ${ _QT_MODULE } IMPORTED_LINK_INTERFACE_LIBRARIES_ ${ _config } ${ ARGN } )
endforeach ( )
set ( _configs )
endif ( )
endmacro ( )
macro ( _qt4_add_target_private_depends _QT_MODULE )
if ( TARGET Qt4:: ${ _QT_MODULE } )
get_target_property ( _configs Qt4:: ${ _QT_MODULE } IMPORTED_CONFIGURATIONS )
foreach ( _config ${ _configs } )
_qt4_add_target_depends_internal ( ${ _QT_MODULE } IMPORTED_LINK_DEPENDENT_LIBRARIES_ ${ _config } ${ ARGN } )
endforeach ( )
set ( _configs )
endif ( )
endmacro ( )
# Set QT_xyz_LIBRARY variable and add
# library include path to QT_INCLUDES
_QT4_ADJUST_LIB_VARS ( QtCore )
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
I N T E R F A C E _ I N C L U D E _ D I R E C T O R I E S
" $ { Q T _ M K S P E C S _ D I R } / d e f a u l t "
$ { Q T _ I N C L U D E _ D I R }
)
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
I N T E R F A C E _ C O M P I L E _ D E F I N I T I O N S
$ < $ < N O T : $ < C O N F I G : D e b u g > > : Q T _ N O _ D E B U G >
)
set_property ( TARGET Qt4::QtCore PROPERTY
I N T E R F A C E _ Q T _ M A J O R _ V E R S I O N 4
)
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
C O M P A T I B L E _ I N T E R F A C E _ S T R I N G Q T _ M A J O R _ V E R S I O N
)
foreach ( QT_MODULE ${ QT_MODULES } )
_QT4_ADJUST_LIB_VARS ( ${ QT_MODULE } )
_qt4_add_target_depends ( ${ QT_MODULE } Core )
endforeach ( )
_QT4_ADJUST_LIB_VARS ( QtAssistant )
_QT4_ADJUST_LIB_VARS ( QtAssistantClient )
_QT4_ADJUST_LIB_VARS ( QtCLucene )
_QT4_ADJUST_LIB_VARS ( QtDesignerComponents )
# platform dependent libraries
if ( Q_WS_WIN )
_QT4_ADJUST_LIB_VARS ( qtmain )
_QT4_ADJUST_LIB_VARS ( QAxServer )
if ( QT_QAXSERVER_FOUND )
set_property ( TARGET Qt4::QAxServer PROPERTY
I N T E R F A C E _ Q T 4 _ N O _ L I N K _ Q T M A I N O N
)
set_property ( TARGET Qt4::QAxServer APPEND PROPERTY
C O M P A T I B L E _ I N T E R F A C E _ B O O L Q T 4 _ N O _ L I N K _ Q T M A I N )
endif ( )
_QT4_ADJUST_LIB_VARS ( QAxContainer )
endif ( )
# Only public dependencies are listed here.
# Eg, QtDBus links to QtXml, but users of QtDBus do not need to
# link to QtXml because QtDBus only uses it internally, not in public
# headers.
# Everything depends on QtCore, but that is covered above already
_qt4_add_target_depends ( Qt3Support Sql Gui Network )
if ( TARGET Qt4::Qt3Support )
# An additional define is required for QT3_SUPPORT
set_property ( TARGET Qt4::Qt3Support APPEND PROPERTY INTERFACE_COMPILE_DEFINITIONS QT3_SUPPORT )
endif ( )
_qt4_add_target_depends ( QtDeclarative Script Gui )
_qt4_add_target_depends ( QtDesigner Gui )
_qt4_add_target_depends ( QtHelp Gui )
_qt4_add_target_depends ( QtMultimedia Gui )
_qt4_add_target_depends ( QtOpenGL Gui )
_qt4_add_target_depends ( QtSvg Gui )
_qt4_add_target_depends ( QtWebKit Gui Network )
_qt4_add_target_private_depends ( Qt3Support Xml )
if ( QT_VERSION VERSION_GREATER 4.6 )
_qt4_add_target_private_depends ( QtSvg Xml )
endif ( )
_qt4_add_target_private_depends ( QtDBus Xml )
_qt4_add_target_private_depends ( QtUiTools Xml Gui )
_qt4_add_target_private_depends ( QtHelp Sql Xml Network )
_qt4_add_target_private_depends ( QtXmlPatterns Network )
_qt4_add_target_private_depends ( QtScriptTools Gui )
_qt4_add_target_private_depends ( QtWebKit XmlPatterns )
_qt4_add_target_private_depends ( QtDeclarative XmlPatterns Svg Sql Gui )
_qt4_add_target_private_depends ( QtMultimedia Gui )
_qt4_add_target_private_depends ( QtOpenGL Gui )
if ( QT_QAXSERVER_FOUND )
_qt4_add_target_private_depends ( QAxServer Gui )
endif ( )
if ( QT_QAXCONTAINER_FOUND )
_qt4_add_target_private_depends ( QAxContainer Gui )
endif ( )
_qt4_add_target_private_depends ( phonon Gui )
if ( QT_QTDBUS_FOUND )
_qt4_add_target_private_depends ( phonon DBus )
endif ( )
if ( WIN32 AND NOT QT4_NO_LINK_QTMAIN )
set ( _isExe $< STREQUAL:$<TARGET_PROPERTY:TYPE > ,EXECUTABLE> )
set ( _isWin32 $< BOOL:$<TARGET_PROPERTY:WIN32_EXECUTABLE > > )
set ( _isNotExcluded $< NOT:$<BOOL:$<TARGET_PROPERTY:QT4_NO_LINK_QTMAIN > >> )
set ( _isPolicyNEW $< TARGET_POLICY:CMP0020 > )
get_target_property ( _configs Qt4::QtCore IMPORTED_CONFIGURATIONS )
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
I N T E R F A C E _ L I N K _ L I B R A R I E S
$ < $ < A N D : $ { _ i s E x e } , $ { _ i s W i n 3 2 } , $ { _ i s N o t E x c l u d e d } , $ { _ i s P o l i c y N E W } > : Q t 4 : : q t m a i n >
)
foreach ( _config ${ _configs } )
set_property ( TARGET Qt4::QtCore APPEND PROPERTY
I M P O R T E D _ L I N K _ I N T E R F A C E _ L I B R A R I E S _ $ { _ c o n f i g }
$ < $ < A N D : $ { _ i s E x e } , $ { _ i s W i n 3 2 } , $ { _ i s N o t E x c l u d e d } , $ { _ i s P o l i c y N E W } > : Q t 4 : : q t m a i n >
)
endforeach ( )
unset ( _configs )
unset ( _isExe )
unset ( _isWin32 )
unset ( _isNotExcluded )
unset ( _isPolicyNEW )
endif ( )
#######################################
#
# Check the executables of Qt
# ( moc, uic, rcc )
#
#######################################
if ( QT_QMAKE_CHANGED )
set ( QT_UIC_EXECUTABLE NOTFOUND )
set ( QT_MOC_EXECUTABLE NOTFOUND )
set ( QT_UIC3_EXECUTABLE NOTFOUND )
set ( QT_RCC_EXECUTABLE NOTFOUND )
set ( QT_DBUSCPP2XML_EXECUTABLE NOTFOUND )
set ( QT_DBUSXML2CPP_EXECUTABLE NOTFOUND )
set ( QT_LUPDATE_EXECUTABLE NOTFOUND )
set ( QT_LRELEASE_EXECUTABLE NOTFOUND )
set ( QT_QCOLLECTIONGENERATOR_EXECUTABLE NOTFOUND )
set ( QT_DESIGNER_EXECUTABLE NOTFOUND )
set ( QT_LINGUIST_EXECUTABLE NOTFOUND )
endif ( )
macro ( _find_qt4_program VAR NAME )
find_program ( ${ VAR }
N A M E S $ { A R G N }
P A T H S $ { Q T _ B I N A R Y _ D I R }
N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
if ( ${ VAR } AND NOT TARGET ${ NAME } )
add_executable ( ${ NAME } IMPORTED )
set_property ( TARGET ${ NAME } PROPERTY IMPORTED_LOCATION ${ ${VAR } } )
endif ( )
endmacro ( )
_find_qt4_program ( QT_MOC_EXECUTABLE Qt4::moc moc-qt4 moc4 moc )
_find_qt4_program ( QT_UIC_EXECUTABLE Qt4::uic uic-qt4 uic4 uic )
_find_qt4_program ( QT_UIC3_EXECUTABLE Qt4::uic3 uic3 )
_find_qt4_program ( QT_RCC_EXECUTABLE Qt4::rcc rcc )
_find_qt4_program ( QT_DBUSCPP2XML_EXECUTABLE Qt4::qdbuscpp2xml qdbuscpp2xml )
_find_qt4_program ( QT_DBUSXML2CPP_EXECUTABLE Qt4::qdbusxml2cpp qdbusxml2cpp )
_find_qt4_program ( QT_LUPDATE_EXECUTABLE Qt4::lupdate lupdate-qt4 lupdate4 lupdate )
_find_qt4_program ( QT_LRELEASE_EXECUTABLE Qt4::lrelease lrelease-qt4 lrelease4 lrelease )
_find_qt4_program ( QT_QCOLLECTIONGENERATOR_EXECUTABLE Qt4::qcollectiongenerator qcollectiongenerator-qt4 qcollectiongenerator )
_find_qt4_program ( QT_DESIGNER_EXECUTABLE Qt4::designer designer-qt4 designer4 designer )
_find_qt4_program ( QT_LINGUIST_EXECUTABLE Qt4::linguist linguist-qt4 linguist4 linguist )
if ( NOT TARGET Qt4::qmake )
add_executable ( Qt4::qmake IMPORTED )
set_property ( TARGET Qt4::qmake PROPERTY IMPORTED_LOCATION ${ QT_QMAKE_EXECUTABLE } )
endif ( )
if ( QT_MOC_EXECUTABLE )
set ( QT_WRAP_CPP "YES" )
endif ( )
if ( QT_UIC_EXECUTABLE )
set ( QT_WRAP_UI "YES" )
endif ( )
mark_as_advanced ( QT_UIC_EXECUTABLE QT_UIC3_EXECUTABLE QT_MOC_EXECUTABLE
Q T _ R C C _ E X E C U T A B L E Q T _ D B U S X M L 2 C P P _ E X E C U T A B L E Q T _ D B U S C P P 2 X M L _ E X E C U T A B L E
Q T _ L U P D A T E _ E X E C U T A B L E Q T _ L R E L E A S E _ E X E C U T A B L E Q T _ Q C O L L E C T I O N G E N E R A T O R _ E X E C U T A B L E
Q T _ D E S I G N E R _ E X E C U T A B L E Q T _ L I N G U I S T _ E X E C U T A B L E )
# get the directory of the current file, used later on in the file
get_filename_component ( _qt4_current_dir "${CMAKE_CURRENT_LIST_FILE}" PATH )
###############################################
#
# configuration/system dependent settings
#
###############################################
include ( "${_qt4_current_dir}/Qt4ConfigDependentSettings.cmake" )
#######################################
#
# Check the plugins of Qt
#
#######################################
set ( QT_PLUGIN_TYPES accessible bearer codecs decorations designer gfxdrivers graphicssystems iconengines imageformats inputmethods mousedrivers phonon_backend script sqldrivers )
set ( QT_ACCESSIBLE_PLUGINS qtaccessiblecompatwidgets qtaccessiblewidgets )
set ( QT_BEARER_PLUGINS qcorewlanbearer qgenericbearer qnativewifibearer )
set ( QT_CODECS_PLUGINS qcncodecs qjpcodecs qkrcodecs qtwcodecs )
set ( QT_DECORATIONS_PLUGINS qdecorationdefault qdecorationwindows )
set ( QT_DESIGNER_PLUGINS arthurplugin containerextension customwidgetplugin phononwidgets qdeclarativeview qt3supportwidgets qwebview taskmenuextension worldtimeclockplugin )
set ( QT_GRAPHICSDRIVERS_PLUGINS qgfxtransformed qgfxvnc qscreenvfb )
set ( QT_GRAPHICSSYSTEMS_PLUGINS qglgraphicssystem qtracegraphicssystem )
set ( QT_ICONENGINES_PLUGINS qsvgicon )
set ( QT_IMAGEFORMATS_PLUGINS qgif qjpeg qmng qico qsvg qtiff qtga )
set ( QT_INPUTMETHODS_PLUGINS qimsw_multi )
set ( QT_MOUSEDRIVERS_PLUGINS qwstslibmousehandler )
if ( APPLE )
set ( QT_PHONON_BACKEND_PLUGINS phonon_qt7 )
elseif ( WIN32 )
set ( QT_PHONON_BACKEND_PLUGINS phonon_ds9 )
endif ( )
set ( QT_SCRIPT_PLUGINS qtscriptdbus )
set ( QT_SQLDRIVERS_PLUGINS qsqldb2 qsqlibase qsqlite qsqlite2 qsqlmysql qsqloci qsqlodbc qsqlpsql qsqltds )
set ( QT_PHONON_PLUGINS ${ QT_PHONON_BACKEND_PLUGINS } )
set ( QT_QT3SUPPORT_PLUGINS qtaccessiblecompatwidgets )
set ( QT_QTCORE_PLUGINS ${ QT_BEARER_PLUGINS } ${ QT_CODECS_PLUGINS } )
set ( QT_QTGUI_PLUGINS qtaccessiblewidgets ${ QT_IMAGEFORMATS_PLUGINS } ${ QT_DECORATIONS_PLUGINS } ${ QT_GRAPHICSDRIVERS_PLUGINS } ${ QT_GRAPHICSSYSTEMS_PLUGINS } ${ QT_INPUTMETHODS_PLUGINS } ${ QT_MOUSEDRIVERS_PLUGINS } )
set ( QT_QTSCRIPT_PLUGINS ${ QT_SCRIPT_PLUGINS } )
set ( QT_QTSQL_PLUGINS ${ QT_SQLDRIVERS_PLUGINS } )
set ( QT_QTSVG_PLUGINS qsvg qsvgicon )
if ( QT_QMAKE_CHANGED )
foreach ( QT_PLUGIN_TYPE ${ QT_PLUGIN_TYPES } )
string ( TOUPPER ${ QT_PLUGIN_TYPE } _upper_qt_plugin_type )
set ( QT_ ${ _upper_qt_plugin_type } _PLUGINS_DIR ${ QT_PLUGINS_DIR } / ${ QT_PLUGIN_TYPE } )
foreach ( QT_PLUGIN ${ QT_${_upper_qt_plugin_type } _PLUGINS} )
string ( TOUPPER ${ QT_PLUGIN } _upper_qt_plugin )
unset ( QT_ ${ _upper_qt_plugin } _LIBRARY_RELEASE CACHE )
unset ( QT_ ${ _upper_qt_plugin } _LIBRARY_DEBUG CACHE )
unset ( QT_ ${ _upper_qt_plugin } _LIBRARY CACHE )
unset ( QT_ ${ _upper_qt_plugin } _PLUGIN_RELEASE CACHE )
unset ( QT_ ${ _upper_qt_plugin } _PLUGIN_DEBUG CACHE )
unset ( QT_ ${ _upper_qt_plugin } _PLUGIN CACHE )
endforeach ( )
endforeach ( )
endif ( )
# find_library works better than find_file but we need to set prefixes to only match plugins
foreach ( QT_PLUGIN_TYPE ${ QT_PLUGIN_TYPES } )
string ( TOUPPER ${ QT_PLUGIN_TYPE } _upper_qt_plugin_type )
set ( QT_ ${ _upper_qt_plugin_type } _PLUGINS_DIR ${ QT_PLUGINS_DIR } / ${ QT_PLUGIN_TYPE } )
foreach ( QT_PLUGIN ${ QT_${_upper_qt_plugin_type } _PLUGINS} )
string ( TOUPPER ${ QT_PLUGIN } _upper_qt_plugin )
if ( QT_IS_STATIC )
find_library ( QT_ ${ _upper_qt_plugin } _LIBRARY_RELEASE
N A M E S $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } 4
P A T H S $ { Q T _ $ { _ u p p e r _ q t _ p l u g i n _ t y p e } _ P L U G I N S _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
find_library ( QT_ ${ _upper_qt_plugin } _LIBRARY_DEBUG
N A M E S $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } _ d e b u g $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } d $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } d 4
P A T H S $ { Q T _ $ { _ u p p e r _ q t _ p l u g i n _ t y p e } _ P L U G I N S _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
_QT4_ADJUST_LIB_VARS ( ${ QT_PLUGIN } )
else ( )
# find_library works easier/better than find_file but we need to set suffixes to only match plugins
set ( CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT ${ CMAKE_FIND_LIBRARY_SUFFIXES } )
set ( CMAKE_FIND_LIBRARY_SUFFIXES ${ CMAKE_SHARED_MODULE_SUFFIX } ${ CMAKE_SHARED_LIBRARY_SUFFIX } )
find_library ( QT_ ${ _upper_qt_plugin } _PLUGIN_RELEASE
N A M E S $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } 4
P A T H S $ { Q T _ $ { _ u p p e r _ q t _ p l u g i n _ t y p e } _ P L U G I N S _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
find_library ( QT_ ${ _upper_qt_plugin } _PLUGIN_DEBUG
N A M E S $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } _ d e b u g $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } d $ { Q T _ P L U G I N } $ { Q T _ L I B I N F I X } d 4
P A T H S $ { Q T _ $ { _ u p p e r _ q t _ p l u g i n _ t y p e } _ P L U G I N S _ D I R } N O _ D E F A U L T _ P A T H N O _ C M A K E _ F I N D _ R O O T _ P A T H
)
mark_as_advanced ( QT_ ${ _upper_qt_plugin } _PLUGIN_RELEASE QT_ ${ _upper_qt_plugin } _PLUGIN_DEBUG )
set ( CMAKE_FIND_LIBRARY_SUFFIXES ${ CMAKE_FIND_LIBRARY_SUFFIXES_DEFAULT } )
endif ( )
endforeach ( )
endforeach ( )
######################################
#
# Macros for building Qt files
#
######################################
include ( "${_qt4_current_dir}/Qt4Macros.cmake" )
endif ( )
#support old QT_MIN_VERSION if set, but not if version is supplied by find_package()
if ( NOT Qt4_FIND_VERSION AND QT_MIN_VERSION )
set ( Qt4_FIND_VERSION ${ QT_MIN_VERSION } )
endif ( )
if ( Qt4_FIND_COMPONENTS )
# if components specified in find_package(), make sure each of those pieces were found
set ( _QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_INCLUDE_DIR QT_LIBRARY_DIR )
foreach ( component ${ Qt4_FIND_COMPONENTS } )
string ( TOUPPER ${ component } _COMPONENT )
if ( ${ _COMPONENT } STREQUAL "QTMAIN" )
if ( Q_WS_WIN )
set ( _QT4_FOUND_REQUIRED_VARS ${ _QT4_FOUND_REQUIRED_VARS } QT_ ${ _COMPONENT } _LIBRARY )
endif ( )
else ( )
set ( _QT4_FOUND_REQUIRED_VARS ${ _QT4_FOUND_REQUIRED_VARS } QT_ ${ _COMPONENT } _INCLUDE_DIR QT_ ${ _COMPONENT } _LIBRARY )
endif ( )
endforeach ( )
if ( Qt4_FIND_COMPONENTS MATCHES QtGui )
set ( _QT4_FOUND_REQUIRED_VARS ${ _QT4_FOUND_REQUIRED_VARS } QT_UIC_EXECUTABLE )
endif ( )
else ( )
# if no components specified, we'll make a default set of required variables to say Qt is found
set ( _QT4_FOUND_REQUIRED_VARS QT_QMAKE_EXECUTABLE QT_MOC_EXECUTABLE QT_RCC_EXECUTABLE QT_UIC_EXECUTABLE QT_INCLUDE_DIR
Q T _ L I B R A R Y _ D I R Q T _ Q T C O R E _ L I B R A R Y )
endif ( )
if ( NOT QT_VERSION_MAJOR EQUAL 4 )
set ( VERSION_MSG "Found unsuitable Qt version \" ${ QTVERSION } \" from ${ QT_QMAKE_EXECUTABLE } " )
set ( Qt4_FOUND FALSE )
if ( Qt4_FIND_REQUIRED )
message ( FATAL_ERROR "${VERSION_MSG}, this code requires Qt 4.x" )
else ( )
if ( NOT Qt4_FIND_QUIETLY )
message ( STATUS "${VERSION_MSG}" )
endif ( )
endif ( )
else ( )
FIND_PACKAGE_HANDLE_STANDARD_ARGS ( Qt4 FOUND_VAR Qt4_FOUND
R E Q U I R E D _ V A R S $ { _ Q T 4 _ F O U N D _ R E Q U I R E D _ V A R S }
V E R S I O N _ V A R Q T V E R S I O N
)
endif ( )
#######################################
#
# compatibility settings
#
#######################################
# Backwards compatibility for CMake1.4 and 1.2
set ( QT_MOC_EXE ${ QT_MOC_EXECUTABLE } )
set ( QT_UIC_EXE ${ QT_UIC_EXECUTABLE } )
set ( QT_QT_LIBRARY "" )
set ( QT4_FOUND ${ Qt4_FOUND } )
set ( QT_FOUND ${ Qt4_FOUND } )