cmake: fix includes processing
This commit is contained in:
+11
-16
@@ -164,7 +164,7 @@ macro(ocv_add_module _name)
|
||||
set(OPENCV_MODULE_${the_module}_LINK_DEPS "" CACHE INTERNAL "")
|
||||
|
||||
# parse list of dependencies
|
||||
if("${ARGV1}" STREQUAL "INTERNAL" OR "${ARGV1}" STREQUAL "BINDINGS")
|
||||
if(" ${ARGV1}" STREQUAL " INTERNAL" OR " ${ARGV1}" STREQUAL " BINDINGS")
|
||||
set(OPENCV_MODULE_${the_module}_CLASS "${ARGV1}" CACHE INTERNAL "The category of the module")
|
||||
set(__ocv_argn__ ${ARGN})
|
||||
list(REMOVE_AT __ocv_argn__ 0)
|
||||
@@ -257,7 +257,7 @@ endmacro()
|
||||
# Usage: _glob_locations(<output paths list> <output names list> <folder> [<folder> ...])
|
||||
function(_glob_locations out_paths out_names)
|
||||
foreach(path ${ARGN})
|
||||
message(STATUS "Inspect: ${path}")
|
||||
#message(STATUS "Inspect: ${path}")
|
||||
list(LENGTH paths before)
|
||||
get_filename_component(path "${path}" ABSOLUTE)
|
||||
# Either module itself
|
||||
@@ -269,7 +269,7 @@ function(_glob_locations out_paths out_names)
|
||||
# Either flat collection of modules
|
||||
file(GLOB subdirs RELATIVE "${path}" "${path}/*")
|
||||
foreach(subdir ${subdirs})
|
||||
message(STATUS "Inspect: ${path}/${subdir}")
|
||||
#message(STATUS "Inspect: ${path}/${subdir}")
|
||||
if(EXISTS "${path}/${subdir}/CMakeLists.txt")
|
||||
list(APPEND paths "${path}/${subdir}")
|
||||
list(APPEND names "${subdir}")
|
||||
@@ -302,7 +302,7 @@ function(_add_modules_1 paths names)
|
||||
foreach(i RANGE ${len})
|
||||
list(GET ${paths} ${i} path)
|
||||
list(GET ${names} ${i} name)
|
||||
message(STATUS "First pass: ${name} => ${path}")
|
||||
#message(STATUS "First pass: ${name} => ${path}")
|
||||
include("${path}/cmake/init.cmake" OPTIONAL)
|
||||
add_subdirectory("${path}" "${CMAKE_CURRENT_BINARY_DIR}/.firstpass/${name}")
|
||||
endforeach()
|
||||
@@ -320,7 +320,7 @@ function(_add_modules_2)
|
||||
message(WARNING "Incorrect module name: ${m}")
|
||||
endif()
|
||||
string(REGEX REPLACE "^opencv_" "" name "${m}")
|
||||
message(STATUS "Second pass: ${name} => ${OPENCV_MODULE_${m}_LOCATION}")
|
||||
#message(STATUS "Second pass: ${name} => ${OPENCV_MODULE_${m}_LOCATION}")
|
||||
add_subdirectory("${OPENCV_MODULE_${m}_LOCATION}" "${CMAKE_CURRENT_BINARY_DIR}/${name}")
|
||||
endif()
|
||||
endforeach()
|
||||
@@ -427,7 +427,7 @@ function(__ocv_sort_modules_by_deps __lst)
|
||||
break()
|
||||
endif()
|
||||
else()
|
||||
message(FATAL_ERROR WARNING "Unresolved dependencies or loop in dependency graph (${length_after})\n"
|
||||
message(FATAL_ERROR "FATAL: Unresolved dependencies or loop in dependency graph (${length_after})\n"
|
||||
"Processed ${__lst}: ${${__lst}}\n"
|
||||
"Good modules: ${result}\n"
|
||||
"Bad modules: ${input}"
|
||||
@@ -652,12 +652,14 @@ endmacro()
|
||||
# setup include paths for the list of passed modules
|
||||
macro(ocv_target_include_modules target)
|
||||
foreach(d ${ARGN})
|
||||
if(d MATCHES "^opencv_" AND HAVE_${d})
|
||||
if (EXISTS "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
if(d MATCHES "^opencv_")
|
||||
if(HAVE_${d} AND EXISTS "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
ocv_target_include_directories(${target} "${OPENCV_MODULE_${d}_LOCATION}/include")
|
||||
endif()
|
||||
elseif(EXISTS "${d}")
|
||||
ocv_target_include_directories(${target} "${d}")
|
||||
else()
|
||||
message(WARNING "Unexpected include: ${d} (module=${the_module})")
|
||||
endif()
|
||||
endforeach()
|
||||
endmacro()
|
||||
@@ -686,14 +688,7 @@ macro(ocv_module_include_directories)
|
||||
"${OPENCV_MODULE_${the_module}_LOCATION}/src"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}" # for precompiled headers
|
||||
)
|
||||
foreach(arg ${ARGN})
|
||||
if(IS_ABSOLUTE "${arg}")
|
||||
list(APPEND incs "${arg}")
|
||||
else()
|
||||
list(APPEND incs "${OPENCV_MODULE_${the_module}_LOCATION}/${arg}")
|
||||
endif()
|
||||
endforeach()
|
||||
ocv_target_include_modules(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${incs})
|
||||
ocv_target_include_modules(${the_module} ${OPENCV_MODULE_${the_module}_DEPS} ${ARGN})
|
||||
endmacro()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user