[CMake] Calling of find_package from function

2014-11-07 Thread Andrey Upadyshev
Hello! I'm writing a wrapper around find_package so I call find_package from my own function. I found it's near impossible because all the variables set by finders remain in the scope of my wrapper function, rather than in the caller's scope. Is there any way to force find_package to set all

Re: [CMake] Calling of find_package from function

2014-11-07 Thread Petr Kmoch
Hi Andrey. As a workaround, you could make the calling context a macro instead of a function. Macros don't introduce variable scope. Petr On Fri, Nov 7, 2014 at 4:23 PM, Andrey Upadyshev oli...@gmail.com wrote: Hello! I'm writing a wrapper around find_package so I call find_package from my

Re: [CMake] Calling of find_package from function

2014-11-07 Thread Andrey Upadyshev
Thank you for advice Petr! I will go with this solution if can't find another one. CMake macroses are slightly weird so I'm trying to avoid them :) On Fri, Nov 7, 2014 at 4:39 PM, Petr Kmoch petr.km...@gmail.com wrote: Hi Andrey. As a workaround, you could make the calling context a macro

Re: [CMake] Calling of find_package from function

2014-11-07 Thread Andrey Upadyshev
I've solved my problem with special macroses. First saves all non-cache variables (have to be called at the beginning of the function) and second one propagates all the changed/added variables to the parent scope (have to be called of at end of the function). If someone interested in code, it's