diff options
author | Brad King <brad.king@kitware.com> | 2013-07-15 13:33:32 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2013-07-15 13:33:32 (GMT) |
commit | f6024ef420103c4cb393d7752f7e110c5e0d5dfe (patch) | |
tree | e7c12ecc29f108e275e7212ccf7c267069d2662e /Tests | |
parent | c0fe24e53969450273eb08aa6e6b615563847c9b (diff) | |
parent | c28715b16c7a71cd8ea0416277cc87ee9bc8eaa1 (diff) | |
download | CMake-f6024ef420103c4cb393d7752f7e110c5e0d5dfe.zip CMake-f6024ef420103c4cb393d7752f7e110c5e0d5dfe.tar.gz CMake-f6024ef420103c4cb393d7752f7e110c5e0d5dfe.tar.bz2 |
Merge topic 'try_compile-COPY_FILE_ERROR'
c28715b try_compile: Add COPY_FILE_ERROR option to capture failure
Diffstat (limited to 'Tests')
8 files changed, 33 insertions, 0 deletions
diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-result.txt b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt new file mode 100644 index 0000000..5d09c0c --- /dev/null +++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at CopyFileErrorNoCopyFile.cmake:1 \(try_compile\): + COPY_FILE_ERROR may be used only with COPY_FILE +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake new file mode 100644 index 0000000..8d7cb0e --- /dev/null +++ b/Tests/RunCMake/try_compile/CopyFileErrorNoCopyFile.cmake @@ -0,0 +1,2 @@ +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE_ERROR _copied) diff --git a/Tests/RunCMake/try_compile/NoCopyFileError-result.txt b/Tests/RunCMake/try_compile/NoCopyFileError-result.txt new file mode 100644 index 0000000..d00491f --- /dev/null +++ b/Tests/RunCMake/try_compile/NoCopyFileError-result.txt @@ -0,0 +1 @@ +1 diff --git a/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt new file mode 100644 index 0000000..ed552fd --- /dev/null +++ b/Tests/RunCMake/try_compile/NoCopyFileError-stderr.txt @@ -0,0 +1,4 @@ +CMake Error at NoCopyFileError.cmake:1 \(try_compile\): + COPY_FILE_ERROR must be followed by a variable name +Call Stack \(most recent call first\): + CMakeLists.txt:3 \(include\) diff --git a/Tests/RunCMake/try_compile/NoCopyFileError.cmake b/Tests/RunCMake/try_compile/NoCopyFileError.cmake new file mode 100644 index 0000000..d4d69ee --- /dev/null +++ b/Tests/RunCMake/try_compile/NoCopyFileError.cmake @@ -0,0 +1,2 @@ +try_compile(RESULT ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src.c + COPY_FILE ${CMAKE_CURRENT_BINARY_DIR}/copied.bin COPY_FILE_ERROR) diff --git a/Tests/RunCMake/try_compile/RunCMakeTest.cmake b/Tests/RunCMake/try_compile/RunCMakeTest.cmake index 3494695..c934458 100644 --- a/Tests/RunCMake/try_compile/RunCMakeTest.cmake +++ b/Tests/RunCMake/try_compile/RunCMakeTest.cmake @@ -1,10 +1,12 @@ include(RunCMake) +run_cmake(CopyFileErrorNoCopyFile) run_cmake(NoArgs) run_cmake(OneArg) run_cmake(TwoArgs) run_cmake(NoCopyFile) run_cmake(NoCopyFile2) +run_cmake(NoCopyFileError) run_cmake(NoOutputVariable) run_cmake(NoOutputVariable2) run_cmake(NoSources) diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt index 7b25e84..a4d9490 100644 --- a/Tests/TryCompile/CMakeLists.txt +++ b/Tests/TryCompile/CMakeLists.txt @@ -44,6 +44,23 @@ else() file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass") endif() +# try to compile a file that should compile +# also check that COPY_FILE_ERROR works +file(WRITE ${TryCompile_BINARY_DIR}/invalid "") +try_compile(SHOULD_PASS + ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp + ${TryCompile_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT + COPY_FILE ${TryCompile_BINARY_DIR}/invalid/path + COPY_FILE_ERROR _captured + ) +if(NOT SHOULD_PASS) + message(SEND_ERROR "should pass failed ${TRY_OUT}") +endif() +if(NOT _captured MATCHES "Cannot copy output executable.*/invalid/path") + message(SEND_ERROR "COPY_FILE_ERROR did not capture expected message") +endif() + # try to compile a file that should not compile try_compile(SHOULD_FAIL ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp |