Hi, I have bug for you…
The following code, an exported ‘return’ value set by a function and assigned to a second variable within the main scope results in the second variable not being set.
function( GetProjectID )
set( RET0 “MYPROJECT” )
set( RET0 “${RET0}” PARENT_SCOPE )
endfunction()
GetProjectID()
set( MYPROJECTNAME, “${RET0}” )
message( “PROJECT_ID: ${RET0}” )
message( “PROJECT_ID: ${MYPROJECTNAME}” )
Note that the second instance of ‘Message(PROJECT_ID…’) doesn’t display the variable as it has no value (proof: removing the prefix string results in an explicit script error relating to the use of a variable with no value).
This is with CMake version 3.20.21032501-MSVC_2 (the current Visual Studio 2019 CMake)