# No such file or directory at configure time

**URL:** <https://discourse.cmake.org/t/no-such-file-or-directory-at-configure-time/1749>\
**Category:** Code\
**Created:** [August 26, 2020, 1:29pm UTC](https://discourse.cmake.org/t/no-such-file-or-directory-at-configure-time/1749 "2020-08-26T13:29:04Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![hex](https://discourse.cmake.org/user_avatar/discourse.cmake.org/hex/32/363_2.png) [@hex](https://discourse.cmake.org/u/hex)\
**Post date:** [August 26, 2020, 1:29pm UTC](https://discourse.cmake.org/t/no-such-file-or-directory-at-configure-time/1749/1 "2020-08-26T13:29:04Z")

</div>

**Problem:** execution of imported target returns a `No such file or directory` message.

```cmake
find_package( Python3 )

if( Python3_FOUND )
	execute_process(
		COMMAND Python3::Interpreter --version
		RESULT_VARIABLE res
		OUTPUT_VARIABLE out
	)
	message( "this message: ${res}" )
endif()

```

results in: `this message: No such file or directory`

The package is found correctly and its targets are accessible during build. It is just that, `execute_process` does not seem to have access to it.

My first thought was that `execute_process` does not have this target during configuration because it might be run before the package is found. This is why I added the `_FOUND` condition. I thought it would then run correctly in a second iteration at configure time. It did not.

I cannot see the call to python anywhere in my verbose build output.

everything works fine using the cache variable, instead of the target:

````cmake
```cmake
find_package( Python3 )

if( Python3_FOUND )
	execute_process(
		COMMAND ${Python3_EXECUTABLE} --version
		RESULT_VARIABLE res
		OUTPUT_VARIABLE out
	)
	message( "this message: ${res}" )
endif()

````

This confirms that configure stage works as expected. It seems as if there was a problem with the imported target during configuration. Generally speaking, this shouldn’t be a problem, though.

---

<div class="post-metadata">

**Author:** ![marc.chevrier](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/m/ecb155/32.png) [@marc.chevrier](https://discourse.cmake.org/u/marc.chevrier)\
**Post date:** [August 26, 2020, 1:36pm UTC](https://discourse.cmake.org/t/no-such-file-or-directory-at-configure-time/1749/2 "2020-08-26T13:36:51Z")

</div>

`execute_process` does not support targets in the `COMMAND` option.
