@ -1,3 +1,33 @@
if ( ENABLE_CCACHE AND NOT CMAKE_COMPILER_IS_CCACHE )
# T h i s w o r k s f i n e w i t h U n i x M a k e f i l e s a n d N i n j a g e n e r a t o r s
find_host_program ( CCACHE_PROGRAM ccache )
if ( CCACHE_PROGRAM )
message ( STATUS "Looking for ccache - found (${CCACHE_PROGRAM})" )
get_property ( __OLD_RULE_LAUNCH_COMPILE GLOBAL PROPERTY RULE_LAUNCH_COMPILE )
if ( __OLD_RULE_LAUNCH_COMPILE )
message ( STATUS "Can't replace CMake compiler launcher" )
else ( )
set_property ( GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}" )
# N O T E : A c t u a l l y t h i s c h e c k d o e s n ' t w o r k a s e x p e c t e d .
# " R U L E _ L A U N C H _ C O M P I L E " i s i g n o r e d b y C M a k e d u r i n g try_compile ( ) s t e p .
# ocv_check_compiler_flag ( CXX "" IS_CCACHE_WORKS )
set ( IS_CCACHE_WORKS 1 )
if ( IS_CCACHE_WORKS )
set ( CMAKE_COMPILER_IS_CCACHE 1 )
else ( )
message ( STATUS "Unable to compile program with enabled ccache, reverting..." )
set_property ( GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${__OLD_RULE_LAUNCH_COMPILE}" )
endif ( )
else ( )
message ( STATUS "Looking for ccache - not found" )
endif ( )
endif ( )
endif ( )
if ( ( CMAKE_COMPILER_IS_CLANGCXX OR CMAKE_COMPILER_IS_CLANGCC OR CMAKE_COMPILER_IS_CCACHE ) AND NOT CMAKE_GENERATOR MATCHES "Xcode" )
set ( ENABLE_PRECOMPILED_HEADERS OFF CACHE BOOL "" FORCE )
endif ( )
if ( MINGW OR ( X86 AND UNIX AND NOT APPLE ) )
# m i n g w c o m p i l e r i s k n o w n t o p r o d u c e u n s t a b l e S S E c o d e w i t h - O 3 h e n c e w e a r e t r y i n g t o u s e - O 2 i n s t e a d
if ( CMAKE_COMPILER_IS_GNUCXX )
@ -111,6 +141,10 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option ( -pthread )
endif ( )
if ( CMAKE_COMPILER_IS_CLANGCXX )
add_extra_compiler_option ( -Qunused-arguments )
endif ( )
if ( OPENCV_WARNINGS_ARE_ERRORS )
add_extra_compiler_option ( -Werror )
endif ( )