diff --git a/CMakeLists.txt b/CMakeLists.txt index 752c991b0..4e576ea4f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -561,6 +561,13 @@ include(cmake/OpenCVGenConfig.cmake) # Generate Info.plist for the IOS framework include(cmake/OpenCVGenInfoPlist.cmake) +# Generate environment setup file +if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH AND UNIX AND NOT ANDROID) + configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in" + "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY IMMEDIATE) + install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" DESTINATION /etc/profile.d/ COMPONENT tests) +endif() + # ---------------------------------------------------------------------------- # Summary: # ---------------------------------------------------------------------------- diff --git a/cmake/OpenCVPackaging.cmake b/cmake/OpenCVPackaging.cmake index 011787377..91f594096 100644 --- a/cmake/OpenCVPackaging.cmake +++ b/cmake/OpenCVPackaging.cmake @@ -56,12 +56,6 @@ set(CPACK_DEB_COMPONENT_INSTALL TRUE) set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") set(CPACK_DEBIAN_PACKAGE_SECTION "libs") set(CPACK_DEBIAN_PACKAGE_HOMEPAGE "http://opencv.org") -if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH) - set(prefix "${CMAKE_INSTALL_PREFIX}") - configure_file("${CMAKE_CURRENT_SOURCE_DIR}/cmake/templates/opencv_testing.sh.in" - "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" @ONLY IMMEDIATE) - install(FILES "${CMAKE_BINARY_DIR}/unix-install/opencv_testing.sh" DESTINATION /etc/profile.d/ COMPONENT tests) -endif() #depencencies set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS TRUE) diff --git a/cmake/templates/opencv_testing.sh.in b/cmake/templates/opencv_testing.sh.in new file mode 100644 index 000000000..3140136eb --- /dev/null +++ b/cmake/templates/opencv_testing.sh.in @@ -0,0 +1,2 @@ +# Environment setup for OpenCV testing +export OPENCV_TEST_DATA_PATH=@CMAKE_INSTALL_PREFIX@/share/OpenCV/testdata \ No newline at end of file diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt index 726fc0d10..2f10c82f6 100644 --- a/data/CMakeLists.txt +++ b/data/CMakeLists.txt @@ -9,10 +9,10 @@ elseif(NOT WIN32) install(FILES ${LBP_CASCADES} DESTINATION share/OpenCV/lbpcascades COMPONENT libs) endif() -if (OPENCV_TEST_DATA_PATH) +if(INSTALL_TESTS AND OPENCV_TEST_DATA_PATH) if(ANDROID) - install(FILES ${OPENCV_TEST_DATA_PATH} DESTINATION sdk/etc/testdata COMPONENT tests) + install(DIRECTORY ${OPENCV_TEST_DATA_PATH} DESTINATION sdk/etc/testdata COMPONENT tests) elseif(NOT WIN32) - install(FILES ${OPENCV_TEST_DATA_PATH} DESTINATION share/OpenCV/testdata COMPONENT tests) + install(DIRECTORY ${OPENCV_TEST_DATA_PATH} DESTINATION share/OpenCV/testdata COMPONENT tests) endif() endif() \ No newline at end of file