CMake TARGET_FILE generator expression

The CMake generator expression TARGET_FILE yields the full path to a binary target file. This is useful with add_custom_command() and add_test() when a script is used as part of those commands. For CMake native commands, it’s usually not necessary to use TARGET_FILE.


add_executable(my_exe main.c)

find_package(Python COMPONENTS Interpreter REQUIRED)

add_test(NAME scripted

When using scripts it’s a good practice to also specify the full path as above.