Fix the build when CUDA is not present Change-Id: Ieaa483ce190ba917096c675f7ee731cb20d27bf2
diff --git a/CMakeLists.txt b/CMakeLists.txt index 82014a9..c2e1e4e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -240,7 +240,7 @@ enable_language(CUDA) else (CUDA_FOUND) message("-- Did not find CUDA library, disabling CUDA support.") - update_cache_variable(CUDA OFF) + update_cache_variable(USE_CUDA OFF) list(APPEND CERES_COMPILE_OPTIONS CERES_NO_CUDA) endif (CUDA_FOUND) else (USE_CUDA)
diff --git a/internal/ceres/CMakeLists.txt b/internal/ceres/CMakeLists.txt index ae22a9d..417652b 100644 --- a/internal/ceres/CMakeLists.txt +++ b/internal/ceres/CMakeLists.txt
@@ -7,7 +7,7 @@ # # * Redistributions of source code must retain the above copyright notice, # this list of conditions and the following disclaimer. -# * Redistributions in binary form must reproduce the above copyright notice, +# * Redistributions in binary form %Cmust reproduce the above copyright notice, # this list of conditions and the following disclaimer in the documentation # and/or other materials provided with the distribution. # * Neither the name of Google Inc. nor the names of its contributors may be @@ -140,7 +140,7 @@ list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${AccelerateSparse_LIBRARIES}) endif() -if (CUDA_FOUND) +if (USE_CUDA) list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${CUDA_LIBRARIES} @@ -161,7 +161,7 @@ add_library(ceres_cuda_kernels ceres_cuda_kernels.cu) target_compile_features(ceres_cuda_kernels PRIVATE cxx_std_14) list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ceres_cuda_kernels) -endif (CUDA_FOUND) +endif (USE_CUDA) if (LAPACK_FOUND) list(APPEND CERES_LIBRARY_PRIVATE_DEPENDENCIES ${LAPACK_LIBRARIES}) @@ -407,11 +407,13 @@ generate_export_header(ceres EXPORT_FILE_NAME ${Ceres_BINARY_DIR}/${CMAKE_INSTALL_INCLUDEDIR}/ceres/internal/export.h) -install(TARGETS ceres_cuda_kernels - EXPORT CeresExport - RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +if (USE_CUDA) + install(TARGETS ceres_cuda_kernels + EXPORT CeresExport + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) +endif(USE_CUDA) install(TARGETS ceres EXPORT CeresExport