@ -126,6 +126,50 @@ if(NOT CMAKE_VERSION VERSION_LESS "2.8.11")
endforeach ( )
endif ( )
if ( NOT DEFINED OPENCV_MAP_IMPORTED_CONFIG )
if ( CMAKE_GENERATOR MATCHES "Visual Studio" OR MSVC )
# O p e n C V s u p p o r t s D e b u g a n d R e l e a s e b u i l d s o n l y .
# B u t M S V S h a s ' R e l W i t h D e b I n f o ' ' M i n S i z e R e l ' c o n f i g u r a t i o n s f o r a p p l i c a t i o n s .
# B y d e f a u l t C M a k e m a p s t h e s e c o n f i g u r a t i o n o n t h e f i r s t available ( Debug ) w h i c h i s w r o n g .
# N o n - D e b u g b u i l d o f A p p l i c a t i o n c a n ' t b e u s e d w i t h O p e n C V D e b u g build ( ABI mismatch problem )
# A d d m a p p i n g o f R e l W i t h D e b I n f o a n d M i n S i z e R e l t o R e l e a s e h e r e
set ( OPENCV_MAP_IMPORTED_CONFIG "RELWITHDEBINFO=!Release;MINSIZEREL=!Release" )
endif ( )
endif ( )
set ( __remap_warnings "" )
macro ( ocv_map_imported_config target )
if ( DEFINED OPENCV_MAP_IMPORTED_CONFIG ) # l i s t , " R E L W I T H D E B I N F O = R e l e a s e ; M I N S I Z E R E L = R e l e a s e "
get_target_property ( __available_configurations ${ target } IMPORTED_CONFIGURATIONS )
foreach ( remap ${ OPENCV_MAP_IMPORTED_CONFIG } )
if ( remap MATCHES "^(.+)=(!?)([^!]+)$" )
set ( __remap_config "${CMAKE_MATCH_1}" )
set ( __final_config "${CMAKE_MATCH_3}" )
set ( __force_flag "${CMAKE_MATCH_2}" )
string ( TOUPPER "${__final_config}" __final_config_upper )
string ( TOUPPER "${__remap_config}" __remap_config_upper )
if ( ";${__available_configurations};" MATCHES ";${__remap_config_upper};" AND NOT "${__force_flag}" STREQUAL "!" )
# c o n f i g u r a t i o n a l r e a d y e x i s t s , s k i p r e m a p
set ( __remap_warnings "${__remap_warnings}... Configuration already exists ${__remap_config} (skip mapping ${__remap_config} => ${__final_config}) (available configurations: ${__available_configurations})\n" )
continue ( )
endif ( )
if ( __available_configurations AND NOT ";${__available_configurations};" MATCHES ";${__final_config_upper};" )
# s k i p , c o n f i g u r a t i o n i s n o t a v a i l a b l e
if ( NOT "${__force_flag}" STREQUAL "!" )
set ( __remap_warnings "${__remap_warnings}... Configuration is not available '${__final_config}' for ${target}, build may fail (available configurations: ${__available_configurations})\n" )
endif ( )
endif ( )
set_target_properties ( ${ target } PROPERTIES
M A P _ I M P O R T E D _ C O N F I G _ $ { _ _ r e m a p _ c o n f i g } " $ { _ _ f i n a l _ c o n f i g } "
)
else ( )
message ( WARNING "Invalid entry of OPENCV_MAP_IMPORTED_CONFIG: '${remap}' (${OPENCV_MAP_IMPORTED_CONFIG})" )
endif ( )
endforeach ( )
endif ( )
endmacro ( )
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# F o r m l i s t o f modules ( components ) t o f i n d
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
@ -199,16 +243,15 @@ foreach(__cvcomponent ${OpenCV_FIND_COMPONENTS})
)
endif ( )
endif ( )
# O p e n C V s u p p o r t s D e b u g a n d R e l e a s e o n l y .
# R e l W i t h D e b I n f o a n d M i n S i z e R e l a r e m a p p e d t o R e l e a s e
if ( TARGET ${ __cvcomponent } )
set_target_properties ( ${ __cvcomponent } PROPERTIES
M A P _ I M P O R T E D _ C O N F I G _ M I N S I Z E R E L " R e l e a s e "
M A P _ I M P O R T E D _ C O N F I G _ R E L W I T H D E B I N F O " R e l e a s e "
)
ocv_map_imported_config ( ${ __cvcomponent } )
endif ( )
endforeach ( )
if ( __remap_warnings AND NOT OpenCV_FIND_QUIETLY )
message ( "OpenCV: configurations remap warnings:\n${__remap_warnings}OpenCV: Check variable OPENCV_MAP_IMPORTED_CONFIG=${OPENCV_MAP_IMPORTED_CONFIG}" )
endif ( )
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
# C o m p a t i b i l i t y s t u f f
# = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =