<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/146344>146344</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            Incorrect usage of variable in CMakeLists.txt
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            new issue
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          x12301450
      </td>
    </tr>
</table>

<pre>
    In mlir/lib/Target/LLVM/CMakeLists.txt, the variable `CUDAToolkit_LIBRARY_ROOT` is used in the following way in Line 66:

`set(MLIR_CUDAToolkit_ROOT ${CUDAToolkit_LIBRARY_ROOT})`

and like this in Line 135:

```
find_file(MLIR_NVVM_LIBDEVICE_PATH libdevice.10.bc
                PATHS ${CUDAToolkit_LIBRARY_ROOT}
 PATH_SUFFIXES "nvvm/libdevice" NO_DEFAULT_PATH REQUIRED)
```

However, when checking whether the variable is defined, it is done in the following way in Line 62:

`if(NOT DEFINED ${CUDAToolkit_LIBRARY_ROOT})`

This `if` command doesn't take effect when `CUDAToolkit_LIBRARY_ROOT` simply represent a path. I think the correct way to write it should be:

`if(NOT DEFINED CUDAToolkit_LIBRARY_ROOT)`

Looking forward to your feedback!
</pre>
<img width="1" height="1" alt="" src="http://email.email.llvm.org/o/eJyUVE1v4zYQ_TXUhViDGn05Bx2U2MIKcJLW6xjtyaDEkcWaJg2Sstf_vqC8WTgFtmkFAgKomffmzRsNd07uNWJJskeSLSI--sHY8nsMCYvTjEWtEdey0fSopCVQK9kSqDfc7tETqFer7TOB-umZH3AlnXcz_90TeKJ-QHrmVvJWISU5e3pbVBtj1EH63ap5XFfrP3fr19cNyRmVjo4OBZV6SuuNUuYi9Z5e-DVcrqRGmuckqQibTs5cYJ8_r5r17h45IFICKSkef0lYLAg8kJzdsLgWVMkDUj9I95MsTrJ7th-HVb3UYtdLhe_kL9vtc4BfLLfN03L3W7X5SpVsBZ5lh7OYzdqOsIr-4wlh3_5DnayaQnff3uq6-WMZUkCfz8ebDzcSAkBfXneLZV29rTa3CtbL39-a9XIS-lEAYdVXc8Ez2mDSZUBNuwG7w9TtAf2A9qN10lGBvdQoQoL004XR-IlZcN8-2ROYv7xu6GJZNy_Lxf9zaBOMuaHkjHbmeAyeCYNOEyg89fyAFPseO38T9Mm0OXk8qSu1eLLoUHvK6Yn7YUabMAP6MMnqjLUTIL9Sb-jFSo9BvRvMqARt8V_1_ZL-TtbKmKnrvbEXbkVguZrR0h5RtLw7EIgjUSbiIXngEZZxkcUwz4o4i4YyL-ZZFmcsyeYMujgH3uYC0h4xjds87SNZAoOM5QmLIc5imBUiFQBFLliazIt5S1KGRy7VTKnzcWbsPpLOjVjGaZ6kaaR4i8pNOwFA44VOXwlAWBG2DElf2nHvSMrU9Nf_hPHSKywb_d7A0fE9UtPfTZSmH9dFNFpVDt6fXGgq1ATqvfTD2M46M426Or-_vpys-Qu7sHmmihyB-kfJ5xL-DgAA__8ll3o_">