[CMake] function and raise_scope commands

Ken Martin ken.martin at kitware.com
Mon Dec 10 16:14:01 EST 2007


Thanks for the information. Both these issues I suspect are fairly simple
bugs and will be fixed. 

Thanks
Ken

> 1. CMake crashes if I use the same variable name as the argument and
> raise the scope later. That is, for the following function:
> 
> function(track_find_variable cache_variable is_changed)
>   raise_scope(${is_changed})
> endfunction(track_find_variable)
> 
> I can't call it like:
> 
> track_find_variable(testvar is_changed) # I had to mangle is_changed
> above, but that's ok
> 
> I think it shouldn't crash. If its too much effort to have cmake
> support this, then I don't think it is worth it... just having a note
> that the argument can't be used as a variable name in the help and
> maybe try to detect the case and signal an error...
> 
> 2. Given the new scope contexts, when I call the following function:
> 
> function(tester)
>   message(STATUS "${CMAKE_CURRENT_LIST_FILE}")
> endfunction(tester)
> 
> tester() prints what it should:
> D:/builds/temp/testLatexModule/CMakeLists.txt
> 
> However, if I put it in a cmake_utils.cmake file and call
> include(cmake_utils):
> 
> tester() prints garbage... somehow it gets corrupted. For example, in




More information about the CMake mailing list