Skip to content

Commit

Permalink
throw an error if cuda is enabled AND CMAKE_CUDA_HOST_COMPILER is not…
Browse files Browse the repository at this point in the history
… set priot to enabling CUDA.
  • Loading branch information
rrsettgast committed Nov 20, 2018
1 parent b356086 commit 8e35132
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions cmake/thirdparty/SetupCUDA.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,20 @@
set (CMAKE_MODULE_PATH "${BLT_ROOT_DIR}/cmake/thirdparty;${CMAKE_MODULE_PATH}")




if( ${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.9.0" )

get_property(LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES)

if ( NOT CMAKE_CUDA_HOST_COMPILER )

if("CUDA" IN_LIST LANGUAGES )
message( FATAL_ERROR
"CUDA Enabled prior to setting CMAKE_CUDA_HOST_COMPILER. Please set \
CMAKE_CUDA_HOST_COMPILER prior to ENABLE_LANGUAGE(CUDA) or PROJECT(.. LANGUAGES CUDA) ")
endif()

if ( CMAKE_CXX_COMPILER )
set ( CMAKE_CUDA_HOST_COMPILER ${CMAKE_CXX_COMPILER} CACHE STRING "" FORCE)
else ()
Expand Down

0 comments on commit 8e35132

Please sign in to comment.