CMakeLists.txt 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. # This CMakeLists file is *sometimes expected* to result in a configure error.
  2. #
  3. # expect this to succeed:
  4. # ../bin/Release/cmake -G Xcode
  5. # ../../CMake/Tests/CMakeCommands/build_command
  6. #
  7. # expect this to fail:
  8. # ../bin/Release/cmake -DTEST_ERROR_CONDITIONS:BOOL=ON -G Xcode
  9. # ../../CMake/Tests/CMakeCommands/build_command
  10. #
  11. # This project exists merely to test the CMake command 'build_command'...
  12. # ...even purposefully calling it with known-bad argument lists to cover
  13. # error handling code.
  14. #
  15. cmake_minimum_required(VERSION 2.8)
  16. project(test_build_command)
  17. set(cmd "initial")
  18. message("CTEST_FULL_OUTPUT")
  19. message("0. begin")
  20. if(TEST_ERROR_CONDITIONS)
  21. # Test with no arguments (an error):
  22. build_command()
  23. message("1. cmd='${cmd}'")
  24. # Test with unknown arguments (also an error):
  25. build_command(cmd BOGUS STUFF)
  26. message("2. cmd='${cmd}'")
  27. build_command(cmd STUFF BOGUS)
  28. message("3. cmd='${cmd}'")
  29. else()
  30. message("(skipping cases 1, 2 and 3 because TEST_ERROR_CONDITIONS is OFF)")
  31. endif()
  32. # Test the one arg signature with none of the optional KEYWORD arguments:
  33. build_command(cmd)
  34. message("4. cmd='${cmd}'")
  35. # Test the two-arg legacy signature:
  36. build_command(legacy_cmd ${CMAKE_BUILD_TOOL})
  37. message("5. legacy_cmd='${legacy_cmd}'")
  38. message(" CMAKE_BUILD_TOOL='${CMAKE_BUILD_TOOL}'")
  39. # Test the optional KEYWORDs:
  40. build_command(cmd CONFIGURATION hoohaaConfig)
  41. message("6. cmd='${cmd}'")
  42. build_command(cmd PROJECT_NAME hoohaaProject)
  43. message("7. cmd='${cmd}'")
  44. build_command(cmd TARGET hoohaaTarget)
  45. message("8. cmd='${cmd}'")
  46. set(cmd "final")
  47. message("9. cmd='${cmd}'")