Hi,<br><br>I noticed gcc is used to link a c++ library on SunOS due to Sun shipping GCC without a shared libstdc++ in the past (see discussion <a href="http://www.cmake.org/pipermail/cmake/2006-August/010535.html">http://www.cmake.org/pipermail/cmake/2006-August/010535.html</a> here). Since this does not seem to be the case anymore, changing the CMAKE_CXX_CREATE_SHARED_LIBRARY rule on new projects in vain becomes a nuisance as using gcc to invoke the linker has problems; missing options g++ tells the linker e.g. when profiling and maybe static initialization issues as well. So, could we check if libstdc++.so is present and if so, use the default rule from CMakeDefaultMakeRuleVariables.cmake file instead. I made a small patch to Modules/Platform/SunOS.cmake that does exatcly that:<br>
<br>--- SunOS.cmake.orig    2011-07-07 11:21:22.331321841 +0800<br>+++ SunOS.cmake    2011-07-07 11:21:27.149332933 +0800<br>@@ -5,12 +5,20 @@<br>    SET(CMAKE_SHARED_LIBRARY_RUNTIME_C_FLAG_SEP &quot;:&quot;)  <br> ENDIF(CMAKE_SYSTEM MATCHES &quot;SunOS-4.*&quot;)<br>
 <br>+# Take the default c++ shared library creation rule from the<br>+# CMakeDefaultMakeRuleVariables.cmake file unless using GCC and libstdc++.so<br>+# does not exist, in which case fall back to the old implementation;<br>
+# using gcc to invoke the linker.<br> IF(CMAKE_COMPILER_IS_GNUCXX)<br>   IF(CMAKE_COMPILER_IS_GNUCC)<br>-    SET(CMAKE_CXX_CREATE_SHARED_LIBRARY<br>-        &quot;&lt;CMAKE_C_COMPILER&gt; &lt;CMAKE_SHARED_LIBRARY_CXX_FLAGS&gt; &lt;LINK_FLAGS&gt; &lt;CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS&gt;  &lt;CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG&gt;&lt;TARGET_SONAME&gt; -o &lt;TARGET&gt; &lt;OBJECTS&gt; &lt;LINK_LIBRARIES&gt;&quot;)<br>
-  ELSE(CMAKE_COMPILER_IS_GNUCC)<br>-    # Take default rule from CMakeDefaultMakeRuleVariables.cmake.<br>+    EXECUTE_PROCESS(<br>+      COMMAND ${CMAKE_CXX_COMPILER} -print-file-name=libstdc++.so<br>+      OUTPUT_VARIABLE SHARED_LIBSTDCXX_FILENAME<br>
+      OUTPUT_STRIP_TRAILING_WHITESPACE)<br>+    IF(NOT EXISTS &quot;${SHARED_LIBSTDCXX_FILENAME}&quot;)<br>+      SET(CMAKE_CXX_CREATE_SHARED_LIBRARY<br>+          &quot;&lt;CMAKE_C_COMPILER&gt; &lt;CMAKE_SHARED_LIBRARY_CXX_FLAGS&gt; &lt;LINK_FLAGS&gt; &lt;CMAKE_SHARED_LIBRARY_CREATE_CXX_FLAGS&gt;  &lt;CMAKE_SHARED_LIBRARY_SONAME_CXX_FLAG&gt;&lt;TARGET_SONAME&gt; -o &lt;TARGET&gt; &lt;OBJECTS&gt; &lt;LINK_LIBRARIES&gt;&quot;)<br>
+    ENDIF(NOT EXISTS &quot;${SHARED_LIBSTDCXX_FILENAME}&quot;)<br>   ENDIF(CMAKE_COMPILER_IS_GNUCC)<br> ENDIF(CMAKE_COMPILER_IS_GNUCXX)<br> INCLUDE(Platform/UnixPaths)<br><br>Cheers,<br>Pasi<br>