Skip to content

Commit

Permalink
CMake: let process_feature() accept values directly
Browse files Browse the repository at this point in the history
  • Loading branch information
tamiko committed May 22, 2023
1 parent 0b99f69 commit 07a7ef9
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions cmake/macros/macro_process_feature.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,30 @@ macro(process_feature _feature)

else()

if("${${_arg}}" MATCHES "^\\s*$" OR "${${_arg}}" MATCHES "-NOTFOUND")
#
# We prefer that values are specified directly but also have to
# support the old behavior of supplying a variable name:
#
set(_value "${_arg}")
if(DEFINED "${_value}")
# We have encountered a variable name:
set(_value "${${_value}}")
endif()

#
# The final string must neither end in -NOTFOUND which is CMake's
# way of telling us that it wasn't able to find a library/file, or
# be only whitespace
#
if("${_value}" MATCHES "-NOTFOUND" OR "${_value}" MATCHES "^\\s*$")
if(_required)
if("${${_arg}}" MATCHES "^\\s*$")
message(STATUS
" ${_feature}_${_current_suffix}: *** Required variable \"${_arg}\" empty ***"
)
else()
message(STATUS
" ${_feature}_${_current_suffix}: *** Required variable \"${_arg}\" set to NOTFOUND ***"
)
endif()
message(STATUS
" ${_feature}_${_current_suffix}: *** Required value/variable \"${_arg}\" empty or set to NOTFOUND ***"
)
set(${_feature}_FOUND FALSE)
endif()
else()
list(APPEND _temp_${_current_suffix} ${${_arg}})
list(APPEND _temp_${_current_suffix} ${_value})
endif()
endif()
endif()
Expand Down

0 comments on commit 07a7ef9

Please sign in to comment.