@ -36,7 +36,8 @@ endif()
if ( POLICY CMP0071 )
cmake_policy ( SET CMP0071 NEW )
endif ( )
# S u p e r p r o j e c t s c a n u s e j u s t set ( WITH_BLAH ON ) w i t h o u t F O R C E C A C H E o n 3 . 1 3 +
# S u p e r p r o j e c t s c a n u s e j u s t set ( MAGNUM_WITH_BLAH ON ) w i t h o u t F O R C E C A C H E o n
# 3 . 1 3 +
if ( POLICY CMP0077 )
cmake_policy ( SET CMP0077 NEW )
endif ( )
@ -49,11 +50,79 @@ find_package(Magnum REQUIRED)
include ( CMakeDependentOption )
# O p t i o n s t h a t u s e d t o b e u n p r e f i x e d . N e w o p t i o n s s h o u l d n ' t b e a d d e d t o t h i s
# l i s t .
set ( _MAGNUMBINDINGS_DEPRECATED_UNPREFIXED_OPTIONS
W I T H _ P Y T H O N
B U I L D _ T E S T S )
# I f d u r i n g t h e f i r s t run ( i.e., when the variable isn't in cache yet ) , c h e c k
# i f a n y o f t h e p r e f i x e d o p t i o n s a r e a l r e a d y s e t . I f s o , w e a s s u m e t h e u s e r i s
# a l r e a d y s w i t c h e d t o t h e p r e f i x e d o p t i o n s a n d w o n ' t a c c e p t t h e d e p r e c a t e d
# u n p r e f i x e d o p t i o n s f o r b a c k w a r d s c o m p a t i b i l i t y . T h i s w a y i t ' s p o s s i b l e f o r
# p r o j e c t s t o r e u s e t h e s e v a r i a b l e s f o r o t h e r p u r p o s e s w i t h o u t a f f e c t i n g
# C o r r a d e i n a n y w a y .
if ( NOT DEFINED _MAGNUMBINDINGS_ACCEPT_DEPRECATED_UNPREFIXED_OPTIONS )
set ( _MAGNUMBINDINGS_ACCEPT_DEPRECATED_UNPREFIXED_OPTIONS ON CACHE INTERNAL "" )
foreach ( option ${ _MAGNUMBINDINGS_DEPRECATED_UNPREFIXED_OPTIONS } )
if ( DEFINED MAGNUM_ ${ option } )
set ( _MAGNUMBINDINGS_ACCEPT_DEPRECATED_UNPREFIXED_OPTIONS OFF CACHE INTERNAL "" )
break ( )
endif ( )
endforeach ( )
endif ( )
# L i b r a r i e s t o b u i l d
option ( WITH_PYTHON "Build Python bindings" OFF )
option ( BUILD_TESTS "Build unit tests" OFF )
option ( MAGNUM_WITH_PYTHON "Build Python bindings" OFF )
option ( MAGNUM_BUILD_TESTS "Build unit tests" OFF )
# B a c k w a r d s c o m p a t i b i l i t y f o r u n p r e f i x e d C M a k e o p t i o n s . I f t h e u s e r i s n ' t
# e x p l i c i t l y u s i n g p r e f i x e d o p t i o n s i n t h e f i r s t r u n a l r e a d y , a c c e p t t h e
# u n p r e f i x e d o p t i o n s , a n d r e m e m b e r t h i s d e c i s i o n f o r s u b s e q u e n t r u n s
if ( NOT DEFINED _MAGNUMBINDINGS_ACCEPT_DEPRECATED_UNPREFIXED_OPTIONS )
set ( _MAGNUMBINDINGS_ACCEPT_DEPRECATED_UNPREFIXED_OPTIONS ON CACHE INTERNAL "" )
endif ( )
# I f t h e u s e r w a s n ' t e x p l i c i t l y u s i n g p r e f i x e d o p t i o n s i n t h e f i r s t r u n a n d t h e
# M A G N U M _ B U I L D _ D E P R E C A T E D o p t i o n i s n o t c u r r e n t l y disabled ( which can get
# c h a n g e d s u b s e q u e n t l y ) , a c c e p t t h e u n p r e f i x e d o p t i o n s a n d p r i n t a w a r n i n g i f
# t h e y ' r e d i f f e r e n t f r o m t h e p r e f i x e d o n e s .
if ( _MAGNUMBINDINGS_ACCEPT_DEPRECATED_UNPREFIXED_OPTIONS AND MAGNUM_BUILD_DEPRECATED )
set ( _MAGNUMBINDINGS_WARN_DEPRECATED_UNPREFIXED_OPTION )
foreach ( option ${ _MAGNUMBINDINGS_DEPRECATED_UNPREFIXED_OPTIONS } )
if ( DEFINED ${ option } )
# C M a k e h a s n o c o m p a r i s o n o f b o o l e a n values ( EQUAL returns false if
# c o m p a r i n g O N a n d 1 o r O F F a n d F A L S E , S T R E Q U A L a l s o ) , s o w e h a v e
# t o d o i t t h i s w a y . A l s o w a r n o n l y o n t h e f i r s t e n c o u n t e r e d
# v a r i a b l e s o p e o p l e c a n f i x i t , r e c o n f i g u r e a n d g o t o t h e n e x t o n e
# t h a t w a r n s .
if ( ( ${ option } AND NOT MAGNUM_ ${ option } ) OR
( N O T $ { o p t i o n } A N D M A G N U M _ $ { o p t i o n } ) A N D N O T _ M A G N U M B I N D I N G S _ W A R N _ D E P R E C A T E D _ U N P R E F I X E D _ O P T I O N )
set ( _MAGNUMBINDINGS_WARN_DEPRECATED_UNPREFIXED_OPTION ${ option } )
endif ( )
set ( MAGNUM_ ${ option } ${ ${option } } )
# I f v a r i a b l e s s p e c i f i e d o n t h e c o m m a n d l i n e d o n ' t m a t c h a n y
# o p t i o n s , t h e y ' r e k e p t i n c a c h e b u t s e t a s U N I N I T I A L I Z E D , m e a n i n g
# t h e y d o n ' t a p p e a r i n c m a k e - g u i o r c c m a k e , s o t h e r e ' s n o w a y t o
# f i x t h e w a r n i n g a p a r t f r o m h a n d - e n d i t i n g t h e C M a k e C a c h e . t x t o r
# r e c r e a t i n g t h e b u i l d d i r . U p d a t e t h e i r c a c h e d t y p e t o b e B O O L t o
# m a k e t h e m a p p e a r .
set ( ${ option } ${ ${option } } CACHE BOOL "Deprecated, use MAGNUM_${option} instead" FORCE )
endif ( )
endforeach ( )
if ( _MAGNUMBINDINGS_WARN_DEPRECATED_UNPREFIXED_OPTION )
# C M a k e 3 . 5 + h a s d e p r e c a t i o n w a r n i n g s e n a b l e d b y default ( which makes
# s e n s e ) , 3 . 4 n o t . U s e a w a r n i n g t h e r e i n s t e a d .
# T O D O : d r o p w h e n 3 . 4 i s n o t s u p p o r t e d a n y m o r e
if ( CMAKE_VERSION VERSION_LESS 3.5 )
set ( DEPRECATION_OR_WARNING WARNING )
else ( )
set ( DEPRECATION_OR_WARNING DEPRECATION )
endif ( )
message ( ${ DEPRECATION_OR_WARNING } "Unprefixed options such as ${_MAGNUMBINDINGS_WARN_DEPRECATED_UNPREFIXED_OPTION} are deprecated, use MAGNUM_${_MAGNUMBINDINGS_WARN_DEPRECATED_UNPREFIXED_OPTION} instead. Delete the unprefixed variable from CMake cache or set both to the same value to silence this warning." )
endif ( )
endif ( )
if ( BUILD_TESTS )
if ( MAGNUM_ BUILD_TESTS)
find_package ( Corrade REQUIRED TestSuite )
if ( CORRADE_TARGET_IOS )
set ( CORRADE_TESTSUITE_BUNDLE_IDENTIFIER_PREFIX "cz.mosra.magnum-bindings" )