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