HP-UX.cmake 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136
  1. SET(CMAKE_SHARED_LIBRARY_SUFFIX ".sl") # .so
  2. SET(CMAKE_DL_LIBS "dld")
  3. SET(CMAKE_FIND_LIBRARY_SUFFIXES ".sl" ".so" ".a")
  4. SET(CMAKE_EXTRA_SHARED_LIBRARY_SUFFIXES ".so")
  5. # The HP linker needs to find transitive shared library dependencies
  6. # in the -L path. Therefore the runtime path must be added to the
  7. # link line with -L flags.
  8. SET(CMAKE_SHARED_LIBRARY_LINK_C_WITH_RUNTIME_PATH 1)
  9. SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
  10. # Shared libraries with no builtin soname may not be linked safely by
  11. # specifying the file path.
  12. SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)
  13. # fortran
  14. IF(CMAKE_COMPILER_IS_GNUG77)
  15. SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") # -pic
  16. SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-shared -Wl,-E,-b,+nodefaultrpath") # -shared
  17. SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib
  18. SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "-Wl,+b") # -rpath
  19. SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") # : or empty
  20. SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "-Wl,+h")
  21. SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "-fPIC") # -pic
  22. ELSE(CMAKE_COMPILER_IS_GNUG77)
  23. # use ld directly to create shared libraries for hp cc
  24. SET(CMAKE_Fortran_CREATE_SHARED_LIBRARY
  25. "ld <CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
  26. SET(CMAKE_SHARED_LIBRARY_Fortran_FLAGS "+Z") # -pic
  27. SET(CMAKE_SHARED_LIBRARY_CREATE_Fortran_FLAGS "-E -b -L/usr/lib") # -shared
  28. SET(CMAKE_SHARED_LIBRARY_LINK_Fortran_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib
  29. SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG "+b") # -rpath
  30. SET(CMAKE_SHARED_LIBRARY_RUNTIME_Fortran_FLAG_SEP ":") # : or empty
  31. SET(CMAKE_SHARED_LIBRARY_SONAME_Fortran_FLAG "+h")
  32. SET(CMAKE_EXECUTABLE_RUNTIME_Fortran_FLAG "-Wl,+b") # -rpath
  33. ENDIF(CMAKE_COMPILER_IS_GNUG77)
  34. # C compiler
  35. IF(CMAKE_COMPILER_IS_GNUCC)
  36. # gnu gcc
  37. SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
  38. SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-E,-b,+nodefaultrpath") # -shared
  39. SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib
  40. SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,+b") # -rpath
  41. SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
  42. SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,+h")
  43. SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC") # -pic
  44. ELSE(CMAKE_COMPILER_IS_GNUCC)
  45. # hp cc
  46. # use ld directly to create shared libraries for hp cc
  47. SET(CMAKE_C_CREATE_SHARED_LIBRARY
  48. "ld <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG><TARGET_SONAME> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
  49. SET(CMAKE_SHARED_LIBRARY_C_FLAGS "+Z") # -pic
  50. SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-E -b +nodefaultrpath -L/usr/lib") # -shared
  51. SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib
  52. SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "+b") # -rpath
  53. SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":") # : or empty
  54. SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "+h")
  55. SET(CMAKE_EXECUTABLE_RUNTIME_C_FLAG "-Wl,+b") # -rpath
  56. SET(CMAKE_C_FLAGS_INIT "")
  57. SET(CMAKE_C_COMPILE_OBJECT
  58. "<CMAKE_C_COMPILER> <DEFINES> -Aa -Ae <FLAGS> -o <OBJECT> -c <SOURCE>")
  59. ENDIF(CMAKE_COMPILER_IS_GNUCC)
  60. # CXX compiler
  61. IF(CMAKE_COMPILER_IS_GNUCXX)
  62. # for gnu C++
  63. SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
  64. SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared -Wl,-E,-b,+nodefaultrpath") # -shared
  65. SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib
  66. SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath
  67. SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") # : or empty
  68. SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC") # -pic
  69. SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,+h")
  70. ELSE(CMAKE_COMPILER_IS_GNUCXX)
  71. # for hp aCC
  72. SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "+Z") # -pic
  73. SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "+Z -Wl,-E,+nodefaultrpath -b -L/usr/lib") # -shared
  74. SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "-Wl,+s,-E,+nodefaultrpath") # +s, flag for exe link to use shared lib
  75. SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath
  76. SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":") # : or empty
  77. SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,+h")
  78. SET(CMAKE_EXECUTABLE_RUNTIME_CXX_FLAG "-Wl,+b") # -rpath
  79. SET (CMAKE_CXX_FLAGS_INIT "")
  80. SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
  81. SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "+O3 -DNDEBUG")
  82. SET (CMAKE_CXX_FLAGS_RELEASE_INIT "+O2 -DNDEBUG")
  83. SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g")
  84. ENDIF(CMAKE_COMPILER_IS_GNUCXX)
  85. # set flags for gcc support
  86. INCLUDE(Platform/UnixPaths)
  87. # Look in both 32-bit and 64-bit implict link directories, but tell
  88. # CMake not to pass the paths to the linker. The linker will find the
  89. # library for the proper architecture. In the future we should detect
  90. # which path will be used by the linker. Since the pointer type size
  91. # CMAKE_SIZEOF_VOID_P is not set until after this file executes, we
  92. # would need to append to CMAKE_SYSTEM_LIBRARY_PATH at a later point
  93. # (after CMakeTest(LANG)Compiler.cmake runs for at least one language).
  94. LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux32)
  95. LIST(APPEND CMAKE_SYSTEM_LIBRARY_PATH /usr/lib/hpux64)
  96. LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
  97. /usr/lib/hpux32 /usr/lib/hpux64)
  98. IF(NOT CMAKE_COMPILER_IS_GNUCC)
  99. SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
  100. SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
  101. ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
  102. IF(NOT CMAKE_COMPILER_IS_GNUCXX)
  103. SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
  104. SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE
  105. "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -S <SOURCE>"
  106. "mv `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.s <ASSEMBLY_SOURCE>"
  107. "rm -f `basename \"<SOURCE>\" | sed 's/\\.[^./]*$$//'`.o"
  108. )
  109. ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
  110. # Initialize C and CXX link type selection flags. These flags are
  111. # used when building a shared library, shared module, or executable
  112. # that links to other libraries to select whether to use the static or
  113. # shared versions of the libraries. Note that C modules and shared
  114. # libs are built using ld directly so we leave off the "-Wl," portion.
  115. FOREACH(type SHARED_LIBRARY SHARED_MODULE)
  116. SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-a archive")
  117. SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-a default")
  118. ENDFOREACH(type)
  119. FOREACH(type EXE)
  120. SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-a,archive")
  121. SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-a,default")
  122. ENDFOREACH(type)
  123. FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
  124. SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-a,archive")
  125. SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-a,default")
  126. ENDFOREACH(type)