CMakeBuildDoubleProjectTest.cmake 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. # create the binary directory
  2. make_directory("/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Tool/cmake-3.11.0/Tests/DoubleProject")
  3. # remove the CMakeCache.txt file from the source dir
  4. # if there is one, so that in-source cmake tests
  5. # still pass
  6. message("Remove: /opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Tool/cmake-3.11.0/Tests/DoubleProject/CMakeCache.txt")
  7. file(REMOVE "/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Tool/cmake-3.11.0/Tests/DoubleProject/CMakeCache.txt")
  8. # run cmake in the binary directory
  9. message("running: ${CMAKE_COMMAND}")
  10. execute_process(COMMAND "${CMAKE_COMMAND}"
  11. "/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Tool/cmake-3.11.0/Tests/DoubleProject"
  12. "-GUnix Makefiles"
  13. -A ""
  14. -T ""
  15. WORKING_DIRECTORY "/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Tool/cmake-3.11.0/Tests/DoubleProject"
  16. RESULT_VARIABLE RESULT)
  17. if(RESULT)
  18. message(FATAL_ERROR "Error running cmake command")
  19. endif()
  20. # Now use the --build option to build the project
  21. message("running: ${CMAKE_COMMAND} --build")
  22. execute_process(COMMAND "${CMAKE_COMMAND}"
  23. --build "/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Tool/cmake-3.11.0/Tests/DoubleProject" --config Debug
  24. RESULT_VARIABLE RESULT)
  25. if(RESULT)
  26. message(FATAL_ERROR "Error running cmake --build")
  27. endif()
  28. # run the executable out of the Debug directory if using a
  29. # multi-config generator
  30. set(_isMultiConfig 0)
  31. if(_isMultiConfig)
  32. set(RUN_TEST "/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Tool/cmake-3.11.0/Tests/DoubleProject/Debug/just_silly")
  33. else()
  34. set(RUN_TEST "/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Tool/cmake-3.11.0/Tests/DoubleProject/just_silly")
  35. endif()
  36. # run the test results
  37. message("running [${RUN_TEST}]")
  38. execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT)
  39. if(RESULT)
  40. message(FATAL_ERROR "Error running test just_silly")
  41. endif()
  42. # build it again with clean and only just_silly target
  43. execute_process(COMMAND "${CMAKE_COMMAND}"
  44. --build "/opt/ti-processor-sdk-linux-am335x-evm-04.02.00.09/EVSE/Tool/cmake-3.11.0/Tests/DoubleProject" --config Debug
  45. --clean-first --target just_silly
  46. RESULT_VARIABLE RESULT)
  47. if(RESULT)
  48. message(FATAL_ERROR "Error running cmake --build")
  49. endif()
  50. # run it again after clean
  51. execute_process(COMMAND "${RUN_TEST}" RESULT_VARIABLE RESULT)
  52. if(RESULT)
  53. message(FATAL_ERROR "Error running test just_silly after clean ")
  54. endif()