Re: [CMake] Calling of find_package from function
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 here https://gist.github.com/oliora/4961727299ed67337aba Andrey On Fri, Nov 7, 2014 at 4:56 PM, Andrey Upadyshev wrote: > 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 wrote: > >> 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 >> wrote: >> >>> 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 variables >>> in my function caller's scope? I.e. something like find_package(... >>> PARENT_SCOPE)? >>> >>> Thank you, >>> Andrey >>> >>> -- >>> >>> Powered by www.kitware.com >>> >>> Please keep messages on-topic and check the CMake FAQ at: >>> http://www.cmake.org/Wiki/CMake_FAQ >>> >>> Kitware offers various services to support the CMake community. For more >>> information on each offering, please visit: >>> >>> CMake Support: http://cmake.org/cmake/help/support.html >>> CMake Consulting: http://cmake.org/cmake/help/consulting.html >>> CMake Training Courses: http://cmake.org/cmake/help/training.html >>> >>> Visit other Kitware open-source projects at >>> http://www.kitware.com/opensource/opensource.html >>> >>> Follow this link to subscribe/unsubscribe: >>> http://public.kitware.com/mailman/listinfo/cmake >>> >> >> > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Calling of find_package from function
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 wrote: > 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 wrote: > >> 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 variables >> in my function caller's scope? I.e. something like find_package(... >> PARENT_SCOPE)? >> >> Thank you, >> Andrey >> >> -- >> >> Powered by www.kitware.com >> >> Please keep messages on-topic and check the CMake FAQ at: >> http://www.cmake.org/Wiki/CMake_FAQ >> >> Kitware offers various services to support the CMake community. For more >> information on each offering, please visit: >> >> CMake Support: http://cmake.org/cmake/help/support.html >> CMake Consulting: http://cmake.org/cmake/help/consulting.html >> CMake Training Courses: http://cmake.org/cmake/help/training.html >> >> Visit other Kitware open-source projects at >> http://www.kitware.com/opensource/opensource.html >> >> Follow this link to subscribe/unsubscribe: >> http://public.kitware.com/mailman/listinfo/cmake >> > > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] Calling of find_package from function
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 variables in my function caller's scope? I.e. something like find_package(... PARENT_SCOPE)? Thank you, Andrey -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
Re: [CMake] Windows XP + CMake + VS2013
Hi Stefan, You should add CMake command option *-T vc120_xp* BR, Andrey Upadyshev On Sun, Dec 8, 2013 at 7:22 PM, Stefan Fendt wrote: > Hi, > > I'm using CMake 2.8.12 together with MSVC 2013 and need to produce a > binary which is (still) compatible with Windows XP SP3. > If I'm right, then I need to change the compiler toolchain to 120_xp to > make this work (I get the message that the binary isn't a valid > WIN32-application on the XP machine otherwise). How am I supposed to tell > CMake to use this compiler toolchain? > > With best regards, > Stefan > > -- > Diese Nachricht wurde von meinem Android-Mobiltelefon mit K-9 Mail > gesendet. > -- > > Powered by www.kitware.com > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Kitware offers various services to support the CMake community. For more > information on each offering, please visit: > > CMake Support: http://cmake.org/cmake/help/support.html > CMake Consulting: http://cmake.org/cmake/help/consulting.html > CMake Training Courses: http://cmake.org/cmake/help/training.html > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake > -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake