On Tue, Mar 6, 2012 at 6:27 PM, Andreas Pakulat <[email protected]> wrote: > On 06.03.12 17:56:41, David Cole wrote: >> If you want add_custom_command to run a certain executable, simply >> give it the full path to that executable: use "/full/path/to/tool" >> instead of "tool" >> >> If tool is a built thing, you can use >> "${XYZ_BINARY_DIR}/${CMAKE_CFG_INTDIR}/tool" which will properly >> expand out to the correct "Release" or "Debug" subdirectory when run >> with Visual Studio or Xcode. > > Thats not what the cmake manual states: > If COMMAND specifies an executable target (created by ADD_EXECUTABLE) it > will automatā ically be replaced by the location of the executable > created at build time. > > So either the manual is wrong and one needs to manually construct the > correct paths even for in-project targets or cmake should prefer an > existing target over an executable reachable via PATH. > > Andreas > > -- > > Powered by www.kitware.com > > Visit other Kitware open-source projects at > http://www.kitware.com/opensource/opensource.html > > Please keep messages on-topic and check the CMake FAQ at: > http://www.cmake.org/Wiki/CMake_FAQ > > Follow this link to subscribe/unsubscribe: > http://www.cmake.org/mailman/listinfo/cmake
The manual is correct. But so was my earlier reply. I am not aware of a general problem where CMake gets confused by a target named something the same as an executable in your PATH... That should be ok, and CMake should prefer its own target, and generate build instructions using the full path name of the built target. My technique simply specifies, explicitly in the CMake code, which full path name to use for the custom command. I always find that the most useful technique for resolving possible name conflicts. Either should work, assuming "tool" is the name of a CMake target that you have built. If there is still a problem, please specify a minimal example that we can run to reproduce it, and I'm sure somebody here will help figure out what's going on. Thx, David -- Powered by www.kitware.com Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Follow this link to subscribe/unsubscribe: http://www.cmake.org/mailman/listinfo/cmake
