Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
O
opencv
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
opencv
Commits
05131af8
Commit
05131af8
authored
Dec 07, 2018
by
Maksim Shabunin
Committed by
Alexander Alekhin
Dec 07, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Merge pull request #13367 from mshabunin:cmake-verify
* Added dependency verification mechanism for cmake
parent
492a072e
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
2 deletions
+45
-2
CMakeLists.txt
CMakeLists.txt
+0
-0
OpenCVUtils.cmake
cmake/OpenCVUtils.cmake
+45
-2
No files found.
CMakeLists.txt
View file @
05131af8
This diff is collapsed.
Click to expand it.
cmake/OpenCVUtils.cmake
View file @
05131af8
...
...
@@ -571,14 +571,21 @@ endmacro()
# Provides an option that the user can optionally select.
# Can accept condition to control when option is available for user.
# Usage:
# option(<option_variable> "help string describing the option" <initial value or boolean expression> [IF <condition>])
# option(<option_variable>
# "help string describing the option"
# <initial value or boolean expression>
# [VISIBLE_IF <condition>]
# [VERIFY <condition>])
macro
(
OCV_OPTION variable description value
)
set
(
__value
${
value
}
)
set
(
__condition
""
)
set
(
__verification
)
set
(
__varname
"__value"
)
foreach
(
arg
${
ARGN
}
)
if
(
arg STREQUAL
"IF"
OR arg STREQUAL
"if"
)
if
(
arg STREQUAL
"IF"
OR arg STREQUAL
"if"
OR arg STREQUAL
"VISIBLE_IF"
)
set
(
__varname
"__condition"
)
elseif
(
arg STREQUAL
"VERIFY"
)
set
(
__varname
"__verification"
)
else
()
list
(
APPEND
${
__varname
}
${
arg
}
)
endif
()
...
...
@@ -614,10 +621,46 @@ macro(OCV_OPTION variable description value)
unset
(
${
variable
}
CACHE
)
endif
()
endif
()
if
(
__verification
)
set
(
OPENCV_VERIFY_
${
variable
}
"
${
__verification
}
"
)
# variable containing condition to verify
list
(
APPEND OPENCV_VERIFICATIONS
"
${
variable
}
"
)
# list of variable names (WITH_XXX;WITH_YYY;...)
endif
()
unset
(
__condition
)
unset
(
__value
)
endmacro
()
# Check that each variable stored in OPENCV_VERIFICATIONS list
# is consistent with actual detection result (stored as condition in OPENCV_VERIFY_...) variables
function
(
ocv_verify_config
)
set
(
broken_options
)
foreach
(
var
${
OPENCV_VERIFICATIONS
}
)
set
(
evaluated FALSE
)
if
(
${
OPENCV_VERIFY_
${
var
}}
)
set
(
evaluated TRUE
)
endif
()
status
(
"Verifying
${
var
}
=
${${
var
}}
=> '
${
OPENCV_VERIFY_
${
var
}}
'=
${
evaluated
}
"
)
if
(
${
var
}
AND NOT evaluated
)
list
(
APPEND broken_options
${
var
}
)
message
(
WARNING
"Option
${
var
}
is enabled but corresponding dependency "
"have not been found:
\"
${
OPENCV_VERIFY_
${
var
}}
\"
is FALSE"
)
elseif
(
NOT
${
var
}
AND evaluated
)
list
(
APPEND broken_options
${
var
}
)
message
(
WARNING
"Option
${
var
}
is disabled or unset but corresponding dependency "
"have been explicitly turned on:
\"
${
OPENCV_VERIFY_
${
var
}}
\"
is TRUE"
)
endif
()
endforeach
()
if
(
broken_options
)
string
(
REPLACE
";"
"
\n
"
broken_options
"
${
broken_options
}
"
)
message
(
FATAL_ERROR
"Some dependencies have not been found or have been forced, "
"unset ENABLE_CONFIG_VERIFICATION option to ignore these failures "
"or change following options:
\n
${
broken_options
}
"
)
endif
()
endfunction
()
# Usage: ocv_append_build_options(HIGHGUI FFMPEG)
macro
(
ocv_append_build_options var_prefix pkg_prefix
)
foreach
(
suffix INCLUDE_DIRS LIBRARIES LIBRARY_DIRS
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment