From ee6f055bc58a952eeeddd823131f670b28ec2484 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Mon, 26 May 2008 21:18:41 +0000 Subject: [PATCH] From Philip Lowman, "I changed the test name to be a little easier to understand and defaulted Linux & Windows builds to false and to skip the compile check as you desired. " --- CMakeLists.txt | 44 ++++++++++++++++++++++++++++---------------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 807eb36eb..13e13ffa1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,24 +260,36 @@ ENDIF(PKG_CONFIG_FOUND) # Test to determine if we want the "tripledot" form of the GLU tesselator callback. # IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT) - INCLUDE(CheckCXXSourceCompiles) - SET(CMAKE_REQUIRED_DEFINITIONS -DGLU_TESS_CALLBACK_TRIPLEDOT) - SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include ${GLUT_INCLUDE_DIR} ${GL_INCLUDE_DIR}) - SET(CMAKE_REQUIRED_LIBRARIES ${GLUT_LIBRARY} ${GL_LIBRARY}) - CHECK_CXX_SOURCE_COMPILES( - "#include - #include - static void testcb(GLvoid *, void*) { } - int main() - { - GLUtesselator *t = gluNewTess(); - gluTessCallback(t, GLU_TESS_VERTEX_DATA, (GLU_TESS_CALLBACK) testcb); - return 0; - }" - DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT) + IF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux") + + # Skip the compile check for platforms that never need the variable + # form. + SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT false) + + ELSE(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux") + + # For other platforms perform the check + INCLUDE(CheckCXXSourceCompiles) + SET(CMAKE_REQUIRED_DEFINITIONS -DGLU_TESS_CALLBACK_TRIPLEDOT) + SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_CURRENT_SOURCE_DIR}/include ${GLUT_INCLUDE_DIR} ${GL_INCLUDE_DIR}) + SET(CMAKE_REQUIRED_LIBRARIES ${GLUT_LIBRARY} ${GL_LIBRARY}) + CHECK_CXX_SOURCE_COMPILES( + "#include + #include + static void testcb(GLvoid *, void*) { } + int main() { + GLUtesselator *t = gluNewTess(); + gluTessCallback(t, GLU_TESS_VERTEX_DATA, (GLU_TESS_CALLBACK) testcb); + return 0; + }" + GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No) + SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT + ${GLU_Tesselator_Needs_Variable_Parameter_Callback_Convention_Failure_Means_No}) + + ENDIF(WIN32 OR CMAKE_SYSTEM_NAME MATCHES "Linux") ENDIF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT) -OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build build with (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT}) +OPTION(OSG_GLU_TESS_CALLBACK_TRIPLEDOT "Set to ON to build build with variable parameter (...) version of GLU tesselator callback" ${DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT}) IF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT) ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT) ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT)