Windows-Borland.cmake 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  1. #=============================================================================
  2. # Copyright 2002-2009 Kitware, Inc.
  3. #
  4. # Distributed under the OSI-approved BSD License (the "License");
  5. # see accompanying file Copyright.txt for details.
  6. #
  7. # This software is distributed WITHOUT ANY WARRANTY; without even the
  8. # implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  9. # See the License for more information.
  10. #=============================================================================
  11. # (To distribute this file outside of CMake, substitute the full
  12. # License text for the above reference.)
  13. # This module is shared by multiple languages; use include blocker.
  14. if(__WINDOWS_BORLAND)
  15. return()
  16. endif()
  17. set(__WINDOWS_BORLAND 1)
  18. SET(BORLAND 1)
  19. # Borland target type flags (bcc32 -h -t):
  20. # -tW GUI App (implies -U__CONSOLE__)
  21. # -tWC Console App (implies -D__CONSOLE__=1)
  22. # -tWD Build a DLL (implies -D__DLL__=1 -D_DLL=1)
  23. # -tWM Enable threads (implies -D__MT__=1 -D_MT=1)
  24. # -tWR Use DLL runtime (implies -D_RTLDLL, and '-tW' too!!)
  25. #
  26. # Notes:
  27. # - The flags affect linking so we pass them to the linker.
  28. # - The flags affect preprocessing so we pass them to the compiler.
  29. # - Since '-tWR' implies '-tW' we use '-tWR -tW-' instead.
  30. # - Since '-tW-' disables '-tWD' we use '-tWR -tW- -tWD' for DLLs.
  31. set(_RTLDLL "-tWR -tW-")
  32. set(_COMPILE_C "-c")
  33. set(_COMPILE_CXX "-P -c")
  34. SET(CMAKE_LIBRARY_PATH_FLAG "-L")
  35. SET(CMAKE_LINK_LIBRARY_FLAG "")
  36. SET(CMAKE_FIND_LIBRARY_SUFFIXES "-bcc.lib" ".lib")
  37. # uncomment these out to debug makefiles
  38. #SET(CMAKE_START_TEMP_FILE "")
  39. #SET(CMAKE_END_TEMP_FILE "")
  40. #SET(CMAKE_VERBOSE_MAKEFILE 1)
  41. # Borland cannot handle + in the file name, so mangle object file name
  42. SET (CMAKE_MANGLE_OBJECT_FILE_NAMES "ON")
  43. # extra flags for a win32 exe
  44. SET(CMAKE_CREATE_WIN32_EXE "-tW" )
  45. # extra flags for a console app
  46. SET(CMAKE_CREATE_CONSOLE_EXE "-tWC" )
  47. SET (CMAKE_BUILD_TYPE Debug CACHE STRING
  48. "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel.")
  49. SET (CMAKE_EXE_LINKER_FLAGS_INIT "-tWM -lS:10000000 -lSc:10000000 ")
  50. SET (CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT "-v")
  51. SET (CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT "-v")
  52. SET (CMAKE_SHARED_LINKER_FLAGS_INIT ${CMAKE_EXE_LINKER_FLAGS_INIT})
  53. SET (CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT ${CMAKE_EXE_LINKER_FLAGS_DEBUG_INIT})
  54. SET (CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO_INIT})
  55. SET (CMAKE_MODULE_LINKER_FLAGS_INIT ${CMAKE_SHARED_LINKER_FLAGS_INIT})
  56. SET (CMAKE_MODULE_LINKER_FLAGS_DEBUG_INIT ${CMAKE_SHARED_LINKER_FLAGS_DEBUG_INIT})
  57. SET (CMAKE_MODULE_LINKER_FLAGS_RELWITHDEBINFO_INIT ${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO_INIT})
  58. macro(__borland_language lang)
  59. set(CMAKE_SHARED_LIBRARY_${lang}_FLAGS "-tWD")
  60. # compile a source file into an object file
  61. # place <DEFINES> outside the response file because Borland refuses
  62. # to parse quotes from the response file.
  63. set(CMAKE_${lang}_COMPILE_OBJECT
  64. "<CMAKE_${lang}_COMPILER> ${_RTLDLL} <DEFINES> ${CMAKE_START_TEMP_FILE}-DWIN32 -o<OBJECT> <FLAGS> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}"
  65. )
  66. set(CMAKE_${lang}_LINK_EXECUTABLE
  67. "<CMAKE_${lang}_COMPILER> ${_RTLDLL} -e<TARGET> ${CMAKE_START_TEMP_FILE}<LINK_FLAGS> <FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}"
  68. # "implib -c -w <TARGET_IMPLIB> <TARGET>"
  69. )
  70. # place <DEFINES> outside the response file because Borland refuses
  71. # to parse quotes from the response file.
  72. set(CMAKE_${lang}_CREATE_PREPROCESSED_SOURCE
  73. "cpp32 <DEFINES> ${CMAKE_START_TEMP_FILE}-DWIN32 <FLAGS> -o<PREPROCESSED_SOURCE> ${_COMPILE_${lang}} <SOURCE>${CMAKE_END_TEMP_FILE}"
  74. )
  75. # Borland >= 5.6 allows -P option for cpp32, <= 5.5 does not
  76. # Create a module library.
  77. set(CMAKE_${lang}_CREATE_SHARED_MODULE
  78. "<CMAKE_${lang}_COMPILER> ${_RTLDLL} -tWD ${CMAKE_START_TEMP_FILE}-e<TARGET> <LINK_FLAGS> <LINK_LIBRARIES> <OBJECTS>${CMAKE_END_TEMP_FILE}"
  79. )
  80. # Create an import library for another target.
  81. set(CMAKE_${lang}_CREATE_IMPORT_LIBRARY
  82. "implib -c -w <TARGET_IMPLIB> <TARGET>"
  83. )
  84. # Create a shared library.
  85. # First create a module and then its import library.
  86. set(CMAKE_${lang}_CREATE_SHARED_LIBRARY
  87. ${CMAKE_${lang}_CREATE_SHARED_MODULE}
  88. ${CMAKE_${lang}_CREATE_IMPORT_LIBRARY}
  89. )
  90. # create a static library
  91. set(CMAKE_${lang}_CREATE_STATIC_LIBRARY
  92. "tlib ${CMAKE_START_TEMP_FILE}/p512 <LINK_FLAGS> /a <TARGET_QUOTED> <OBJECTS>${CMAKE_END_TEMP_FILE}"
  93. )
  94. # Initial configuration flags.
  95. set(CMAKE_${lang}_FLAGS_INIT "-tWM")
  96. set(CMAKE_${lang}_FLAGS_DEBUG_INIT "-Od -v")
  97. set(CMAKE_${lang}_FLAGS_MINSIZEREL_INIT "-O1 -DNDEBUG")
  98. set(CMAKE_${lang}_FLAGS_RELEASE_INIT "-O2 -DNDEBUG")
  99. set(CMAKE_${lang}_FLAGS_RELWITHDEBINFO_INIT "-Od")
  100. set(CMAKE_${lang}_STANDARD_LIBRARIES_INIT "import32.lib")
  101. endmacro()