make OpenCVConfig.cmake usable in the case of static libs
This commit is contained in:
parent
3ec6934da3
commit
8b4cb1d99c
11
3rdparty/lapack/CMakeLists.txt
vendored
11
3rdparty/lapack/CMakeLists.txt
vendored
@ -60,4 +60,15 @@ set_target_properties(${the_target}
|
||||
DEBUG_POSTFIX "${OPENCV_DEBUG_POSTFIX}"
|
||||
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/3rdparty/lib
|
||||
)
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set_target_properties(${the_target}
|
||||
PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
install(TARGETS ${the_target}
|
||||
RUNTIME DESTINATION bin COMPONENT main
|
||||
LIBRARY DESTINATION lib COMPONENT main
|
||||
ARCHIVE DESTINATION lib COMPONENT main)
|
||||
endif()
|
||||
|
||||
endif() #android
|
||||
|
13
3rdparty/zlib/CMakeLists.txt
vendored
13
3rdparty/zlib/CMakeLists.txt
vendored
@ -1,11 +1,11 @@
|
||||
if(ANDROID)
|
||||
define_3rdparty_module(zlib)
|
||||
define_3rdparty_module(opencv_zlib)
|
||||
else()
|
||||
# ----------------------------------------------------------------------------
|
||||
# CMake file for zlib. See root CMakeLists.txt
|
||||
#
|
||||
# ----------------------------------------------------------------------------
|
||||
PROJECT(zlib)
|
||||
PROJECT(opencv_zlib)
|
||||
|
||||
# List of C++ files:
|
||||
|
||||
@ -18,7 +18,7 @@ file(GLOB lib_srcs *.c)
|
||||
file(GLOB lib_hdrs *.h)
|
||||
set(lib_ext_hdrs "../include/zlib.h" "../include/zconf.h")
|
||||
|
||||
set(the_target "zlib")
|
||||
set(the_target "opencv_zlib")
|
||||
|
||||
add_library(${the_target} STATIC ${lib_srcs} ${lib_hdrs} ${lib_ext_hdrs})
|
||||
|
||||
@ -39,4 +39,11 @@ set_target_properties(${the_target}
|
||||
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/3rdparty/lib"
|
||||
)
|
||||
|
||||
if(NOT BUILD_SHARED_LIBS)
|
||||
set_target_properties(${the_target}
|
||||
PROPERTIES INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
install(TARGETS ${the_target}
|
||||
ARCHIVE DESTINATION lib COMPONENT main)
|
||||
endif()
|
||||
|
||||
endif(ANDROID)
|
||||
|
@ -965,8 +965,6 @@ IF(NOT BUILD_SHARED_LIBS)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} stdc++)
|
||||
endif()
|
||||
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} opencv_flann zlib opencv_lapack)
|
||||
endif()
|
||||
|
||||
|
||||
@ -1067,18 +1065,6 @@ set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\"")
|
||||
|
||||
set(CMAKE_LIB_DIRS_CONFIGCMAKE "${CMAKE_INSTALL_PREFIX}/lib")
|
||||
|
||||
# This will expand to, for example, <program files>/OpenCV 1.1.0/include
|
||||
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/include\"
|
||||
\"\${THIS_OPENCV_CONFIG_PATH}/include/opencv\"
|
||||
\"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/include\"")
|
||||
|
||||
set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}\"")
|
||||
|
||||
# This will expand to, for example, <program files>/OpenCV 1.1.0/lib
|
||||
# support for 3rdparty libraries.
|
||||
set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/lib\"
|
||||
\"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/lib\"")
|
||||
|
||||
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/unix-install/\"" OUTPUT_VARIABLE RET_VAL)
|
||||
configure_file("${CMAKE_CURRENT_SOURCE_DIR}/OpenCVConfig.cmake.in" "${CMAKE_BINARY_DIR}/unix-install/OpenCVConfig.cmake" IMMEDIATE @ONLY)
|
||||
|
||||
@ -1093,6 +1079,17 @@ endif()
|
||||
if(WIN32)
|
||||
# Set CMAKE_INCLUDE_DIRS_CONFIGCMAKE to the list of include directories:
|
||||
# support for 3rdparty libraries.
|
||||
# This will expand to, for example, <program files>/OpenCV 1.1.0/include
|
||||
set(CMAKE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/include\"
|
||||
\"\${THIS_OPENCV_CONFIG_PATH}/include/opencv\"
|
||||
\"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/include\"")
|
||||
|
||||
set(CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}\"")
|
||||
|
||||
# This will expand to, for example, <program files>/OpenCV 1.1.0/lib
|
||||
# support for 3rdparty libraries.
|
||||
set(CMAKE_LIB_DIRS_CONFIGCMAKE "\"\${THIS_OPENCV_CONFIG_PATH}/lib\"
|
||||
\"\${THIS_OPENCV_CONFIG_PATH}/3rdparty/lib\"")
|
||||
|
||||
#exec_program(${CMAKE_COMMAND} ARGS "-E make_directory \"${CMAKE_BINARY_DIR}/win-install/\"")
|
||||
exec_program(mkdir ARGS "-p \"${CMAKE_BINARY_DIR}/win-install/\"" OUTPUT_VARIABLE RET_VAL)
|
||||
|
@ -82,7 +82,12 @@ endif(NOT @CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@ STREQUAL "")
|
||||
# many more dependencies:
|
||||
IF (NOT @OPENCV_BUILD_SHARED_LIB@)
|
||||
# Under static libs, the user of OpenCV needs access to the 3rdparty libs as well:
|
||||
#LINK_DIRECTORIES(@CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@/3rdparty/lib")
|
||||
if(UNIX)
|
||||
LINK_DIRECTORIES(@CMAKE_LIB_DIRS_CONFIGCMAKE@/../3rdparty/lib)
|
||||
else()
|
||||
LINK_DIRECTORIES(@CMAKE_BASE_INCLUDE_DIRS_CONFIGCMAKE@/3rdparty/lib)
|
||||
endif()
|
||||
|
||||
|
||||
SET(OpenCV_LIBS
|
||||
@OPENCV_LINKER_LIBS@
|
||||
@ -92,7 +97,9 @@ IF (NOT @OPENCV_BUILD_SHARED_LIB@)
|
||||
@TIFF_LIBRARIES@
|
||||
@JASPER_LIBRARIES@
|
||||
@HIGHGUI_LIBRARIES@
|
||||
${OpenCV_LIBS}) # The standard libs BEFORE (OpenCV_LIBS) since these can have "debug","optimized".
|
||||
${OpenCV_LIBS}
|
||||
opencv_zlib
|
||||
opencv_lapack) # The standard libs BEFORE (OpenCV_LIBS) since these can have "debug","optimized".
|
||||
ENDIF(NOT @OPENCV_BUILD_SHARED_LIB@)
|
||||
|
||||
|
||||
|
@ -44,7 +44,7 @@ FIND_LIBRARY(OPENEXR_ILMIMF_LIBRARY
|
||||
IF (OPENEXR_INCLUDE_PATH AND OPENEXR_IMATH_LIBRARY AND OPENEXR_ILMIMF_LIBRARY AND OPENEXR_IEX_LIBRARY AND OPENEXR_HALF_LIBRARY)
|
||||
SET(OPENEXR_FOUND TRUE)
|
||||
SET(OPENEXR_INCLUDE_PATHS ${OPENEXR_INCLUDE_PATH} CACHE STRING "The include paths needed to use OpenEXR")
|
||||
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} zlib CACHE STRING "The libraries needed to use OpenEXR")
|
||||
SET(OPENEXR_LIBRARIES ${OPENEXR_IMATH_LIBRARY} ${OPENEXR_ILMIMF_LIBRARY} ${OPENEXR_IEX_LIBRARY} ${OPENEXR_HALF_LIBRARY} opencv_zlib CACHE STRING "The libraries needed to use OpenEXR")
|
||||
ENDIF ()
|
||||
|
||||
IF(OPENEXR_FOUND)
|
||||
|
@ -1,3 +1,3 @@
|
||||
include_directories("${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/include")
|
||||
set(deps opencv_lapack zlib)
|
||||
set(deps opencv_lapack opencv_zlib)
|
||||
define_opencv_module(core ${deps})
|
||||
|
@ -277,8 +277,8 @@ if(WITH_JPEG AND NOT JPEG_FOUND)
|
||||
endif()
|
||||
|
||||
if(WITH_PNG AND NOT PNG_FOUND)
|
||||
add_dependencies(${the_target} libpng zlib)
|
||||
target_link_libraries(${the_target} libpng zlib)
|
||||
add_dependencies(${the_target} libpng opencv_zlib)
|
||||
target_link_libraries(${the_target} libpng opencv_zlib)
|
||||
endif()
|
||||
|
||||
if(WITH_TIFF AND NOT TIFF_FOUND)
|
||||
@ -287,8 +287,8 @@ if(WITH_TIFF AND NOT TIFF_FOUND)
|
||||
endif()
|
||||
|
||||
#if(OPENCV_BUILD_3RDPARTY_LIBS)
|
||||
# add_dependencies(${the_target} libjasper libjpeg libpng libtiff zlib)
|
||||
# target_link_libraries(${the_target} libjasper libjpeg libpng libtiff zlib)
|
||||
# add_dependencies(${the_target} libjasper libjpeg libpng libtiff opencv_zlib)
|
||||
# target_link_libraries(${the_target} libjasper libjpeg libpng libtiff opencv_zlib)
|
||||
#endif()
|
||||
if(WIN32)
|
||||
target_link_libraries(${the_target} comctl32 gdi32 ole32)
|
||||
|
Loading…
x
Reference in New Issue
Block a user