@ -41,87 +41,71 @@
# D E A L I N G S I N T H E S O F T W A R E .
#
# G l f w i n s t a l l s c m a k e p a c k a g e c o n f i g f i l e s t o s h a r e d / f o l d e r w h i c h h a n d l e s d e p e n d e n c i e s
# i n c a s e g l f w i s b u i l t s t a t i c a l l y .
find_package ( glfw3 CONFIG )
# G L F W i n s t a l l s c m a k e p a c k a g e c o n f i g f i l e s t o s h a r e d / f o l d e r w h i c h h a n d l e s
# d e p e n d e n c i e s i n c a s e G L F W i s b u i l t s t a t i c a l l y . W e ' r e m a k i n g a n I N T E R F A C E
# t a r g e t f o r i t , w h i c h i s s u p p o r t e d o n l y s i n c e C M a k e 3 . 0 .
if ( NOT CMAKE_VERSION VERSION_LESS 3.0.0 )
find_package ( glfw3 CONFIG )
endif ( )
if ( TARGET glfw )
if ( NOT TARGET GLFW::GLFW )
# T h e g l f w c m a k e c o n f i g d e f i n e s t h e i m p o r t e d t a r g e t " g l f w " w e a l i a s i t t o u n i f y
# i m p o r t e d t a r g e t n a m e s .
# T O D O : C a n n o t c r e a t e a l i a s o f i m p o r t e d t a r g e t
add_library ( GLFW::GLFW UNKNOWN IMPORTED )
get_target_property ( _GLFW_IMPORTED_CONFIGURATIONS glfw IMPORTED_CONFIGURATIONS )
get_target_property ( _GLFW_IMPORTED_LOCATION_RELEASE glfw IMPORTED_LOCATION_RELEASE )
get_target_property ( _GLFW_IMPORTED_LOCATION_DEBUG glfw IMPORTED_LOCATION_DEBUG )
get_target_property ( _GLFW_INTERFACE_INCLUDE_DIRECTORIES glfw INTERFACE_INCLUDE_DIRECTORIES )
get_target_property ( _GLFW_INTERFACE_LINK_LIBRARIES glfw INTERFACE_LINK_LIBRARIES )
if ( NOT _GLFW_INTERFACE_LINK_LIBRARIES )
# T h i s i s f i n e o n s y s t e m s w h e r e t h e r e a r e n o a d d i t i o n a l l i b r a r i e s a p a r t f r o m g l f w i t s e l f
# b u t p r e v e n t t r y i n g t o l i n k _ G L F W _ I N T E R F A C E _ L I N K _ L I B R A R I E S - N O T F O U N D . l i b o n W i n d o w s .
set ( _GLFW_INTERFACE_LINK_LIBRARIES "" )
endif ( )
set_target_properties ( GLFW::GLFW PROPERTIES
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 " $ { _ G L F W _ 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 } / G L F W "
I N T E R F A C E _ L I N K _ L I B R A R I E S " $ { _ G L F W _ I N T E R F A C E _ L I N K _ L I B R A R I E S } "
I M P O R T E D _ C O N F I G U R A T I O N S " $ { _ G L F W _ I M P O R T E D _ C O N F I G U R A T I O N S } " )
if ( _GLFW_IMPORTED_LOCATION_RELEASE )
set_target_properties ( GLFW::GLFW PROPERTIES
I M P O R T E D _ L O C A T I O N _ R E L E A S E $ { _ G L F W _ I M P O R T E D _ L O C A T I O N _ R E L E A S E } )
endif ( )
if ( _GLFW_IMPORTED_LOCATION_DEBUG )
set_target_properties ( GLFW::GLFW PROPERTIES
I M P O R T E D _ L O C A T I O N _ D E B U G $ { _ G L F W _ I M P O R T E D _ L O C A T I O N _ D E B U G } )
endif ( )
# A l i a s e s of ( global ) t a r g e t s a r e o n l y s u p p o r t e d i n C M a k e 3 . 1 1 , s o w e
# w o r k a r o u n d i t b y t h i s . T h i s i s e a s i e r t h a n f e t c h i n g a l l p o s s i b l e
# properties ( which are impossible to track of ) a n d t h e n a t t e m p t i n g t o
# r e b u i l d t h e m i n t o a n e w t a r g e t .
add_library ( GLFW::GLFW INTERFACE IMPORTED )
set_target_properties ( GLFW::GLFW PROPERTIES INTERFACE_LINK_LIBRARIES glfw )
endif ( )
# J u s t t o m a k e F P H S A p r i n t s o m e m e a n i n g f u l l o c a t i o n , n o t h i n g e l s e
get_target_property ( _GLFW_INTERFACE_INCLUDE_DIRECTORIES glfw INTERFACE_INCLUDE_DIRECTORIES )
find_package_handle_standard_args ( "GLFW" DEFAULT_MSG
_ G L F W _ 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 )
else ( )
# I n c a s e n o c o n f i g f i l e w a s f o u n d , t r y m a n u a l l y f i n d i n g t h e l i b r a r y .
find_library ( GLFW_LIBRARY NAMES glfw glfw3 )
return ( )
endif ( )
# I n c l u d e d i r
find_path ( GLFW_INCLUDE_DIR
N A M E S G L F W / g l f w 3 . h )
# I n c a s e n o c o n f i g f i l e w a s f o u n d , t r y m a n u a l l y f i n d i n g t h e l i b r a r y .
find_library ( GLFW_LIBRARY NAMES glfw glfw3 )
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args ( "GLFW" DEFAULT_MSG
G L F W _ L I B R A R Y
G L F W _ I N C L U D E _ D I R )
# I n c l u d e d i r
find_path ( GLFW_INCLUDE_DIR
N A M E S G L F W / g l f w 3 . h )
if ( NOT TARGET GLFW::GLFW )
# C M a k e 3 . 0 d o e s n ' t p r o p a g a t e t h e l o c a l t a r g e t a s d e p e n d e n c y u p w a r d s
# t h e t r e e a n d t h e n c o m p l a i n s t h a t G L F W : : G L F W t a r g e t w a s n o t f o u n d ,
# w h i c h i t s h o u l d n ' t . T h i s i s r e p r o d u c i b l e w i t h t h e b a s e b o o t s t r a p
# p r o j e c t * a n d * w h e n u s i n g M a g n u m a s C M a k e s u b p r o j e c t . W o r k s w i t h b o t h
# 2 . 8 . 1 2 a n d 3 . 1 , s o I ' m a s s u m i n g t h i s i s a C M a k e 3 . 0 b u g . T h e
# w o r k a r o u n d i s t o m a k e t h e t a r g e t G L O B A L s o i t ' s p r o p a g a t e d u p w a r d s
# t h e t r e e u n c o n d i t i o n a l l y . F o r s o m e r e a s o n , U N K N O W N t a r g e t s c a n ' t b e
# m a r k e d a s G L O B A L , s o I ' m b i t i n g t h e b u l l e t a n d s a y i n g t h e l i b r a r y i s
# s h a r e d - - C M a k e 3 . 0 i s o n l y o n D e b i a n J e s s i e n o w a n d I ' m a s s u m i n g G L F W
# c o m e s f r o m s y s t e m p a c k a g e , w h i c h * s h o u l d b e * s h a r e d . H o p e f u l l y t h i s w o n ' t
# b i t e b a c k i n t h e f u t u r e .
if ( CMAKE_VERSION VERSION_GREATER "2.8.12.2" AND CMAKE_VERSION VERSION_LESS "3.1.0" )
set ( _GLFW_IMPORTED_LIBRARY_KIND SHARED IMPORTED GLOBAL )
else ( )
set ( _GLFW_IMPORTED_LIBRARY_KIND UNKNOWN IMPORTED )
endif ( )
add_library ( GLFW::GLFW ${ _GLFW_IMPORTED_LIBRARY_KIND } )
include ( FindPackageHandleStandardArgs )
find_package_handle_standard_args ( "GLFW" DEFAULT_MSG
G L F W _ L I B R A R Y
G L F W _ I N C L U D E _ D I R )
# W o r k a r o u n d B U G G Y f r a m e w o r k s u p p o r t o n O S X
# h t t p s : / / c m a k e . o r g / B u g / v i e w . p h p ? i d = 1 4 1 0 5
if ( CORRADE_TARGET_APPLE AND ${ GLFW_LIBRARY } MATCHES "\\.framework$" )
set_property ( TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${ GLFW_LIBRARY } /GLFW )
else ( )
set_property ( TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${ GLFW_LIBRARY } )
endif ( )
if ( NOT TARGET GLFW::GLFW )
# C M a k e 3 . 0 d o e s n ' t p r o p a g a t e t h e l o c a l t a r g e t a s d e p e n d e n c y u p w a r d s
# t h e t r e e a n d t h e n c o m p l a i n s t h a t G L F W : : G L F W t a r g e t w a s n o t f o u n d ,
# w h i c h i t s h o u l d n ' t . T h i s i s r e p r o d u c i b l e w i t h t h e b a s e b o o t s t r a p
# p r o j e c t * a n d * w h e n u s i n g M a g n u m a s C M a k e s u b p r o j e c t . W o r k s w i t h b o t h
# 2 . 8 . 1 2 a n d 3 . 1 , s o I ' m a s s u m i n g t h i s i s a C M a k e 3 . 0 b u g . T h e
# w o r k a r o u n d i s t o m a k e t h e t a r g e t G L O B A L s o i t ' s p r o p a g a t e d u p w a r d s
# t h e t r e e u n c o n d i t i o n a l l y . F o r s o m e r e a s o n , U N K N O W N t a r g e t s c a n ' t b e
# m a r k e d a s G L O B A L , s o I ' m b i t i n g t h e b u l l e t a n d s a y i n g t h e l i b r a r y i s
# s h a r e d - - C M a k e 3 . 0 i s o n l y o n D e b i a n J e s s i e n o w a n d I ' m a s s u m i n g G L F W
# c o m e s f r o m s y s t e m p a c k a g e , w h i c h * s h o u l d b e * s h a r e d . H o p e f u l l y t h i s w o n ' t
# b i t e b a c k i n t h e f u t u r e .
if ( CMAKE_VERSION VERSION_GREATER "2.8.12.2" AND CMAKE_VERSION VERSION_LESS "3.1.0" )
set ( _GLFW_IMPORTED_LIBRARY_KIND SHARED IMPORTED GLOBAL )
else ( )
set ( _GLFW_IMPORTED_LIBRARY_KIND UNKNOWN IMPORTED )
endif ( )
add_library ( GLFW::GLFW ${ _GLFW_IMPORTED_LIBRARY_KIND } )
set_property ( TARGET GLFW::GLFW 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 $ { G L F W _ I N C L U D E _ D I R } )
# W o r k a r o u n d B U G G Y f r a m e w o r k s u p p o r t o n m a c O S
# h t t p s : / / c m a k e . o r g / B u g / v i e w . p h p ? i d = 1 4 1 0 5
if ( CORRADE_TARGET_APPLE AND ${ GLFW_LIBRARY } MATCHES "\\.framework$" )
set_property ( TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${ GLFW_LIBRARY } /GLFW )
else ( )
set_property ( TARGET GLFW::GLFW PROPERTY IMPORTED_LOCATION ${ GLFW_LIBRARY } )
endif ( )
mark_as_advanced ( GLFW_LIBRARY GLFW_INCLUDE_DIR )
set_property ( TARGET GLFW::GLFW 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 $ { G L F W _ I N C L U D E _ D I R } )
endif ( )
mark_as_advanced ( GLFW_LIBRARY GLFW_INCLUDE_DIR )