diff options
author | Brad King <brad.king@kitware.com> | 2015-04-03 15:15:12 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-04-03 17:04:57 (GMT) |
commit | af924827120f39f1a7a940bc3f6bc487665145d9 (patch) | |
tree | cc0512810a6bbc3f79c5fc179ce151c20bcbaaec /Tests/RunCMake | |
parent | e46224a7cdbcbbfce63f21096bf2b4a5f01c3c13 (diff) | |
download | CMake-af924827120f39f1a7a940bc3f6bc487665145d9.zip CMake-af924827120f39f1a7a940bc3f6bc487665145d9.tar.gz CMake-af924827120f39f1a7a940bc3f6bc487665145d9.tar.bz2 |
Makefile: Tolerate a BOM while scanning source dependencies (#15493)
Otherwise an #include directive on the first line of a source file is
ignored if the file contains a Byte-Order-Mark.
Suggested-by: Aleksey Konovalov <konovalov.aleks@gmail.com>
Diffstat (limited to 'Tests/RunCMake')
-rw-r--r-- | Tests/RunCMake/CommandLine/RunCMakeTest.cmake | 26 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/cmake_depends-check.cmake | 13 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/cmake_depends-stdout.txt | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/cmake_depends/test.c | 2 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/cmake_depends/test.h | 1 | ||||
-rw-r--r-- | Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h | bin | 0 -> 58 bytes |
6 files changed, 43 insertions, 0 deletions
diff --git a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake index a9c49e7..e8b4584 100644 --- a/Tests/RunCMake/CommandLine/RunCMakeTest.cmake +++ b/Tests/RunCMake/CommandLine/RunCMakeTest.cmake @@ -80,3 +80,29 @@ run_cmake(D_nested_cache) set(RunCMake_TEST_OPTIONS "-DFOO:STRING=-DBAR:BOOL=BAZ") run_cmake(D_typed_nested_cache) + +function(run_cmake_depends) + set(RunCMake_TEST_SOURCE_DIR "${RunCMake_SOURCE_DIR}/cmake_depends") + set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/cmake_depends-build") + set(RunCMake_TEST_NO_CLEAN 1) + file(REMOVE_RECURSE "${RunCMake_TEST_BINARY_DIR}") + file(MAKE_DIRECTORY "${RunCMake_TEST_BINARY_DIR}") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake" " +set(CMAKE_DEPENDS_LANGUAGES \"C\") +set(CMAKE_DEPENDS_CHECK_C + \"${RunCMake_TEST_SOURCE_DIR}/test.c\" + \"${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/test.c.o\" + ) +") + file(WRITE "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/CMakeDirectoryInformation.cmake" " +set(CMAKE_RELATIVE_PATH_TOP_SOURCE \"${RunCMake_TEST_SOURCE_DIR}\") +set(CMAKE_RELATIVE_PATH_TOP_BINARY \"${RunCMake_TEST_BINARY_DIR}\") +") + run_cmake_command(cmake_depends ${CMAKE_COMMAND} -E cmake_depends + "Unix Makefiles" + ${RunCMake_TEST_SOURCE_DIR} ${RunCMake_TEST_SOURCE_DIR} + ${RunCMake_TEST_BINARY_DIR} ${RunCMake_TEST_BINARY_DIR} + ${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/DependInfo.cmake + ) +endfunction() +run_cmake_depends() diff --git a/Tests/RunCMake/CommandLine/cmake_depends-check.cmake b/Tests/RunCMake/CommandLine/cmake_depends-check.cmake new file mode 100644 index 0000000..031478b --- /dev/null +++ b/Tests/RunCMake/CommandLine/cmake_depends-check.cmake @@ -0,0 +1,13 @@ +set(depend_make "${RunCMake_TEST_BINARY_DIR}/CMakeFiles/DepTarget.dir/depend.make") +if(EXISTS "${depend_make}") + file(READ "${depend_make}" depend_make_content) + string(REGEX REPLACE "\n+$" "" depend_make_content "${depend_make_content}") + if(NOT depend_make_content MATCHES " +CMakeFiles/DepTarget.dir/test.c.o: .*/Tests/RunCMake/CommandLine/cmake_depends/test.c +CMakeFiles/DepTarget.dir/test.c.o: .*/Tests/RunCMake/CommandLine/cmake_depends/test.h$") + string(REPLACE "\n" "\n " depend_make_content " ${depend_make_content}") + set(RunCMake_TEST_FAILED "depend.make does not have expected content:\n${depend_make_content}") + endif() +else() + set(RunCMake_TEST_FAILED "depend.make missing:\n ${depend_make}") +endif() diff --git a/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt new file mode 100644 index 0000000..8fe092b --- /dev/null +++ b/Tests/RunCMake/CommandLine/cmake_depends-stdout.txt @@ -0,0 +1 @@ +^Scanning dependencies of target DepTarget$ diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test.c b/Tests/RunCMake/CommandLine/cmake_depends/test.c new file mode 100644 index 0000000..92c056f --- /dev/null +++ b/Tests/RunCMake/CommandLine/cmake_depends/test.c @@ -0,0 +1,2 @@ +#include "test.h" +#include "test_UTF-16LE.h" diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test.h b/Tests/RunCMake/CommandLine/cmake_depends/test.h new file mode 100644 index 0000000..fd87388 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cmake_depends/test.h @@ -0,0 +1 @@ +void test(void) {} diff --git a/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h b/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h Binary files differnew file mode 100644 index 0000000..bf56ec6 --- /dev/null +++ b/Tests/RunCMake/CommandLine/cmake_depends/test_UTF-16LE.h |