Index: cmake/modules/AddLLVM.cmake =================================================================== --- cmake/modules/AddLLVM.cmake +++ cmake/modules/AddLLVM.cmake @@ -88,11 +88,14 @@ set(CAT "type") if(CYGWIN) set(CAT "cat") + else() + # Convert ${export_file} to native format (backslashes) for "type" + # Does not use file(TO_NATIVE_PATH) as it doesn't create a native + # path but a build-system specific format (see CMake bug + # http://public.kitware.com/Bug/print_bug_page.php?bug_id=5939 ) + string(REPLACE / \\ export_file_backslashes ${export_file}) endif() - # Using ${export_file} in add_custom_command directly confuses cmd.exe. - file(TO_NATIVE_PATH ${export_file} export_file_backslashes) - add_custom_command(OUTPUT ${native_export_file} COMMAND ${CMAKE_COMMAND} -E echo "EXPORTS" > ${native_export_file} COMMAND ${CAT} ${export_file_backslashes} >> ${native_export_file}