Windows-gcc.cmake 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. SET(CMAKE_LINK_LIBRARY_SUFFIX "")
  2. SET(CMAKE_STATIC_LIBRARY_PREFIX "lib")
  3. SET(CMAKE_STATIC_LIBRARY_SUFFIX ".a")
  4. SET(CMAKE_SHARED_LIBRARY_PREFIX "lib") # lib
  5. SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dll") # .so
  6. SET(CMAKE_SHARED_MODULE_PREFIX "lib") # lib
  7. SET(CMAKE_SHARED_MODULE_SUFFIX ".dll") # .so
  8. SET(CMAKE_IMPORT_LIBRARY_PREFIX "lib")
  9. SET(CMAKE_IMPORT_LIBRARY_SUFFIX ".dll.a")
  10. SET(CMAKE_EXECUTABLE_SUFFIX ".exe") # .exe
  11. SET(CMAKE_DL_LIBS "")
  12. SET(CMAKE_SHARED_LIBRARY_C_FLAGS "") # -pic
  13. SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "") # -pic
  14. SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared") # -shared
  15. SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") # +s, flag for exe link to use shared lib
  16. SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "") # -rpath
  17. SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP "") # : or empty
  18. SET(CMAKE_SHARED_MODULE_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}") # -pic
  19. SET(CMAKE_SHARED_MODULE_CXX_FLAGS
  20. "${CMAKE_SHARED_LIBRARY_CXX_FLAGS}") # -pic
  21. SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
  22. "${CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS}") # -shared
  23. SET(CMAKE_LIBRARY_PATH_FLAG "-L")
  24. SET(CMAKE_LINK_LIBRARY_FLAG "-l")
  25. SET(CMAKE_EXTRA_LINK_EXTENSIONS ".lib") # MinGW can also link to a MS .lib
  26. SET(CMAKE_CREATE_WIN32_EXE "-mwindows")
  27. IF(MINGW)
  28. SET(CMAKE_FIND_LIBRARY_PREFIXES "lib" "")
  29. SET(CMAKE_FIND_LIBRARY_SUFFIXES ".dll" ".dll.a" ".a" ".lib")
  30. ENDIF(MINGW)
  31. SET(CMAKE_GNULD_IMAGE_VERSION
  32. "-Wl,--major-image-version,<TARGET_VERSION_MAJOR>,--minor-image-version,<TARGET_VERSION_MINOR>")
  33. SET(CMAKE_C_CREATE_SHARED_MODULE
  34. "<CMAKE_C_COMPILER> <CMAKE_SHARED_MODULE_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
  35. SET(CMAKE_CXX_CREATE_SHARED_MODULE
  36. "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_MODULE_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> -o <TARGET> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
  37. SET(CMAKE_C_CREATE_SHARED_LIBRARY
  38. "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_C_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
  39. SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
  40. "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <OBJECTS> <LINK_LIBRARIES>")
  41. SET(CMAKE_C_LINK_EXECUTABLE
  42. "<CMAKE_C_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
  43. SET(CMAKE_CXX_LINK_EXECUTABLE
  44. "<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> -Wl,--out-implib,<TARGET_IMPLIB> ${CMAKE_GNULD_IMAGE_VERSION} <LINK_LIBRARIES>")
  45. # Initialize C link type selection flags. These flags are used when
  46. # building a shared library, shared module, or executable that links
  47. # to other libraries to select whether to use the static or shared
  48. # versions of the libraries.
  49. IF(MSYS OR MINGW)
  50. FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
  51. SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
  52. SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
  53. ENDFOREACH(type)
  54. ENDIF(MSYS OR MINGW)
  55. # Create archiving rules to support large object file lists for static
  56. # libraries.
  57. IF(MSYS OR MINGW)
  58. SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> cr <TARGET> <LINK_FLAGS> <OBJECTS>")
  59. SET(CMAKE_C_ARCHIVE_APPEND "<CMAKE_AR> r <TARGET> <LINK_FLAGS> <OBJECTS>")
  60. SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> <TARGET>")
  61. SET(CMAKE_CXX_ARCHIVE_CREATE ${CMAKE_C_ARCHIVE_CREATE})
  62. SET(CMAKE_CXX_ARCHIVE_APPEND ${CMAKE_C_ARCHIVE_APPEND})
  63. SET(CMAKE_CXX_ARCHIVE_FINISH ${CMAKE_C_ARCHIVE_FINISH})
  64. ENDIF(MSYS OR MINGW)