Hello, I have a project with a few dependencies (Qt, opencv, aravis, etc) and I would like to add some sources in CUDA.
Here is a minimal example: cmake_minimum_required(VERSION 3.0) project(myproject CXX CUDA) find_package(Qt5 REQUIRED COMPONENTS Core) add_executable(mytarget main.cpp gpu.cu) target_link_libraries(mytarget PUBLIC Qt5::Core) The previous example gives the following output [ 25%] Building CUDA object CMakeFiles/mytarget.dir/gpu.cu.o nvcc fatal : Unknown option 'fPIC' make[2]: *** [CMakeFiles/mytarget.dir/build.make:76: CMakeFiles/mytarget.dir/gpu.cu.o] Error 1 make[1]: *** [CMakeFiles/Makefile2:73: CMakeFiles/mytarget.dir/all] Error 2 make: *** [Makefile:84: all] Error 2 I would get the same problem if I replace target_link_libraries with set_target_properties(mytarget PROPERTIES COMPILE_OPTIONS -pthread) Does anyone know why I get this error? Am I doing it rightly? Is it a bug? Sincerely, Victor ML -- 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