CMake with two C++ compilers

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

CMake with two C++ compilers

JR Cary
Is there a standard way to deal with 2 C++ compilers?  Getting both
there versions, etc.?

I need one compiler for compiling ordinary C++ code and a different
one to use as the host compiler for CUDA.

Thx......John Cary
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Hex
Reply | Threaded
Open this post in threaded view
|

Re: CMake with two C++ compilers

Hex
set the compiler for each build:

set(COMPILER /opt/gcc/bin)
cmake_force_c_compiler(  "${COMPILER}gcc" GNU)
cmake_force_cxx_compiler("${COMPILER}g++" GNU)



--
Sent from: http://cmake.3232098.n2.nabble.com/
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake with two C++ compilers

Sergei Nikulov
In reply to this post by JR Cary
ср, 8 мая 2019 г. в 14:27, JR Cary <[hidden email]>:
>
> Is there a standard way to deal with 2 C++ compilers?  Getting both
> there versions, etc.?
>
> I need one compiler for compiling ordinary C++ code and a different
> one to use as the host compiler for CUDA.
>
> Thx......John Cary

Here is the exact answer to your question
https://devblogs.nvidia.com/building-cuda-applications-cmake/


--
Best Regards,
Sergei Nikulov
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake with two C++ compilers

CMake mailing list
In reply to this post by JR Cary
Hi John,
Two different compilers in the same project for the same language is messy, but in your case it's directly supproted as a special case for cuda using the CMAKE_CUDA_HOST_COMPILER CMake variable or the CUDAHOSTCXX environment variable.

----------
Chuck Atkins
Staff R&D Engineer, Scientific Computing
Kitware, Inc.


On Wed, May 8, 2019 at 7:27 AM JR Cary <[hidden email]> wrote:
Is there a standard way to deal with 2 C++ compilers?  Getting both
there versions, etc.?

I need one compiler for compiling ordinary C++ code and a different
one to use as the host compiler for CUDA.

Thx......John Cary
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake with two C++ compilers

JR Cary
Thanks, Chuck.

I was not clear on my question, which is:  When I specify the two compilers, how
do I get, e.g., CMAKE_CUDA_HOST_COMPILER_ID and CMAKE_CUDA_HOST_COMPILER_VERSION?

I need these to determine consistency between the CUDA version and the host compiler
version, so that I can disable CUDA when these are incmpatible.

Thanks...John

On 5/10/19 9:17 AM, Chuck Atkins wrote:
Hi John,
Two different compilers in the same project for the same language is messy, but in your case it's directly supproted as a special case for cuda using the CMAKE_CUDA_HOST_COMPILER CMake variable or the CUDAHOSTCXX environment variable.

----------
Chuck Atkins
Staff R&D Engineer, Scientific Computing
Kitware, Inc.


On Wed, May 8, 2019 at 7:27 AM JR Cary <[hidden email]> wrote:
Is there a standard way to deal with 2 C++ compilers?  Getting both
there versions, etc.?

I need one compiler for compiling ordinary C++ code and a different
one to use as the host compiler for CUDA.

Thx......John Cary
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake


--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake
Reply | Threaded
Open this post in threaded view
|

Re: CMake with two C++ compilers

CMake mailing list
Currently we don't provide the compiler id and version for the CUDA
host compiler.

If you are interested in having this information can you please create
an issue on the cmake gitlab: https://gitlab.kitware.com/cmake/cmake

On Fri, May 10, 2019 at 12:09 PM JR Cary <[hidden email]> wrote:

>
> Thanks, Chuck.
>
> I was not clear on my question, which is:  When I specify the two compilers, how
> do I get, e.g., CMAKE_CUDA_HOST_COMPILER_ID and CMAKE_CUDA_HOST_COMPILER_VERSION?
>
> I need these to determine consistency between the CUDA version and the host compiler
> version, so that I can disable CUDA when these are incmpatible.
>
> Thanks...John
>
> On 5/10/19 9:17 AM, Chuck Atkins wrote:
>
> Hi John,
> Two different compilers in the same project for the same language is messy, but in your case it's directly supproted as a special case for cuda using the CMAKE_CUDA_HOST_COMPILER CMake variable or the CUDAHOSTCXX environment variable.
>
> ----------
> Chuck Atkins
> Staff R&D Engineer, Scientific Computing
> Kitware, Inc.
>
>
> On Wed, May 8, 2019 at 7:27 AM JR Cary <[hidden email]> wrote:
>>
>> Is there a standard way to deal with 2 C++ compilers?  Getting both
>> there versions, etc.?
>>
>> I need one compiler for compiling ordinary C++ code and a different
>> one to use as the host compiler for CUDA.
>>
>> Thx......John Cary
>> --
>>
>> Powered by www.kitware.com
>>
>> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>>
>> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>>
>> CMake Support: http://cmake.org/cmake/help/support.html
>> CMake Consulting: http://cmake.org/cmake/help/consulting.html
>> CMake Training Courses: http://cmake.org/cmake/help/training.html
>>
>> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>>
>> Follow this link to subscribe/unsubscribe:
>> https://cmake.org/mailman/listinfo/cmake
>
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> https://cmake.org/mailman/listinfo/cmake
--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake