diff options
author | Thomas Bernard <tbernard@go-engineering.de> | 2020-01-14 10:31:34 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-02-04 13:19:12 (GMT) |
commit | 1c2d031cbdbf28f99ef36e5db5e4d9de1b97fff9 (patch) | |
tree | b987d5cf32bdf9b094f830e0e7c91112709301c8 /Tests/RunCMake | |
parent | 5f04dfe57ebf1abee29101228844ebaa721356a2 (diff) | |
download | CMake-1c2d031cbdbf28f99ef36e5db5e4d9de1b97fff9.zip CMake-1c2d031cbdbf28f99ef36e5db5e4d9de1b97fff9.tar.gz CMake-1c2d031cbdbf28f99ef36e5db5e4d9de1b97fff9.tar.bz2 |
Add -E cmake_llvm_rc to preprocess files for llvm-rc
llvm-rc requires preprocessed rc files. The CMake command line tool
cmake_llvm_rc enables channing the preprocessor call and the resource
compiler and make this appear as single compilation step.
When llvm-rc is detected as resource compiler, the RC compilation step
is set to use this command.
Diffstat (limited to 'Tests/RunCMake')
9 files changed, 38 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index 4bdc759..087ef21 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -667,3 +667,33 @@ if(CMAKE_HOST_UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "CYGWIN") run_cmake_command(closed_stderr sh -c "\"${CMAKE_COMMAND}\" --version 2>&-") run_cmake_command(closed_stdall sh -c "\"${CMAKE_COMMAND}\" --version <&- >&- 2>&-") endif() + +function(run_llvm_rc) + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/llvm_rc-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + + run_cmake_command(llvm_rc_no_args ${CMAKE_COMMAND} -E cmake_llvm_rc) + run_cmake_command(llvm_rc_no_-- ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test") + run_cmake_command(llvm_rc_empty_preprocessor ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp -- ${CMAKE_COMMAND} -E echo "This is a test") + run_cmake_command(llvm_rc_failing_first_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E false -- ${CMAKE_COMMAND} -E echo "This is a test") + run_cmake_command(llvm_rc_failing_second_command ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -E false ) + if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp) + message(SEND_ERROR "${test} - FAILED:\n" + "test.tmp was not deleted") + endif() + run_cmake_command(llvm_rc_full_run ${CMAKE_COMMAND} -E cmake_llvm_rc test.tmp ${CMAKE_COMMAND} -E echo "This is a test" -- ${CMAKE_COMMAND} -E copy test.tmp llvmrc.result ) + if(EXISTS ${RunCMake_TEST_BINARY_DIR}/test.tmp) + message(SEND_ERROR "${test} - FAILED:\n" + "test.tmp was not deleted") + endif() + file(READ ${RunCMake_TEST_BINARY_DIR}/llvmrc.result LLVMRC_RESULT) + if(NOT "${LLVMRC_RESULT}" STREQUAL "This is a test\n") + message(SEND_ERROR "${test} - FAILED:\n" + "llvmrc.result was not created") + endif() + # file(REMOVE ${RunCMake_TEST_BINARY_DIR}/llvmrc.result) + unset(LLVMRC_RESULT) +endfunction() +run_llvm_rc() diff --git a/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-result.txt b/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-stderr.txt b/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-stderr.txt new file mode 100644 index 0000000..cb69366 --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_empty_preprocessor-stderr.txt @@ -0,0 +1 @@ +Empty preprocessing command diff --git a/Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-result.txt b/Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_failing_first_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-result.txt b/Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_failing_second_command-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_no_---result.txt b/Tests/RunCMake/CommandLine/llvm_rc_no_---result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_no_---result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_no_---stderr.txt b/Tests/RunCMake/CommandLine/llvm_rc_no_---stderr.txt new file mode 100644 index 0000000..9c140b7 --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_no_---stderr.txt @@ -0,0 +1 @@ +Empty resource compilation command diff --git a/Tests/RunCMake/CommandLine/llvm_rc_no_args-result.txt b/Tests/RunCMake/CommandLine/llvm_rc_no_args-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_no_args-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/CommandLine/llvm_rc_no_args-stderr.txt b/Tests/RunCMake/CommandLine/llvm_rc_no_args-stderr.txt new file mode 100644 index 0000000..d66b547 --- /dev/null +++ b/Tests/RunCMake/CommandLine/llvm_rc_no_args-stderr.txt @@ -0,0 +1 @@ +Invalid cmake_llvm_rc arguments |