Skip to content

Commit

Permalink
CMake: Add DART_SKIP_<dep> advanced options (#1497)
Browse files Browse the repository at this point in the history
Add DART_SKIP_<dep> option to permit to specify that
a dependecy should not used even if it is found in the system.
  • Loading branch information
traversaro authored Apr 4, 2021
1 parent c05da71 commit a7584a1
Showing 1 changed file with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions cmake/DARTMacros.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,20 +127,27 @@ endfunction()

#===============================================================================
macro(dart_check_optional_package variable component dependency)
if(${${variable}_FOUND})
option(DART_SKIP_${variable} "If ON, do not use ${variable} even if it is found." OFF)
mark_as_advanced(DART_SKIP_${variable})
if(${${variable}_FOUND} AND NOT ${DART_SKIP_${variable}})
set(HAVE_${variable} TRUE CACHE BOOL "Check if ${variable} found." FORCE)
if(DART_VERBOSE)
message(STATUS "Looking for ${dependency} - version ${${variable}_VERSION}"
" found")
endif()
else()
set(HAVE_${variable} FALSE CACHE BOOL "Check if ${variable} found." FORCE)
if(ARGV3) # version
message(WARNING "Looking for ${dependency} - NOT found, to use"
" ${component}, please install ${dependency} (>= ${ARGV3})")
else()
message(WARNING "Looking for ${dependency} - NOT found, to use"
" ${component}, please install ${dependency}")
if(NOT ${${variable}_FOUND})
if(ARGV3) # version
message(WARNING "Looking for ${dependency} - NOT found, to use"
" ${component}, please install ${dependency} (>= ${ARGV3})")
else()
message(WARNING "Looking for ${dependency} - NOT found, to use"
" ${component}, please install ${dependency}")
endif()
elseif(${DART_SKIP_${variable}} AND DART_VERBOSE)
message(STATUS "Not using ${dependency} - version ${${variable}_VERSION}"
" even if found because DART_SKIP_${variable} is ON.")
endif()
return()
endif()
Expand Down

0 comments on commit a7584a1

Please sign in to comment.