You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Compilation fails when using CMake and pybind11_add_module for project containing CUDA code. The -flto flag is passed to NVCC and causes the following output: nvcc fatal : Unknown option 'flto'
Reproducible example code
In CMakeLists.txt:
cmake_minimum_required(VERSION 3.14)
project(projectname LANGUAGES CXX CUDA)
find_package(pybind11 REQUIRED)
Issue description
Compilation fails when using CMake and pybind11_add_module for project containing CUDA code. The -flto flag is passed to NVCC and causes the following output:
nvcc fatal : Unknown option 'flto'
Reproducible example code
In CMakeLists.txt:
cmake_minimum_required(VERSION 3.14)
project(projectname LANGUAGES CXX CUDA)
find_package(pybind11 REQUIRED)
pybind11_add_module(modulename src/cpp_source.cpp src/cuda_source.cu)
Possible solution
In
pybind11/tools/pybind11Tools.cmake
, line 104:-use
$<$<COMPILE_LANGUAGE:CXX>:
to set the flag only for GCC-pass it to nvcc as
-Xcompiler=-flto
The text was updated successfully, but these errors were encountered: