GNUtoMS_lib.cmake 383 B

12345678910
  1. # Usage: cmake -Dlib=lib.bat -Ddef=out.def -Ddll=out.dll -Dimp=out.dll.a -P GNUtoMS_lib.cmake
  2. get_filename_component(name ${dll} NAME) # .dll file name
  3. string(REGEX REPLACE "\\.dll\\.a$" ".lib" out "${imp}") # .dll.a -> .lib
  4. execute_process(
  5. COMMAND ${lib} /def:${def} /name:${name} /out:${out}
  6. RESULT_VARIABLE res
  7. )
  8. if(res)
  9. message(FATAL_ERROR "lib failed: ${res}")
  10. endif()