mirror of https://github.com/libp2p/cpp-libp2p.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
14 lines
481 B
14 lines
481 B
function(add_cache_flag var_name flag)
|
|
set(spaced_string " ${${var_name}} ")
|
|
string(FIND "${spaced_string}" " ${flag} " flag_index)
|
|
if(NOT flag_index EQUAL -1)
|
|
return()
|
|
endif()
|
|
string(COMPARE EQUAL "" "${${var_name}}" is_empty)
|
|
if(is_empty)
|
|
# beautify: avoid extra space at the end if var_name is empty
|
|
set("${var_name}" "${flag}" CACHE STRING "" FORCE)
|
|
else()
|
|
set("${var_name}" "${flag} ${${var_name}}" CACHE STRING "" FORCE)
|
|
endif()
|
|
endfunction()
|
|
|