# Configuring CMake for OpenCV Ubuntu 16.04

Hello everyone,

I'm trying to compile OpenCV with CMake and I'm currently struggling to get the software to compile successfully. I'm getting the following errors: CMake Warning (dev) at CMakeLists.txt:4 (add_subdirectory): The source directory

/home/jeremy/traincascade


does not contain a CMakeLists.txt file.

CMake does not support this case but it used to work accidentally and is being allowed for compatibility.

Policy CMP0014 is not set: Input directories must have CMakeLists.txt. Run "cmake --help-policy CMP0014" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:5 (add_subdirectory): The source directory

/home/jeremy/createsamples


does not contain a CMakeLists.txt file.

CMake does not support this case but it used to work accidentally and is being allowed for compatibility.

Policy CMP0014 is not set: Input directories must have CMakeLists.txt. Run "cmake --help-policy CMP0014" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) at CMakeLists.txt:6 (add_subdirectory): The source directory

/home/jeremy/annotation


does not contain a CMakeLists.txt file.

CMake does not support this case but it used to work accidentally and is being allowed for compatibility.

Policy CMP0014 is not set: Input directories must have CMakeLists.txt. Run "cmake --help-policy CMP0014" for policy details. Use the cmake_policy command to set the policy and suppress this warning. This warning is for project developers. Use -Wno-dev to suppress it.

CMake Warning (dev) in CMakeLists.txt: No cmake_minimum_required command is present. A line of code such as

cmake_minimum_required(VERSION 3.7)


should be added at the top of the file. The version specified may be lower if you wish to support older CMake versions for this project. For more information run "cmake --help-policy CMP0000". This warning is for project developers. Use -Wno-dev to suppress it.

-- Configuring done -- Generating done -- Build files have been written to: /home/jeremy/opencv-3.1.0

It says that it has finished configuring and generating the appropriate software, but I'm unsure if I need to actually put in a CMakeLists.txt file. There seems to be a great number of files with that exact name containing different things!

Any advice or help would be greatly appreciated. I'm pretty new to Linux and could be missing something obvious. I have tried removing the directory I'm trying to write this to in its entirety and also reinstalling CMake a couple of times. I haven't been able to find much documentation on these particular errors and how to fix them.

Thank you so much for your time! Can't wait to start!

edit retag close merge delete

rather point cmake at your main opencv folder, and build with cmake -DBUILD_opencv_apps=ON