CMakeLists.txt 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. cmake_minimum_required(VERSION 2.8)
  2. project(${RunCMake_TEST} NONE)
  3. include(${RunCMake_TEST}.cmake)
  4. # This CMakeLists file is *sometimes expected* to result in a configure error.
  5. #
  6. # expect this to succeed:
  7. # ../bin/Release/cmake -G Xcode
  8. # ../../CMake/Tests/CMakeCommands/build_command
  9. #
  10. # expect this to fail:
  11. # ../bin/Release/cmake -DTEST_ERROR_CONDITIONS:BOOL=ON -G Xcode
  12. # ../../CMake/Tests/CMakeCommands/build_command
  13. #
  14. # This project exists merely to test the CMake command 'build_command'...
  15. # ...even purposefully calling it with known-bad argument lists to cover
  16. # error handling code.
  17. #
  18. set(cmd "initial")
  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}'")