[CMake] Question about functions

Andreas Naumann Andreas-Naumann at gmx.net
Mon Feb 18 15:16:05 EST 2019


Am 18.02.19 um 20:43 schrieb Workbench at gmx.at:
> Hi everyone,
>
> i have a function like:
>
> FUNCTION(checksyste_64Bit arg1)
>
>     IF(CMAKE_SIZEOF_VOID_P EQUAL 8)
>
>         SET(${arg1} TRUE PARENT_SCOPE)
>
> ENDFUNCTION()
>
>
> but when i call it with an INTERNAL variable i've set before with
>
> SET(SYSTEM_64BIT FALSE CACHE INTERNAL)
>
> checksystem_64bit(${SYSTEM_64BIT})
>
> the ${SYSTE_64BIT} variable stays the same, i thought when i use 
> PARENT_SCOPE on a variable i can change it's value from inside the 
> function ?
>
>
> best regards!
>
You should call your function without dollar and braces around the 
variable, i.e.

   checksystem_64bit(SYSTEM_64BIT)



More information about the CMake mailing list