On 11-Aug-15 07:49, James Johnston wrote:
I have found it annoyingly difficult to set up an environment for a build
when using ExternalProject_Add.

I can confirm that there is an additional mess with the environment sometimes and not just about setting it (like vcvarsall.bat for Visual Studio) but with *un*setting them too. In short environment variables for the ExternalProject_Add are not the same as a user's environment. I've found myself some problems with Xcode which add tons of new variables but there are even cases for Makefiles (e.g. stackoverflow.com/questions/25160405/). I will not say it's an "annoying" thing for me but if there will be some mechanism to control it (better globally or even something "from the box") ExternalProject_Add code can be simplified. I'm personally using next patterns:

    CONFIGURE_COMMAND
"@MSVC_VCVARSALL@""@MSVC_ARCH@" # Set Visual Studio environment
    COMMAND
    ... # real configure command (like bootstrap.bat or configure.bat)


    BUILD_COMMAND
    . /path/to/clear-all.sh && make # run make in a clean environment
   INSTALL_COMMAND
   . /path/to/clear-all.sh && make install # same for make install

    include(/path/to/clear-all.cmake)
execute_process(COMMAND make @make_params@ ...) # run make in a clean environment

Cheers, Ruslo
--

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-developers

Reply via email to