1 IF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
2 SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-PIC")
3 SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared -Wl,-r")
4 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R")
5 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
6 SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h")
7 SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h")
8 ENDIF(CMAKE_SYSTEM MATCHES "SunOS-4.*")
10 IF(CMAKE_SYSTEM MATCHES "SunOS-5.*")
11 SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-KPIC")
12 SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-G")
13 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-R")
14 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
15 SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-h")
16 SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-h")
17 SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-KPIC")
18 SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-G")
19 SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-R")
20 SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":")
21 IF(CMAKE_COMPILER_IS_GNUCC)
22 SET(CMAKE_SHARED_LIBRARY_C_FLAGS "-fPIC")
23 SET(CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-shared")
24 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG "-Wl,-R")
25 SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP ":")
26 SET(CMAKE_SHARED_LIBRARY_SONAME_C_FLAG "-Wl,-h")
27 ELSE(CMAKE_COMPILER_IS_GNUCC)
28 SET (CMAKE_C_FLAGS_INIT "")
29 SET (CMAKE_C_FLAGS_DEBUG_INIT "-g")
30 SET (CMAKE_C_FLAGS_MINSIZEREL_INIT "-xO3 -DNDEBUG")
31 SET (CMAKE_C_FLAGS_RELEASE_INIT "-xO2 -DNDEBUG")
32 SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-xO2")
33 ENDIF(CMAKE_COMPILER_IS_GNUCC)
34 IF(CMAKE_COMPILER_IS_GNUCXX)
35 SET(CMAKE_SHARED_LIBRARY_CXX_FLAGS "-fPIC")
36 SET(CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS "-shared")
37 SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG "-Wl,-R")
38 SET(CMAKE_SHARED_LIBRARY_RUNTIME_CXX_FLAG_SEP ":")
39 SET(CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG "-Wl,-h")
40 ELSE(CMAKE_COMPILER_IS_GNUCXX)
41 SET (CMAKE_CXX_FLAGS_INIT "")
42 SET (CMAKE_CXX_FLAGS_DEBUG_INIT "-g")
43 SET (CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-xO3 -DNDEBUG")
44 SET (CMAKE_CXX_FLAGS_RELEASE_INIT "-xO2 -DNDEBUG")
45 SET (CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-xO2")
46 ENDIF(CMAKE_COMPILER_IS_GNUCXX)
47 ENDIF(CMAKE_SYSTEM MATCHES "SunOS-5.*")
49 IF(CMAKE_COMPILER_IS_GNUCXX)
50 IF(CMAKE_COMPILER_IS_GNUCC)
51 SET(CMAKE_CXX_CREATE_SHARED_LIBRARY
52 "<CMAKE_C_COMPILER> <CMAKE_SHARED_LIBRARY_CXX_FLAGS> <LINK_FLAGS> <CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS> <CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG><TARGET_SONAME> -o <TARGET> <OBJECTS> <LINK_LIBRARIES>")
53 ELSE(CMAKE_COMPILER_IS_GNUCC)
54 # Take default rule from CMakeDefaultMakeRuleVariables.cmake.
55 ENDIF(CMAKE_COMPILER_IS_GNUCC)
56 ELSE(CMAKE_COMPILER_IS_GNUCXX)
57 IF(CMAKE_CXX_COMPILER)
58 SET(CMAKE_CXX_CREATE_STATIC_LIBRARY
59 "<CMAKE_CXX_COMPILER> -xar -o <TARGET> <OBJECTS> "
60 "<CMAKE_RANLIB> <TARGET> ")
61 ENDIF(CMAKE_CXX_COMPILER)
62 ENDIF(CMAKE_COMPILER_IS_GNUCXX)
63 INCLUDE(Platform/UnixPaths)
65 # Add the compiler's implicit link directories.
66 IF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro)
67 LIST(APPEND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES
68 /opt/SUNWspro/lib /opt/SUNWspro/prod/lib /usr/ccs/lib)
69 ENDIF("${CMAKE_C_COMPILER_ID} ${CMAKE_CXX_COMPILER_ID}" MATCHES SunPro)
71 IF(NOT CMAKE_COMPILER_IS_GNUCC)
72 SET (CMAKE_C_CREATE_PREPROCESSED_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
73 SET (CMAKE_C_CREATE_ASSEMBLY_SOURCE "<CMAKE_C_COMPILER> <DEFINES> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
74 ENDIF(NOT CMAKE_COMPILER_IS_GNUCC)
76 IF(NOT CMAKE_COMPILER_IS_GNUCXX)
77 SET (CMAKE_CXX_CREATE_PREPROCESSED_SOURCE "<CMAKE_CXX_COMPILER> <DEFINES> <FLAGS> -E <SOURCE> > <PREPROCESSED_SOURCE>")
78 SET (CMAKE_CXX_CREATE_ASSEMBLY_SOURCE "<CMAKE_CXX_COMPILER> <FLAGS> -S <SOURCE> -o <ASSEMBLY_SOURCE>")
79 ENDIF(NOT CMAKE_COMPILER_IS_GNUCXX)
81 # Initialize C link type selection flags. These flags are used when
82 # building a shared library, shared module, or executable that links
83 # to other libraries to select whether to use the static or shared
84 # versions of the libraries.
85 IF(CMAKE_COMPILER_IS_GNUCC)
86 FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
87 SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Wl,-Bstatic")
88 SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Wl,-Bdynamic")
90 ELSE(CMAKE_COMPILER_IS_GNUCC)
91 FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
92 SET(CMAKE_${type}_LINK_STATIC_C_FLAGS "-Bstatic")
93 SET(CMAKE_${type}_LINK_DYNAMIC_C_FLAGS "-Bdynamic")
95 ENDIF(CMAKE_COMPILER_IS_GNUCC)
96 IF(CMAKE_COMPILER_IS_GNUCXX)
97 FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
98 SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Wl,-Bstatic")
99 SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Wl,-Bdynamic")
101 ELSE(CMAKE_COMPILER_IS_GNUCXX)
102 FOREACH(type SHARED_LIBRARY SHARED_MODULE EXE)
103 SET(CMAKE_${type}_LINK_STATIC_CXX_FLAGS "-Bstatic")
104 SET(CMAKE_${type}_LINK_DYNAMIC_CXX_FLAGS "-Bdynamic")
106 ENDIF(CMAKE_COMPILER_IS_GNUCXX)
108 # The Sun linker needs to find transitive shared library dependencies
110 SET(CMAKE_LINK_DEPENDENT_LIBRARY_DIRS 1)
112 # Shared libraries with no builtin soname may not be linked safely by
113 # specifying the file path.
114 SET(CMAKE_PLATFORM_USES_PATH_WHEN_NO_SONAME 1)