[CMake] Running executables - local targets vs. system binaries

Andreas Pakulat apaku at gmx.de
Tue Mar 6 18:27:20 EST 2012


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



More information about the CMake mailing list