]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | From 9fde9124927789ca2399f99c1be9b101ed1e8550 Mon Sep 17 00:00:00 2001 |
2 | From: Silvio Traversaro <silvio.traversaro@iit.it> | |
3 | Date: Thu, 3 Sep 2020 17:28:01 +0200 | |
4 | Subject: [PATCH] CMake: Add DART_SKIP_<dep> advanced option | |
5 | ||
6 | Add DART_SKIP_<dep> option to permit to specify that | |
7 | a dependecy should not used even if it is found in the system. | |
8 | --- | |
9 | cmake/DARTMacros.cmake | 21 ++++++++++++++------- | |
10 | 1 file changed, 14 insertions(+), 7 deletions(-) | |
11 | ||
12 | diff --git a/cmake/DARTMacros.cmake b/cmake/DARTMacros.cmake | |
13 | index 8b1a89292ee..409b02bd742 100644 | |
14 | --- a/cmake/DARTMacros.cmake | |
15 | +++ b/cmake/DARTMacros.cmake | |
16 | @@ -127,7 +127,9 @@ endfunction() | |
17 | ||
18 | #=============================================================================== | |
19 | macro(dart_check_optional_package variable component dependency) | |
20 | - if(${${variable}_FOUND}) | |
21 | + option(DART_SKIP_${variable} "If ON, do not use ${variable} even if it is found." OFF) | |
22 | + mark_as_advanced(DART_SKIP_${variable}) | |
23 | + if(${${variable}_FOUND} AND NOT ${DART_SKIP_${variable}}) | |
24 | set(HAVE_${variable} TRUE CACHE BOOL "Check if ${variable} found." FORCE) | |
25 | if(DART_VERBOSE) | |
26 | message(STATUS "Looking for ${dependency} - version ${${variable}_VERSION}" | |
27 | @@ -135,12 +137,17 @@ macro(dart_check_optional_package variable component dependency) | |
28 | endif() | |
29 | else() | |
30 | set(HAVE_${variable} FALSE CACHE BOOL "Check if ${variable} found." FORCE) | |
31 | - if(ARGV3) # version | |
32 | - message(STATUS "Looking for ${dependency} - NOT found, to use" | |
33 | - " ${component}, please install ${dependency} (>= ${ARGV3})") | |
34 | - else() | |
35 | - message(STATUS "Looking for ${dependency} - NOT found, to use" | |
36 | - " ${component}, please install ${dependency}") | |
37 | + if(NOT ${${variable}_FOUND}) | |
38 | + if(ARGV3) # version | |
39 | + message(STATUS "Looking for ${dependency} - NOT found, to use" | |
40 | + " ${component}, please install ${dependency} (>= ${ARGV3})") | |
41 | + else() | |
42 | + message(STATUS "Looking for ${dependency} - NOT found, to use" | |
43 | + " ${component}, please install ${dependency}") | |
44 | + endif() | |
45 | + elseif(${DART_SKIP_${variable}} AND DART_VERBOSE) | |
46 | + message(STATUS "Not using ${dependency} - version ${${variable}_VERSION}" | |
47 | + " even if found because DART_SKIP_${variable} is ON.") | |
48 | endif() | |
49 | return() | |
50 | endif() |