CMake generator expression is not being evaluated
<p>Due to the following warning:</p>

<pre><code>CMake Error at test/CMakeLists.txt:29 (get_target_property):
  The LOCATION property may not be read from target "my_exe".  Use the
  target name directly with add_custom_command, or use the generator
  expression $&lt;TARGET_FILE&gt;, as appropriate.
</code></pre>

<p>which is the result from lines like this:</p>

<pre><code>get_target_property(my_exe_path my_exe LOCATION)
</code></pre>

<p>Like recommended in the docs, I tried to use a generator expression like this:</p>

<pre><code>add_executable(my_exe_path main.cpp)
message("path to executable: $&lt;TARGET_FILE:my_exe_path&gt;")
</code></pre>

<p>But <code>TARGET_FILE</code> is not being evaluated</p>

<pre><code>path to executable: $&lt;TARGET_FILE:my_exe&gt;
</code></pre>

<p>I'm using CMake 3.4 and added <code>cmake_minimum_required(VERSION 3.4)</code> to my <code>CMakeLists.txt</code> so what am I doing wrong?</p>