On Thu Jul 06, 2023 at 11:11:51AM +0200, Marc Espie wrote:
> Thanks to ian for prodding.
> 
> What do people think of automatically adding BOOL where needed in
> CMAKE_ARGS, something along the lines of the following construct:
> 
> ARGS=-DFLAG1=ON -DFLAG2:BOOL=ON -DFLAG3=ON -DFLAG4=OFF
> 
> test:
>         echo ${ARGS:S/=ON/:BOOL=ON/g:S/=OFF/:BOOL=OFF/g:S/:BOOL:BOOL/:BOOL/g}
> 
> 

What was the problem?

https://cmake.org/cmake/help/v3.27/prop_cache/TYPE.html

By default ON/OFF is a boolean type. You will have in issues where you
have two variables with different types and you want to override one or
both of them. For example:

set(NAME "Marc Espie" CACHE STRING)
set(NAME "/home/espie" CACHE FILEPATH)

If you want to override it with ARGS (-D) you have to set the type
-DNAME:STRING="Rafael Sadowski".

Cheers,

Rafael

Reply via email to