Hi! Had an issue with cmake custom commands - was able to solve it after serveral hours. But i think this is realy an issue for an improvement
I. What i wanted to do: I wanted to add a simple custom command add_custom_command( OUTPUT <out> COMMAND <mycommand> ... ) <mycommand> is a target, the path to the target is resolved perfectly by cmake for all configurations required (linux, win/jom, win/mingw, win/vs2012 ) BUT the command requires additional dlls (QT + INTELIPP). so i have to add something like add_custom_command( OUTPUT <out> COMMAND set PATH="%PATH%;${QT_BINARY_DIR};${INTELIPP_LIBRARY_DIR}" COMMAND <mycommand> ... ) and then the mess began. My issues: - For windows path handling (paths seperated by semicolon) it is a mess to set the path this way, you have to quote, escape semicolons etc - You get errors that the PATH is to long .. - The path is then set for the complete compilation process, not just for the command / dependent for the generator - handling is os specific, so you have several nearly same implementations After reading serveral threads i ended in this solution - create a batch/shell script for the command i want to start. This ensures path modifications are local. Creation is done via a configure_file step - Append the %PATH% in the batch/shell script. This avoids the mess with cmake string list coversions (splitting path into space sepearated lists) - But i now get issues with: - i must provide full path to <mycommand>, this is not resolved by cmake any more - full puth for vs is dependend on $(Outdir) or $(Configuration) that is for sure not available in the scripts - so search/replace the variables int the commands So i solved, it, but the "workload" to get into a solution here is to much, especially if you want to support the multiconfiguration environment for visual studio. Here the issue is that the configure_file is done on configuration, but the Build_type can only be determined on build and therefore the path in the script to <mycommand> must be set via arguments to the script. So it would help to have a possiblity to have a custom command like this: add_custom_command( OUTPUT <out> COMMAND .. COMMAND .. ENVIRONMENT PATH=$ENV{PATH} ENVIRONMENT LD_LIBRARY= So my questions: if i would provide such a macro how can i: - DISABLE cmake string handling in arguments to ENVIRONMENT, not just by quoting adding "" - ENSURE that the environment settings are LOCAL to the custom command Thanks for support.... -- 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