<div dir="ltr">Hi Lars,<div><br></div><div>What if you provide the working directory to <span style="font-family:arial,sans-serif;font-size:13px">ADD_CUSTOM_COMMAND like this:</span></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div><div><div style><font face="arial, sans-serif">    add_custom_command(</font></div><div style><font face="arial, sans-serif">    OUTPUT <output></font></div><div style><font face="arial, sans-serif">    COMMAND command_to_be_executed <arg_1> <arg_2></font></div><div style><font face="arial, sans-serif">    DEPENDS ${lib1} ${lib2}</font></div><div style><font face="arial, sans-serif">    WORKING_DIRECTORY ${EXECUTABLE_OUTPUT_PATH}</font></div><div style><font face="arial, sans-serif">    VERBATIM)</font></div></div><div style><font face="arial, sans-serif"><br></font></div><div style><font face="arial, sans-serif">Would it work?</font></div><div style><font face="arial, sans-serif"><br></font></div><div style><font face="arial, sans-serif">Otherwise a trick (more like a hack) like the following might be useful:</font></div><div style><font face="arial, sans-serif"><br></font></div><div style><font face="arial, sans-serif"><div>    add_custom_command(</div><div>    OUTPUT <output></div><div>    COMMAND PATH=$ENV{PATH}:<more_paths> ENVIRONMENT_VAR=<some_other_value> && command_to_be_executed <arg_1> <arg_2></div><div>    DEPENDS <dependency_1> <dependency_2></div><div>    WORKING_DIRECTORY <working_dir></div><div>    VERBATIM)</div><div><br></div><div>This sets the PATH temporarily during the execution of the command, where you could possibly add the paths to the libraries you need. You can set more environment variables as well.</div><div><br></div><div>Cheers!</div><div>Angeliki</div></font></div><div><span style="font-family:arial,sans-serif;font-size:13px"><br></span></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Nov 19, 2014 at 11:14 AM, Lars <span dir="ltr"><<a href="mailto:laasunde@hotmail.com" target="_blank">laasunde@hotmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">


<div><div dir="ltr">


<div dir="ltr"> The below example build "App" and copies it to EXECUTABLE_OUTPUT_PATH.<br>ADD_EXECUTABLE(App ${source})<br>TARGET_LINK_LIBRARIES(App ${lib1} ${lib2})<br>INSTALL(TARGETS App ..)</div><div dir="ltr"><br>The top level CMakeLists.txt has install directives for lib1 and lib2<br>INSTALL(FILES ${lib1}/bin/lib1.dll DESTINATION ...)<br>INSTALL(FILES ${lib2}/bin/lib2.dll DESTINATION ...)<br></div><div dir="ltr">Later in the build process we would like to use "App"<br>ADD_CUSTOM_COMMAND(OUTPUT "${src} COMMAND App ...)</div><div dir="ltr"><br>The ADD_CUSTOM_COMMAND command currently fails because lib1 and lib2 are not present in EXECUTABLE_OUTPUT_PATH.</div><div dir="ltr"><br>The following solutions work but are not desirable approaches:<br> - Copying the necessary files to EXECUTABLE_OUTPUT_PATH via ADD_CUSTOM_COMMAND. This would be repeating top level install directives at target level.<br> - Update "path" environment variable to include paths to lib1 and lib2 libraries.<br></div><div dir="ltr">What other options are available using CMake? Does ADD_CUSTOM_COMMAND have a way to update path environment prior to executing a command?<br> <br></div>
                                          </div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="http://cmake.org/cmake/help/support.html" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://public.kitware.com/mailman/listinfo/cmake" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>