From 2d778434f177078ca183be1c299c180befe88461 Mon Sep 17 00:00:00 2001 From: Augusto Fraga Giachero Date: Tue, 7 Jan 2020 08:36:35 -0300 Subject: [PATCH] Enable cmake CMP0077 policy When building OpenCV as a sub-project using cmake's add_subdirectory() the OpenCV's build options would be overwritten to its default state. With cmake 3.13+ the CMP0077 policy, option() honors previous definitions via set(). --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 019f918896..f4a2568db6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,9 @@ if(POLICY CMP0075) cmake_policy(SET CMP0075 NEW) # CMake 3.12+: Include file check macros honor `CMAKE_REQUIRED_LIBRARIES` endif() +if(POLICY CMP0077) + cmake_policy(SET CMP0077 NEW) # CMake 3.13+: option() honors normal variables. +endif() # # Configure OpenCV CMake hooks