2 function(ocv_cmake_dump_vars)
3 cmake_parse_arguments(DUMP "" "TOFILE" "" ${ARGN})
4 set(regex "${DUMP_UNPARSED_ARGUMENTS}")
5 get_cmake_property(_variableNames VARIABLES)
7 foreach(_variableName ${_variableNames})
8 if(_variableName MATCHES "${regex}")
9 set(VARS "${VARS}${_variableName}=${${_variableName}}\n")
13 file(WRITE ${CMAKE_BINARY_DIR}/${DUMP_TOFILE} "${VARS}")
15 message(AUTHOR_WARNING "${VARS}")
20 # Search packages for host system instead of packages for target system
21 # in case of cross compilation thess macro should be defined by toolchain file
22 if(NOT COMMAND find_host_package)
23 macro(find_host_package)
27 if(NOT COMMAND find_host_program)
28 macro(find_host_program)
34 # Note: it doesn't support lists in arguments
36 # ocv_assert(MyLib_FOUND)
37 # ocv_assert(DEFINED MyLib_INCLUDE_DIRS)
40 string(REPLACE ";" " " __assert_msg "${ARGN}")
41 message(AUTHOR_WARNING "Assertion failed: ${__assert_msg}")
45 macro(ocv_debug_message)
46 # string(REPLACE ";" " " __msg "${ARGN}")
47 # message(STATUS "${__msg}")
50 macro(ocv_check_environment_variables)
52 if(NOT DEFINED ${_var} AND DEFINED ENV{${_var}})
53 set(__value "$ENV{${_var}}")
54 file(TO_CMAKE_PATH "${__value}" __value) # Assume that we receive paths
55 set(${_var} "${__value}")
56 message(STATUS "Update variable ${_var} from environment: ${${_var}}")
61 # rename modules target to world if needed
62 macro(_ocv_fix_target target_var)
63 if(BUILD_opencv_world)
64 if(OPENCV_MODULE_${${target_var}}_IS_PART_OF_WORLD)
65 set(${target_var} opencv_world)
70 # adds include directories in such way that directories from the OpenCV source tree go first
71 function(ocv_include_directories)
72 ocv_debug_message("ocv_include_directories( ${ARGN} )")
75 get_filename_component(__abs_dir "${dir}" ABSOLUTE)
76 if("${__abs_dir}" MATCHES "^${OpenCV_SOURCE_DIR}" OR "${__abs_dir}" MATCHES "^${OpenCV_BINARY_DIR}")
77 list(APPEND __add_before "${dir}")
79 include_directories(AFTER SYSTEM "${dir}")
82 include_directories(BEFORE ${__add_before})
85 # adds include directories in such way that directories from the OpenCV source tree go first
86 function(ocv_target_include_directories target)
87 _ocv_fix_target(target)
90 get_filename_component(__abs_dir "${dir}" ABSOLUTE)
91 if("${__abs_dir}" MATCHES "^${OpenCV_SOURCE_DIR}" OR "${__abs_dir}" MATCHES "^${OpenCV_BINARY_DIR}")
92 list(APPEND __params "${__abs_dir}")
94 list(APPEND __params "${dir}")
97 if(HAVE_CUDA OR CMAKE_VERSION VERSION_LESS 2.8.11)
98 include_directories(${__params})
101 target_include_directories(${target} PRIVATE ${__params})
103 set(__new_inc "${OCV_TARGET_INCLUDE_DIRS_${target}};${__params}")
104 set(OCV_TARGET_INCLUDE_DIRS_${target} "${__new_inc}" CACHE INTERNAL "")
109 # clears all passed variables
110 macro(ocv_clear_vars)
111 foreach(_var ${ARGN})
116 set(OCV_COMPILER_FAIL_REGEX
117 "command line option .* is valid for .* but not for C\\+\\+" # GNU
118 "command line option .* is valid for .* but not for C" # GNU
119 "unrecognized .*option" # GNU
120 "unknown .*option" # Clang
121 "ignoring unknown option" # MSVC
122 "warning D9002" # MSVC, any lang
123 "option .*not supported" # Intel
124 "[Uu]nknown option" # HP
125 "[Ww]arning: [Oo]ption" # SunPro
126 "command option .* is not recognized" # XL
127 "not supported in this configuration; ignored" # AIX
128 "File with unknown suffix passed to linker" # PGI
129 "WARNING: unknown flag:" # Open64
132 MACRO(ocv_check_compiler_flag LANG FLAG RESULT)
133 if(NOT DEFINED ${RESULT})
134 if("_${LANG}_" MATCHES "_CXX_")
135 set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.cxx")
136 if("${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
137 FILE(WRITE "${_fname}" "int main() { return 0; }\n")
139 FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
141 elseif("_${LANG}_" MATCHES "_C_")
142 set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.c")
143 if("${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_C_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
144 FILE(WRITE "${_fname}" "int main(void) { return 0; }\n")
146 FILE(WRITE "${_fname}" "#pragma\nint main(void) { return 0; }\n")
148 elseif("_${LANG}_" MATCHES "_OBJCXX_")
149 set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/src.mm")
150 if("${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror " OR "${CMAKE_CXX_FLAGS} ${FLAG} " MATCHES "-Werror=unknown-pragmas ")
151 FILE(WRITE "${_fname}" "int main() { return 0; }\n")
153 FILE(WRITE "${_fname}" "#pragma\nint main() { return 0; }\n")
159 MESSAGE(STATUS "Performing Test ${RESULT}")
160 TRY_COMPILE(${RESULT}
161 "${CMAKE_BINARY_DIR}"
163 COMPILE_DEFINITIONS "${FLAG}"
164 OUTPUT_VARIABLE OUTPUT)
166 FOREACH(_regex ${OCV_COMPILER_FAIL_REGEX})
167 IF("${OUTPUT}" MATCHES "${_regex}")
174 SET(${RESULT} 1 CACHE INTERNAL "Test ${RESULT}")
175 MESSAGE(STATUS "Performing Test ${RESULT} - Success")
177 MESSAGE(STATUS "Performing Test ${RESULT} - Failed")
178 SET(${RESULT} "" CACHE INTERNAL "Test ${RESULT}")
186 macro(ocv_check_flag_support lang flag varname)
187 if("_${lang}_" MATCHES "_CXX_")
189 elseif("_${lang}_" MATCHES "_C_")
191 elseif("_${lang}_" MATCHES "_OBJCXX_")
197 string(TOUPPER "${flag}" ${varname})
198 string(REGEX REPLACE "^(/|-)" "HAVE_${_lang}_" ${varname} "${${varname}}")
199 string(REGEX REPLACE " -|-|=| |\\." "_" ${varname} "${${varname}}")
201 ocv_check_compiler_flag("${_lang}" "${ARGN} ${flag}" ${${varname}})
205 macro(ocv_warnings_disable)
206 if(NOT ENABLE_NOISY_WARNINGS)
208 set(_msvc_warnings "")
209 set(_gxx_warnings "")
211 if(arg MATCHES "^CMAKE_")
212 list(APPEND _flag_vars ${arg})
213 elseif(arg MATCHES "^/wd")
214 list(APPEND _msvc_warnings ${arg})
215 elseif(arg MATCHES "^-W")
216 list(APPEND _gxx_warnings ${arg})
219 if(MSVC AND _msvc_warnings AND _flag_vars)
220 foreach(var ${_flag_vars})
221 foreach(warning ${_msvc_warnings})
222 set(${var} "${${var}} ${warning}")
225 elseif((CMAKE_COMPILER_IS_GNUCXX OR (UNIX AND CV_ICC)) AND _gxx_warnings AND _flag_vars)
226 foreach(var ${_flag_vars})
227 foreach(warning ${_gxx_warnings})
228 if(NOT warning MATCHES "^-Wno-")
229 string(REPLACE "${warning}" "" ${var} "${${var}}")
230 string(REPLACE "-W" "-Wno-" warning "${warning}")
232 ocv_check_flag_support(${var} "${warning}" _varname)
234 set(${var} "${${var}} ${warning}")
240 unset(_msvc_warnings)
242 endif(NOT ENABLE_NOISY_WARNINGS)
245 # Provides an option that the user can optionally select.
246 # Can accept condition to control when option is available for user.
248 # option(<option_variable> "help string describing the option" <initial value or boolean expression> [IF <condition>])
249 macro(OCV_OPTION variable description value)
250 set(__value ${value})
252 set(__varname "__value")
254 if(arg STREQUAL "IF" OR arg STREQUAL "if")
255 set(__varname "__condition")
257 list(APPEND ${__varname} ${arg})
261 if("${__condition}" STREQUAL "")
262 set(__condition 2 GREATER 1)
266 if("${__value}" MATCHES ";")
268 option(${variable} "${description}" ON)
270 option(${variable} "${description}" OFF)
272 elseif(DEFINED ${__value})
274 option(${variable} "${description}" ON)
276 option(${variable} "${description}" OFF)
279 option(${variable} "${description}" ${__value})
282 unset(${variable} CACHE)
289 # Macros that checks if module have been installed.
290 # After it adds module to build and define
291 # constants passed as second arg
292 macro(CHECK_MODULE module_name define)
295 set(ALIAS ALIASOF_${module_name})
296 set(ALIAS_FOUND ${ALIAS}_FOUND)
297 set(ALIAS_INCLUDE_DIRS ${ALIAS}_INCLUDE_DIRS)
298 set(ALIAS_LIBRARY_DIRS ${ALIAS}_LIBRARY_DIRS)
299 set(ALIAS_LIBRARIES ${ALIAS}_LIBRARIES)
301 PKG_CHECK_MODULES(${ALIAS} ${module_name})
305 foreach(P "${ALIAS_INCLUDE_DIRS}")
307 list(APPEND VIDEOIO_INCLUDE_DIRS ${${P}})
308 list(APPEND HIGHGUI_INCLUDE_DIRS ${${P}})
312 foreach(P "${ALIAS_LIBRARY_DIRS}")
314 list(APPEND VIDEOIO_LIBRARY_DIRS ${${P}})
315 list(APPEND HIGHGUI_LIBRARY_DIRS ${${P}})
319 list(APPEND VIDEOIO_LIBRARIES ${${ALIAS_LIBRARIES}})
320 list(APPEND HIGHGUI_LIBRARIES ${${ALIAS_LIBRARIES}})
326 set(OPENCV_BUILD_INFO_FILE "${OpenCV_BINARY_DIR}/version_string.tmp")
327 file(REMOVE "${OPENCV_BUILD_INFO_FILE}")
328 function(ocv_output_status msg)
329 message(STATUS "${msg}")
330 string(REPLACE "\\" "\\\\" msg "${msg}")
331 string(REPLACE "\"" "\\\"" msg "${msg}")
332 file(APPEND "${OPENCV_BUILD_INFO_FILE}" "\"${msg}\\n\"\n")
335 macro(ocv_finalize_status)
336 if(NOT OPENCV_SKIP_STATUS_FINALIZATION)
337 if(DEFINED OPENCV_MODULE_opencv_core_BINARY_DIR)
338 execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different "${OPENCV_BUILD_INFO_FILE}" "${OPENCV_MODULE_opencv_core_BINARY_DIR}/version_string.inc" OUTPUT_QUIET)
344 # Status report function.
345 # Automatically align right column and selects text based on condition.
348 # status(<heading> <value1> [<value2> ...])
349 # status(<heading> <condition> THEN <text for TRUE> ELSE <text for FALSE> )
350 function(status text)
355 set(status_current_name "cond")
357 if(arg STREQUAL "THEN")
358 set(status_current_name "then")
359 elseif(arg STREQUAL "ELSE")
360 set(status_current_name "else")
362 list(APPEND status_${status_current_name} ${arg})
366 if(DEFINED status_cond)
367 set(status_placeholder_length 32)
368 string(RANDOM LENGTH ${status_placeholder_length} ALPHABET " " status_placeholder)
369 string(LENGTH "${text}" status_text_length)
370 if(status_text_length LESS status_placeholder_length)
371 string(SUBSTRING "${text}${status_placeholder}" 0 ${status_placeholder_length} status_text)
372 elseif(DEFINED status_then OR DEFINED status_else)
373 ocv_output_status("${text}")
374 set(status_text "${status_placeholder}")
376 set(status_text "${text}")
379 if(DEFINED status_then OR DEFINED status_else)
381 string(REPLACE ";" " " status_then "${status_then}")
382 string(REGEX REPLACE "^[ \t]+" "" status_then "${status_then}")
383 ocv_output_status("${status_text} ${status_then}")
385 string(REPLACE ";" " " status_else "${status_else}")
386 string(REGEX REPLACE "^[ \t]+" "" status_else "${status_else}")
387 ocv_output_status("${status_text} ${status_else}")
390 string(REPLACE ";" " " status_cond "${status_cond}")
391 string(REGEX REPLACE "^[ \t]+" "" status_cond "${status_cond}")
392 ocv_output_status("${status_text} ${status_cond}")
395 ocv_output_status("${text}")
400 # splits cmake libraries list of format "general;item1;debug;item2;release;item3" to two lists
401 macro(ocv_split_libs_list lst lstdbg lstopt)
405 foreach(word ${${lst}})
406 if(word STREQUAL "debug" OR word STREQUAL "optimized")
407 set(perv_keyword ${word})
408 elseif(word STREQUAL "general")
410 elseif(perv_keyword STREQUAL "debug")
411 list(APPEND ${lstdbg} "${word}")
413 elseif(perv_keyword STREQUAL "optimized")
414 list(APPEND ${lstopt} "${word}")
417 list(APPEND ${lstdbg} "${word}")
418 list(APPEND ${lstopt} "${word}")
425 # remove all matching elements from the list
426 macro(ocv_list_filterout lst regex)
427 foreach(item ${${lst}})
428 if(item MATCHES "${regex}")
429 list(REMOVE_ITEM ${lst} "${item}")
435 # stable & safe duplicates removal macro
436 macro(ocv_list_unique __lst)
438 list(REMOVE_DUPLICATES ${__lst})
443 # safe list reversal macro
444 macro(ocv_list_reverse __lst)
446 list(REVERSE ${__lst})
451 # safe list sorting macro
452 macro(ocv_list_sort __lst)
459 # add prefix to each item in the list
460 macro(ocv_list_add_prefix LST PREFIX)
462 foreach(item ${${LST}})
463 list(APPEND __tmp "${PREFIX}${item}")
470 # add suffix to each item in the list
471 macro(ocv_list_add_suffix LST SUFFIX)
473 foreach(item ${${LST}})
474 list(APPEND __tmp "${item}${SUFFIX}")
481 # gets and removes the first element from list
482 macro(ocv_list_pop_front LST VAR)
484 list(GET ${LST} 0 ${VAR})
485 list(REMOVE_AT ${LST} 0)
492 # simple regex escaping routine (does not cover all cases!!!)
493 macro(ocv_regex_escape var regex)
494 string(REGEX REPLACE "([+.*^$])" "\\\\1" ${var} "${regex}")
498 # convert list of paths to full paths
499 macro(ocv_convert_to_full_paths VAR)
502 foreach(path ${${VAR}})
503 get_filename_component(${VAR} "${path}" ABSOLUTE)
504 list(APPEND __tmp "${${VAR}}")
512 # convert list of paths to libraries names without lib prefix
513 macro(ocv_convert_to_lib_name var)
515 foreach(path ${ARGN})
516 get_filename_component(__tmp_name "${path}" NAME_WE)
517 string(REGEX REPLACE "^lib" "" __tmp_name ${__tmp_name})
518 list(APPEND __tmp "${__tmp_name}")
526 # add install command
527 function(ocv_install_target)
528 install(TARGETS ${ARGN})
534 if(NOT DEFINED __target)
537 if(isPackage EQUAL 1)
538 set(__package "${e}")
541 if(e STREQUAL "EXPORT")
546 if(DEFINED __package)
547 list(APPEND ${__package}_TARGETS ${__target})
548 set(${__package}_TARGETS "${${__package}_TARGETS}" CACHE INTERNAL "List of ${__package} targets")
551 if(INSTALL_CREATE_DISTRIB)
552 if(MSVC AND NOT BUILD_SHARED_LIBS)
553 set(__target "${ARGV0}")
563 if(isArchive EQUAL 1 AND e STREQUAL "DESTINATION")
566 if(e STREQUAL "ARCHIVE")
573 # message(STATUS "Process ${__target} dst=${__dst}...")
575 if(CMAKE_VERSION VERSION_LESS 2.8.12)
576 get_target_property(fname ${__target} LOCATION_DEBUG)
577 if(fname MATCHES "\\.lib$")
578 string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
579 install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Debug)
582 get_target_property(fname ${__target} LOCATION_RELEASE)
583 if(fname MATCHES "\\.lib$")
584 string(REGEX REPLACE "\\.lib$" ".pdb" fname "${fname}")
585 install(FILES ${fname} DESTINATION ${__dst} CONFIGURATIONS Release)
588 # CMake 2.8.12 brokes PDB support in STATIC libraries for MSVS
596 # read set of version defines from the header file
597 macro(ocv_parse_header FILENAME FILE_VAR)
599 set(__parnet_scope OFF)
601 foreach(name ${ARGN})
602 if("${name}" STREQUAL "PARENT_SCOPE")
603 set(__parnet_scope ON)
604 elseif("${name}" STREQUAL "CACHE")
607 set(vars_regex "${vars_regex}|${name}")
609 set(vars_regex "${name}")
612 if(EXISTS "${FILENAME}")
613 file(STRINGS "${FILENAME}" ${FILE_VAR} REGEX "#define[ \t]+(${vars_regex})[ \t]+[0-9]+" )
617 foreach(name ${ARGN})
618 if(NOT "${name}" STREQUAL "PARENT_SCOPE" AND NOT "${name}" STREQUAL "CACHE")
620 if(${FILE_VAR} MATCHES ".+[ \t]${name}[ \t]+([0-9]+).*")
621 string(REGEX REPLACE ".+[ \t]${name}[ \t]+([0-9]+).*" "\\1" ${name} "${${FILE_VAR}}")
626 set(${name} ${${name}} CACHE INTERNAL "${name} parsed from ${FILENAME}" FORCE)
627 elseif(__parnet_scope)
628 set(${name} "${${name}}" PARENT_SCOPE)
637 # read single version define from the header file
638 macro(ocv_parse_header2 LIBNAME HDR_PATH VARNAME)
639 ocv_clear_vars(${LIBNAME}_VERSION_MAJOR
640 ${LIBNAME}_VERSION_MAJOR
641 ${LIBNAME}_VERSION_MINOR
642 ${LIBNAME}_VERSION_PATCH
643 ${LIBNAME}_VERSION_TWEAK
644 ${LIBNAME}_VERSION_STRING)
646 if(EXISTS "${HDR_PATH}")
647 file(STRINGS "${HDR_PATH}" ${LIBNAME}_H REGEX "^#define[ \t]+${VARNAME}[ \t]+\"[^\"]*\".*$" LIMIT_COUNT 1)
651 string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_MAJOR "${${LIBNAME}_H}")
652 string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_MINOR "${${LIBNAME}_H}")
653 string(REGEX REPLACE "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.[0-9]+\\.([0-9]+).*$" "\\1" ${LIBNAME}_VERSION_PATCH "${${LIBNAME}_H}")
654 set(${LIBNAME}_VERSION_MAJOR ${${LIBNAME}_VERSION_MAJOR} ${ARGN})
655 set(${LIBNAME}_VERSION_MINOR ${${LIBNAME}_VERSION_MINOR} ${ARGN})
656 set(${LIBNAME}_VERSION_PATCH ${${LIBNAME}_VERSION_PATCH} ${ARGN})
657 set(${LIBNAME}_VERSION_STRING "${${LIBNAME}_VERSION_MAJOR}.${${LIBNAME}_VERSION_MINOR}.${${LIBNAME}_VERSION_PATCH}")
659 # append a TWEAK version if it exists:
660 set(${LIBNAME}_VERSION_TWEAK "")
661 if("${${LIBNAME}_H}" MATCHES "^.*[ \t]${VARNAME}[ \t]+\"[0-9]+\\.[0-9]+\\.[0-9]+\\.([0-9]+).*$")
662 set(${LIBNAME}_VERSION_TWEAK "${CMAKE_MATCH_1}" ${ARGN})
664 if(${LIBNAME}_VERSION_TWEAK)
665 set(${LIBNAME}_VERSION_STRING "${${LIBNAME}_VERSION_STRING}.${${LIBNAME}_VERSION_TWEAK}" ${ARGN})
667 set(${LIBNAME}_VERSION_STRING "${${LIBNAME}_VERSION_STRING}" ${ARGN})
672 # read single version info from the pkg file
673 macro(ocv_parse_pkg LIBNAME PKG_PATH SCOPE)
674 if(EXISTS "${PKG_PATH}/${LIBNAME}.pc")
675 file(STRINGS "${PKG_PATH}/${LIBNAME}.pc" line_to_parse REGEX "^Version:[ \t]+[0-9.]*.*$" LIMIT_COUNT 1)
676 STRING(REGEX REPLACE ".*Version: ([^ ]+).*" "\\1" ALIASOF_${LIBNAME}_VERSION "${line_to_parse}" )
680 ################################################################################################
681 # short command to setup source group
682 function(ocv_source_group group)
683 if(BUILD_opencv_world AND OPENCV_MODULE_${the_module}_IS_PART_OF_WORLD)
684 set(group "${the_module}\\${group}")
686 cmake_parse_arguments(SG "" "DIRBASE" "GLOB;GLOB_RECURSE;FILES" ${ARGN})
689 list(APPEND files ${SG_FILES})
692 file(GLOB srcs ${SG_GLOB})
693 list(APPEND files ${srcs})
696 file(GLOB_RECURSE srcs ${SG_GLOB_RECURSE})
697 list(APPEND files ${srcs})
701 file(RELATIVE_PATH fpart "${SG_DIRBASE}" "${f}")
702 if(fpart MATCHES "^\\.\\.")
703 message(AUTHOR_WARNING "Can't detect subpath for source_group command: Group=${group} FILE=${f} DIRBASE=${SG_DIRBASE}")
706 get_filename_component(fpart "${fpart}" PATH)
708 set(fpart "/${fpart}") # add '/'
709 string(REPLACE "/" "\\" fpart "${fpart}")
712 source_group("${group}${fpart}" FILES ${f})
715 source_group(${group} FILES ${files})
719 function(ocv_target_link_libraries target)
720 _ocv_fix_target(target)
721 set(LINK_DEPS ${ARGN})
723 if(BUILD_opencv_world)
724 foreach(m ${OPENCV_MODULES_BUILD})
725 if(OPENCV_MODULE_${m}_IS_PART_OF_WORLD)
726 if(";${LINK_DEPS};" MATCHES ";${m};")
727 list(REMOVE_ITEM LINK_DEPS ${m})
728 if(NOT (";${LINK_DEPS};" MATCHES ";opencv_world;"))
729 list(APPEND LINK_DEPS opencv_world)
735 target_link_libraries(${target} ${LINK_DEPS})
738 function(_ocv_append_target_includes target)
739 if(DEFINED OCV_TARGET_INCLUDE_DIRS_${target})
740 target_include_directories(${target} PRIVATE ${OCV_TARGET_INCLUDE_DIRS_${target}})
741 unset(OCV_TARGET_INCLUDE_DIRS_${target} CACHE)
745 function(ocv_add_executable target)
746 add_executable(${target} ${ARGN})
747 _ocv_append_target_includes(${target})
750 function(ocv_add_library target)
756 if(var MATCHES ".cu")
757 list(APPEND cuda_srcs ${var})
762 ocv_include_directories(${CUDA_INCLUDE_DIRS})
763 ocv_cuda_compile(cuda_objs ${lib_cuda_srcs} ${lib_cuda_hdrs})
767 add_library(${target} ${ARGN} ${cuda_objs})
768 _ocv_append_target_includes(${target})