SunPro-CXX.cmake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. set(CMAKE_CXX_VERBOSE_FLAG "-v")
  2. set(CMAKE_CXX_COMPILE_OPTIONS_PIC -KPIC)
  3. set(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC")
  4. set(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G")
  5. set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R")
  6. set(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":")
  7. set(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h")
  8. set(CMAKE_CXX_FLAGS_INIT "")
  9. set(CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
  10. set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO2 -xspace -DNDEBUG")
  11. set(CMAKE_CXX_FLAGS_RELEASE_INIT "-xO3 -DNDEBUG")
  12. set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-g -xO2 -DNDEBUG")
  13. # Initialize C link type selection flags. These flags are used when
  14. # building a shared library, shared module, or executable that links
  15. # to other libraries to select whether to use the static or shared
  16. # versions of the libraries.
  17. foreach(type SHARED_LIBRARY SHARED_MODULE EXE)
  18. set(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Bstatic")
  19. set(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic")
  20. endforeach()
  21. set(CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
  22. set(CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
  23. # Create archives with "CC -xar" in case user adds "-instances=extern"
  24. # so that template instantiations are available to archive members.
  25. set(CMAKE_CXX_CREATE_STATIC_LIBRARY
  26. "<CMAKE_CXX_COMPILER> -xar -o <TARGET> <OBJECTS> "
  27. "<CMAKE_RANLIB> <TARGET> ")
  28. if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
  29. set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
  30. set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=c++11")
  31. endif()
  32. if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
  33. set(CMAKE_CXX_STANDARD_DEFAULT 98)
  34. endif()
  35. macro(cmake_record_cxx_compile_features)
  36. macro(_get_solaris_studio_features std_version list)
  37. record_compiler_features(CXX "${std_version}" ${list})
  38. endmacro()
  39. set(_result 0)
  40. if (NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.13)
  41. _get_solaris_studio_features(${CMAKE_CXX11_STANDARD_COMPILE_OPTION} CMAKE_CXX11_COMPILE_FEATURES)
  42. if (_result EQUAL 0)
  43. _get_solaris_studio_features("" CMAKE_CXX98_COMPILE_FEATURES)
  44. endif()
  45. endif()
  46. endmacro()