Merge pull request #1632 from alalek:cmake_find_package_build_dir
This commit is contained in:
commit
8b63e33b24
@ -74,11 +74,12 @@ if(ANDROID AND NOT BUILD_SHARED_LIBS AND HAVE_TBB)
|
||||
list(APPEND OpenCV2_INCLUDE_DIRS_CONFIGCMAKE ${TBB_INCLUDE_DIRS})
|
||||
endif()
|
||||
|
||||
export(TARGETS ${OpenCVModules_TARGETS} FILE "${CMAKE_BINARY_DIR}/OpenCVModules.cmake")
|
||||
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig.cmake" IMMEDIATE @ONLY)
|
||||
#support for version checking when finding opencv. find_package(OpenCV 2.3.1 EXACT) should now work.
|
||||
configure_file("${OpenCV_SOURCE_DIR}/cmake/templates/OpenCVConfig-version.cmake.in" "${CMAKE_BINARY_DIR}/OpenCVConfig-version.cmake" IMMEDIATE @ONLY)
|
||||
|
||||
|
||||
# --------------------------------------------------------------------------------------------
|
||||
# Part 2/3: ${BIN_DIR}/unix-install/OpenCVConfig.cmake -> For use *with* "make install"
|
||||
# -------------------------------------------------------------------------------------------
|
||||
|
@ -440,6 +440,28 @@ endmacro()
|
||||
function(ocv_install_target)
|
||||
install(TARGETS ${ARGN})
|
||||
|
||||
set(isPackage 0)
|
||||
unset(__package)
|
||||
unset(__target)
|
||||
foreach(e ${ARGN})
|
||||
if(NOT DEFINED __target)
|
||||
set(__target "${e}")
|
||||
endif()
|
||||
if(isPackage EQUAL 1)
|
||||
set(__package "${e}")
|
||||
break()
|
||||
endif()
|
||||
if(e STREQUAL "EXPORT")
|
||||
set(isPackage 1)
|
||||
endif()
|
||||
endforeach()
|
||||
|
||||
if(DEFINED __package)
|
||||
list(APPEND ${__package}_TARGETS ${__target})
|
||||
list(REMOVE_DUPLICATES ${__package}_TARGETS)
|
||||
set(${__package}_TARGETS "${${__package}_TARGETS}" CACHE INTERNAL "List of ${__package} targets")
|
||||
endif()
|
||||
|
||||
if(INSTALL_CREATE_DISTRIB)
|
||||
if(MSVC AND NOT BUILD_SHARED_LIBS)
|
||||
set(__target "${ARGV0}")
|
||||
|
@ -289,9 +289,10 @@ endmacro()
|
||||
# adds include directories in such way that directories from the OpenCV source tree go first
|
||||
function(ocv_include_directories)
|
||||
set(__add_before "")
|
||||
file(TO_CMAKE_PATH "${OpenCV_DIR}" __baseDir)
|
||||
foreach(dir ${ARGN})
|
||||
get_filename_component(__abs_dir "${dir}" ABSOLUTE)
|
||||
if("${__abs_dir}" MATCHES "^${OpenCV_DIR}")
|
||||
if("${__abs_dir}" MATCHES "^${__baseDir}")
|
||||
list(APPEND __add_before "${dir}")
|
||||
else()
|
||||
include_directories(AFTER SYSTEM "${dir}")
|
||||
|
Loading…
x
Reference in New Issue
Block a user