Skip to content

Commit

Permalink
Use execute_process() instead
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleFromNVIDIA committed Feb 7, 2024
1 parent dd465ca commit 69ddc60
Showing 1 changed file with 19 additions and 6 deletions.
25 changes: 19 additions & 6 deletions rapids-cmake/test/generate_resource_spec.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,27 @@ function(rapids_test_generate_resource_spec DESTINATION filepath)
set(compiler "${CMAKE_CUDA_COMPILER}")
endif()

try_compile(result PROJECT
generate_resource_spec SOURCE_DIR
"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/detail/generate_resource_spec"
CMAKE_FLAGS "-DCMAKE_CXX_COMPILER=${compiler}"
execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" -S
"${CMAKE_CURRENT_FUNCTION_LIST_DIR}/detail/generate_resource_spec" -B
"${PROJECT_BINARY_DIR}/rapids-cmake/generate_resource_spec-build"
"-DCMAKE_CXX_COMPILER=${compiler}"
"-DCUDAToolkit_ROOT=${CUDAToolkit_ROOT}" "-Doutput_file=${eval_exe}"
OUTPUT_VARIABLE compile_output)
OUTPUT_VARIABLE compile_output
ERROR_VARIABLE compile_output
RESULT_VARIABLE result)
if(NOT result EQUAL 0)
string(REPLACE "\n" "\n " compile_output "${compile_output}")
message(FATAL_ERROR "rapids_test_generate_resource_spec failed to build detection executable.\nfailure details are:\n ${compile_output}"
)
endif()

if(NOT result)
execute_process(COMMAND ${CMAKE_COMMAND} --build
"${PROJECT_BINARY_DIR}/rapids-cmake/generate_resource_spec-build"
--config Release
OUTPUT_VARIABLE compile_output
ERROR_VARIABLE compile_output
RESULT_VARIABLE result)
if(NOT result EQUAL 0)
string(REPLACE "\n" "\n " compile_output "${compile_output}")
message(FATAL_ERROR "rapids_test_generate_resource_spec failed to build detection executable.\nfailure details are:\n ${compile_output}"
)
Expand Down

0 comments on commit 69ddc60

Please sign in to comment.