Re: [CMake] file(SHA1) vs string(SHA1) consistency
Hello, 2016-02-25 17:58 GMT+03:00 Ruslan Baratov via CMake: > * since CMake is a cross-platform tool I think it make sense that command > `file(WRITE "..." "a\nb")` produce identical files on all platforms Seconded; READ and WRITE could at least have a BINARY flag that does it so that I don't have to reimplement 'cat' for each platform... Best regards, -- DoubleF -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake
[CMake] file(SHA1) vs string(SHA1) consistency
Hi, Following code produce same SHA1 on Linux: cmake_minimum_required(VERSION 3.0) set(test_string "a\nb") set(test_file "test.file") string(SHA1 sha1_string "${test_string}") file(WRITE "${test_file}" "${test_string}") file(SHA1 "${test_file}" sha1_file) message("sha1:") message(" ${sha1_file}") message(" ${sha1_string}") result: sha1: fcd127ffa1016069006ad91f3f361248f9bdf272 fcd127ffa1016069006ad91f3f361248f9bdf272 but not same SHA1 on Windows: sha1: ec6cb5b8c69f8b476a380c9b6e38e18c2733ae7b fcd127ffa1016069006ad91f3f361248f9bdf272 I think this is because of DOS end of lines. Two thoughts: * file(SHA1) and string(SHA1) should be the same on same input string * since CMake is a cross-platform tool I think it make sense that command `file(WRITE "..." "a\nb")` produce identical files on all platforms -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake