0

こんにちは、画像ファイルを開くための基本的なプログラムを作成しました。CMake を使用してコンパイルしようとしています。これは私のCMakeファイルがどのように見えるかです:

         cmake_minimum_required(VERSION 2.6)
         project( textures )
         find_package( OpenCV REQUIRED )
         add_executable( textures textures.cpp )
         target_link_libraries( textures ${OpenCV_LIBS} ) 

「cmake .」を実行すると、次のエラーが発生しました。

         CMake Error at CMakeLists.txt:3 (find_package):
         By not providing "FindOpenCV.cmake" in CMAKE_MODULE_PATH this project has
         asked CMake to find a package configuration file provided by "OpenCV", but
         CMake did not find one.

         Could not find a package configuration file provided by "OpenCV" with any
         of the following names:

         OpenCVConfig.cmake
         opencv-config.cmake

         Add the installation prefix of "OpenCV" to CMAKE_PREFIX_PATH or set
         "OpenCV_DIR" to a directory containing one of the above files.  If "OpenCV"
         provides a separate development package or SDK, be sure it has been
         installed.


         -- Configuring incomplete, errors occurred!

これが何を意味し、どのように解決できるかについて何か考えはありますか? ありがとう。

4

1 に答える 1

0

CMake はファイル FindOpenCV.cmake を探しているので、そのファイルがあることを確認してください (他の人の実装をオンラインで検索できます)。次に、このファイルを適切なディレクトリに配置し、CMakeLists.txt ファイルのプロジェクト行の後にこのコマンドを追加します」

 set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/relative/path/to/your/file/")

CMAKE_SOURCE_DIR は、ソース コードがある場所です。

于 2013-02-13T21:04:54.740 に答える