[Piglit] [PATCH] cmake: Use C++ compiler to link C programs if using Solaris Studio.

Vinson Lee vlee at freedesktop.org
Sat Sep 1 15:48:22 PDT 2012


Fixes Solaris Studio build.

Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=50802
Signed-off-by: Vinson Lee <vlee at freedesktop.org>
---
 CMakeLists.txt |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 893a14d..2f0c280 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -152,6 +152,14 @@ if (MINGW)
 	endif ()
 endif ()
 
+if (${CMAKE_C_COMPILER_ID} STREQUAL "SunPro")
+	# Use C++ to link C files.
+	# http://developers.sun.com/solaris/articles/mixing.html#linking
+	# Modified rule from Modules/CMakeCInformation.cmake.
+	set (CMAKE_C_LINK_EXECUTABLE
+		"<CMAKE_CXX_COMPILER> <FLAGS> <CMAKE_C_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
+endif()
+
 if (WIN32)
 	# MSVC & MinGW only define & use APIENTRY
 	add_definitions (-DGLAPIENTRY=__stdcall)
-- 
1.7.3.2



More information about the Piglit mailing list