Darwin.cmake 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. SET(CMAKE_SHARED_LIBRARY_PREFIX "lib")
  2. SET(CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
  3. SET(CMAKE_SHARED_MODULE_PREFIX "lib")
  4. SET(CMAKE_SHARED_MODULE_SUFFIX ".so")
  5. SET(CMAKE_MODULE_EXISTS 1)
  6. SET(CMAKE_DL_LIBS "")
  7. SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib")
  8. SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle")
  9. IF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")
  10. SET(CMAKE_SHARED_MODULE_CREATE_C_FLAGS
  11. "${CMAKE_SHARED_MODULE_CREATE_C_FLAGS} -flat_namespace -undefined suppress")
  12. ENDIF("${CMAKE_BACKWARDS_COMPATIBILITY}" MATCHES "^1\\.[0-6]$")
  13. IF(CMAKE_GENERATOR_NEW)
  14. # Enable shared library versioning.
  15. SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-install_name")
  16. SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-install_name")
  17. # OSX does not really implement an rpath, but it does allow a path to
  18. # be specified in the soname field of a dylib.
  19. IF(CMAKE_SKIP_RPATH)
  20. # No rpath requested. Just use the soname directly.
  21. SET(CMAKE_C_CREATE_SHARED_LIBRARY
  22. "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG> <TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
  23. SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
  24. "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG> <TARGET_SONAME> <OBJECTS> <LINK_LIBRARIES>")
  25. ELSE(CMAKE_SKIP_RPATH)
  26. # Support for rpath is requested. Approximate it by putting the
  27. # full path to the library in the soname field. Then when executables
  28. # link the library they will copy this full path as the name to use
  29. # to find the library. We can get the directory containing the library
  30. # by using the dirname of the <TARGET>. It may be a relative path
  31. # so we use a "cd ...;pwd" trick to convert it to a full path at
  32. # build time.
  33. SET(CMAKE_C_CREATE_SHARED_LIBRARY
  34. "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <CMAKE_SHARED_LIBRARY_SONAME_C_FLAG> \"`cd \\`dirname <TARGET>\\`\;pwd`/<TARGET_SONAME>\" <OBJECTS> <LINK_LIBRARIES>")
  35. SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
  36. "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG> \"`cd \\`dirname <TARGET>\\`\;pwd`/<TARGET_SONAME>\" <OBJECTS> <LINK_LIBRARIES>")
  37. ENDIF(CMAKE_SKIP_RPATH)
  38. ELSE(CMAKE_GENERATOR_NEW)
  39. SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
  40. "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
  41. SET(CMAKE_C_CREATE_SHARED_LIBRARY
  42. "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
  43. ENDIF(CMAKE_GENERATOR_NEW)
  44. SET(CMAKE_CXX_CREATE_SHARED_MODULE
  45. "<CMAKE_CXX_COMPILER> <CMAKE_SHARED_MODULE_CREATE_CXX_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
  46. SET(CMAKE_C_CREATE_SHARED_MODULE
  47. "<CMAKE_C_COMPILER> <CMAKE_SHARED_MODULE_CREATE_C_FLAGS> <LINK_FLAGS> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
  48. SET(CMAKE_PLATFORM_IMPLICIT_INCLUDE_DIRECTORIES /usr/local/include)