TryRun.cmake 633 B

123456789101112131415161718192021
  1. enable_language(C)
  2. set(CMAKE_CROSSCOMPILING 1)
  3. set(ENV{PSEUDO_EMULATOR_FAIL} 1)
  4. try_run(run_result compile_result
  5. ${CMAKE_CURRENT_BINARY_DIR}
  6. ${CMAKE_CURRENT_SOURCE_DIR}/simple_src_exiterror.c
  7. RUN_OUTPUT_VARIABLE run_output)
  8. message(STATUS "run_output: ${run_output}")
  9. message(STATUS "run_result: ${run_result}")
  10. set(CMAKE_CROSSCOMPILING_EMULATOR ${CMAKE_CROSSCOMPILING_EMULATOR}
  11. --flag
  12. "multi arg")
  13. try_run(run_result compile_result
  14. ${CMAKE_CURRENT_BINARY_DIR}
  15. ${CMAKE_CURRENT_SOURCE_DIR}/simple_src_exiterror.c
  16. RUN_OUTPUT_VARIABLE run_output)
  17. message(STATUS "Emulator with arguments run_output: ${run_output}")