summaryrefslogtreecommitdiff
path: root/Modules/Platform/GNUtoMS_lib.cmake
diff options
context:
space:
mode:
Diffstat (limited to 'Modules/Platform/GNUtoMS_lib.cmake')
-rw-r--r--Modules/Platform/GNUtoMS_lib.cmake10
1 files changed, 10 insertions, 0 deletions
diff --git a/Modules/Platform/GNUtoMS_lib.cmake b/Modules/Platform/GNUtoMS_lib.cmake
new file mode 100644
index 000000000..ca9b0f8da
--- /dev/null
+++ b/Modules/Platform/GNUtoMS_lib.cmake
@@ -0,0 +1,10 @@
+# Usage: cmake -Dlib=lib.bat -Ddef=out.def -Ddll=out.dll -Dimp=out.dll.a -P GNUtoMS_lib.cmake
+get_filename_component(name ${dll} NAME) # .dll file name
+string(REGEX REPLACE "\\.dll\\.a$" ".lib" out "${imp}") # .dll.a -> .lib
+execute_process(
+ COMMAND ${lib} /def:${def} /name:${name} /out:${out}
+ RESULT_VARIABLE res
+ )
+if(res)
+ message(FATAL_ERROR "lib failed: ${res}")
+endif()