llvm.org GIT mirror llvm / a2a3583
[CMake] add_llvm_symbol_exports: Use Python oneliner instead of "cmd.exe /c type" to generate *.def. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@241402 91177308-0d34-0410-b5e6-96231b3b80d8 NAKAMURA Takumi 4 years ago
1 changed file(s) with 2 addition(s) and 13 deletion(s). Raw diff Collapse all Expand all
9292 else()
9393 set(native_export_file "${target_name}.def")
9494
95 set(CAT "cat")
96 set(export_file_nativeslashes ${export_file})
97 if(WIN32 AND NOT CYGWIN AND NOT MSYS)
98 set(CAT "type")
99 # Convert ${export_file} to native format (backslashes) for "type"
100 # Does not use file(TO_NATIVE_PATH) as it doesn't create a native
101 # path but a build-system specific format (see CMake bug
102 # http://public.kitware.com/Bug/print_bug_page.php?bug_id=5939 )
103 string(REPLACE / \\ export_file_nativeslashes ${export_file})
104 endif()
105
10695 add_custom_command(OUTPUT ${native_export_file}
107 COMMAND ${CMAKE_COMMAND} -E echo "EXPORTS" > ${native_export_file}
108 COMMAND ${CAT} ${export_file_nativeslashes} >> ${native_export_file}
96 COMMAND ${PYTHON_EXECUTABLE} -c "import sys;print(''.join(['EXPORTS\\n']+sys.stdin.readlines(),))"
97 < ${export_file} > ${native_export_file}
10998 DEPENDS ${export_file}
11099 VERBATIM
111100 COMMENT "Creating export file for ${target_name}")