@ -12,7 +12,7 @@
# A D D _ N A T I V E _ P R E C O M P I L E D _ H E A D E R _ t a r g e t N a m e _ i n p u t _ d o w a r n
# G E T _ N A T I V E _ P R E C O M P I L E D _ H E A D E R _ t a r g e t N a m e _ i n p u t
IF ( CMAKE_COMPILER_IS_GNUCXX )
IF ( CV_GCC )
IF ( NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "4.2.0" )
SET ( PCHSupport_FOUND TRUE )
@ -36,7 +36,7 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
STRING ( TOUPPER "CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE}" _flags_var_name )
SET ( ${ _out_compile_flags } ${ ${_flags_var_name } } )
IF ( CMAKE_COMPILER_IS_GNUCXX )
IF ( CV_GCC )
GET_TARGET_PROPERTY ( _targetType ${ _PCH_current_target } TYPE )
IF ( ${ _targetType } STREQUAL SHARED_LIBRARY AND NOT WIN32 )
@ -74,7 +74,7 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
ocv_is_opencv_directory ( __result ${ item } )
if ( __result )
LIST ( APPEND ${ _out_compile_flags } "${_PCH_include_prefix}\" ${ item } \"")
elseif ( CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
elseif ( CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
i t e m M A T C H E S " / u s r / i n c l u d e $ " )
# w o r k a r o u n d f o r G C C 6 . x b u g
else ( )
@ -87,7 +87,7 @@ MACRO(_PCH_GET_COMPILE_FLAGS _out_compile_flags)
ocv_is_opencv_directory ( __result ${ item } )
if ( __result )
LIST ( APPEND ${ _out_compile_flags } "${_PCH_include_prefix}\" ${ item } \"")
elseif ( CMAKE_COMPILER_IS_GNUCXX AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
elseif ( CV_GCC AND NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "6.0" AND
i t e m M A T C H E S " / u s r / i n c l u d e $ " )
# w o r k a r o u n d f o r G C C 6 . x b u g
else ( )
@ -128,7 +128,7 @@ MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _output)
FILE ( TO_NATIVE_PATH ${ _input } _native_input )
FILE ( TO_NATIVE_PATH ${ _output } _native_output )
IF ( CMAKE_COMPILER_IS_GNUCXX )
if ( CV_GCC )
IF ( CMAKE_CXX_COMPILER_ARG1 )
# r e m o v e l e a d i n g s p a c e i n c o m p i l e r a r g u m e n t
STRING ( REGEX REPLACE "^ +" "" pchsupport_compiler_cxx_arg1 ${ CMAKE_CXX_COMPILER_ARG1 } )
@ -141,7 +141,7 @@ MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _output)
$ { C M A K E _ C X X _ C O M P I L E R } $ { _ c o m p i l e _ F L A G S } - x c + + - h e a d e r - o $ { _ o u t p u t } $ { _ i n p u t }
)
ENDIF ( CMAKE_CXX_COMPILER_ARG1 )
ELSE ( CMAKE_COMPILER_IS_GNUCXX )
ELSE ( )
SET ( _dummy_str "#include <${_input}>" )
FILE ( WRITE ${ CMAKE_CURRENT_BINARY_DIR } /pch_dummy.cpp ${ _dummy_str } )
@ -151,7 +151,7 @@ MACRO(_PCH_GET_COMPILE_COMMAND out_command _input _output)
)
# / o u t : $ { _ o u t p u t }
ENDIF ( CMAKE_COMPILER_IS_GNUCXX )
ENDIF ( )
ENDMACRO ( _PCH_GET_COMPILE_COMMAND )
@ -160,7 +160,7 @@ MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn )
FILE ( TO_NATIVE_PATH ${ _pch_path } _native_pch_path )
IF ( CMAKE_COMPILER_IS_GNUCXX )
IF ( CV_GCC )
# f o r u s e w i t h d i s t c c a n d g c c > 4 . 0 . 1 i f p r e p r o c e s s e d f i l e s a r e a c c e s s i b l e
# o n a l l r e m o t e m a c h i n e s s e t
# P C H _ A D D I T I O N A L _ C O M P I L E R _ F L A G S t o - f p c h - p r e p r o c e s s
@ -173,11 +173,11 @@ MACRO(_PCH_GET_TARGET_COMPILE_FLAGS _cflags _header_name _pch_path _dowarn )
SET ( ${ _cflags } "${PCH_ADDITIONAL_COMPILER_FLAGS} " )
ENDIF ( _dowarn )
ELSE ( CMAKE_COMPILER_IS_GNUCXX )
ELSE ( )
set ( ${ _cflags } "/Fp${_native_pch_path} /Yu${_header_name}" )
ENDIF ( CMAKE_COMPILER_IS_GNUCXX )
ENDIF ( )
ENDMACRO ( _PCH_GET_TARGET_COMPILE_FLAGS )
@ -205,7 +205,7 @@ MACRO(ADD_PRECOMPILED_HEADER_TO_TARGET _targetName _input _pch_output_to_use )
_PCH_GET_TARGET_COMPILE_FLAGS ( _target_cflags ${ _name } ${ _pch_output_to_use } ${ _dowarn } )
# MESSAGE ( "Add flags ${_target_cflags} to ${_targetName} " )
if ( CMAKE_COMPILER_IS_GNUCXX )
if ( CV_GCC )
set ( _target_cflags "${_target_cflags} -include \" ${ CMAKE_CURRENT_BINARY_DIR } / ${ _name } \"")
endif ( )
@ -403,7 +403,7 @@ macro(ocv_add_precompiled_header_to_target the_target pch_header)
if ( PCHSupport_FOUND AND ENABLE_PRECOMPILED_HEADERS AND EXISTS "${pch_header}" )
if ( CMAKE_GENERATOR MATCHES "^Visual" OR CMAKE_GENERATOR MATCHES Xcode )
add_native_precompiled_header ( ${ the_target } ${ pch_header } )
elseif ( CMAKE_COMPILER_IS_GNUCXX AND CMAKE_GENERATOR MATCHES "Makefiles|Ninja" )
elseif ( CV_GCC AND CMAKE_GENERATOR MATCHES "Makefiles|Ninja" )
add_precompiled_header ( ${ the_target } ${ pch_header } )
endif ( )
endif ( )