<div dir="ltr"><div><div><div><div>Hi Alex.<br><br></div>I don't know if there is a better solution, but the following workaround should work for you:<br><br></div>In your normal CMakeList, do `file(GENERATE OUTPUT location.cmake CONTENT "set(TheLocation \"$<TARGET_FILE:TheTarget>\")\n")`.<br>Then, in the configured *.cmake script, do `include(location.cmake)`. The location of the target will then be stored in the variable `TheLocation`.<br></div><br></div><div>Alternatively, generate just the location and use `file(READ)` instead of `include()`, whichever suits you better.<br></div><div><br></div>Petr<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Sep 5, 2015 at 8:22 AM, Alex Turbov <span dir="ltr"><<a href="mailto:i.zaufi@gmail.com" target="_blank">i.zaufi@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div><div><div>Hi,<br><br></div>in my project I have `add_executable()`. after that, in a current binary dir I need to render a `*.cmake` script (via `configure_file()`) to be running from `add_test()` (as `cmake -P`) which should start just the compiled executable via `execute_process()` and capture its output (to be processed by followed commands)... <br><br></div>the problem is: how to render an absolute path to the compiled executable inside the generated `*.cmake` script ??<br></div><div>0) access to LOCATION target property is prohibited from CMakeLists.txt, so I can't set it into a generated script<br>1) generator expressions don't work w/ `configure_file()`<br><br></div><div>any other idea?<br><br><br></div></div>
<br>--<br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" 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" rel="noreferrer" 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" rel="noreferrer" target="_blank">http://public.kitware.com/mailman/listinfo/cmake</a><br></blockquote></div><br></div>