OpenCV 3.2.0 CMakeLists.txt question

Hi yall,

So finally it worked with

make -D OpenCV_DIR=/home/ubuntu/opencv-3.2.0/share/OpenCV ..

But I have to manually type this every time I use cmake now. Here is what I put in my CMakeLists.txt file, not sure why this won’t work

cmake_minimum_required (VERSION 2.8)

set(CUDA_USE_STATIC_CUDA_RUNTIME OFF)

set(OpenCV_DIR=/home/opencv-3.2.0/share/OpenCV)

project(PED_STUDY)

find_package(OpenCV REQUIRED)

include_directories(${OpenCV_INCLUDE_DIRS})

add_executable(cv_PED main.cpp)

target_link_libraries(cv_PED ${OpenCV_LIBS})

Does anyine know how to modify the CMakeLists.txt so that I don’t need to retype each and every time?

Thanks!