[CMake] Change compiler for certain files in the project

Aaron Boxer boxerab at gmail.com
Mon Oct 30 21:34:38 EDT 2017


On Sat, Oct 28, 2017 at 11:22 AM, P F <pfultz2 at yahoo.com> wrote:

>
> > On Oct 28, 2017, at 9:50 AM, Aaron Boxer <boxerab at gmail.com> wrote:
> >
> > Hello,
> >
> > I have a cmake project on linux, and I would like to change the compiler
> > for certain files from g++ to  another, llvm-based compiler called hcc.
> > (hcc is AMDs HIP compiler for GPGPU)
> >
> >
> > Is there a way of doing this in my cmake file ?
>
> There isn’t a simple way to do that. The FindCUDA and FindHIP cmake
> modules do that, but its not at all easy to follow, and brings its own set
> of issues.
>
> Of course, why do you need to use g++ to compile host code? Being
> clang-based hcc should be able to compile any g++ code. So you can just use
> hcc as the compiler for everything and then link with the `hccrt` cmake
> target(provided by `find_package(hcc)`) which will enable GPU compiling
> when you want to compile code for the device.
>

Yes, I just might do that. I didn't realize there was a find_package for
hcc.  So, how would I set hcc as the compiler for everything ?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20171030/eb8eb3d5/attachment.html>


More information about the CMake mailing list