To get the full path of a target output in a CMake managed project using the File API, the most reliable way is to check the "artifacts"
field in the target.json
. This usually includes the relative or absolute path to the built output like executables or libraries. If it's a relative path, you can safely prepend it with the paths.build
value. Avoid relying only on nameOnDisk
, as it gives just the base file name. This approach has worked well in my scripts for collecting target outputs.