cmake: fix OPENGL_LIBRARIES handling

This commit is contained in:
Alexander Alekhin 2021-12-07 05:47:54 +00:00
parent 35ff9af6ce
commit 65392d5e6b
4 changed files with 3 additions and 2 deletions

View File

@ -101,7 +101,6 @@ if(WITH_OPENGL)
find_package (OpenGL QUIET)
if(OPENGL_FOUND)
set(HAVE_OPENGL TRUE)
list(APPEND OPENCV_LINKER_LIBS ${OPENGL_LIBRARIES})
if(QT_QTOPENGL_FOUND)
set(HAVE_QT_OPENGL TRUE)
else()

View File

@ -107,6 +107,7 @@ ocv_create_module(${extra_libs})
ocv_target_link_libraries(${the_module} PRIVATE
"${ZLIB_LIBRARIES}" "${OPENCL_LIBRARIES}" "${VA_LIBRARIES}"
"${OPENGL_LIBRARIES}"
"${LAPACK_LIBRARIES}" "${CPUFEATURES_LIBRARIES}" "${HALIDE_LIBRARIES}"
"${ITT_LIBRARIES}"
"${OPENCV_HAL_LINKER_LIBS}"

View File

@ -56,6 +56,7 @@ foreach(sample_filename ${cpp_samples})
endif()
if(HAVE_OPENGL AND sample_filename MATCHES "detect_mser")
target_compile_definitions(${tgt} PRIVATE HAVE_OPENGL)
ocv_target_link_libraries(${tgt} PRIVATE "${OPENGL_LIBRARIES}")
endif()
if(sample_filename MATCHES "simd_")
# disabled intentionally - demonstration purposes only

View File

@ -23,7 +23,7 @@ if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
endif()
foreach(sample_filename ${all_samples})
ocv_define_sample(tgt ${sample_filename} opengl)
ocv_target_link_libraries(${tgt} PRIVATE ${OPENCV_LINKER_LIBS} ${OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS})
ocv_target_link_libraries(${tgt} PRIVATE "${OPENGL_LIBRARIES}" "${OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS}")
if(sample_filename STREQUAL "opengl_interop.cpp")
ocv_target_link_libraries(${tgt} PRIVATE ${X11_LIBRARIES})
ocv_target_include_directories(${tgt} ${X11_INCLUDE_DIR})