diff --git a/CMakeLists.txt b/CMakeLists.txt index a570e6b76..141258746 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -98,26 +98,6 @@ INCLUDE_DIRECTORIES( #ADD_DEFINITIONS(-D) # Platform specific definitions -IF(NOT DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT) - - SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT OFF) - - IF (CMAKE_SYSTEM MATCHES "AIX.*") - SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT ON) - ENDIF(CMAKE_SYSTEM MATCHES "AIX.*") - - IF (APPLE) - SET(DEFAULT_GLU_TESS_CALLBACK_TRIPLEDOT ON) - ENDIF(APPLE) - -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}) - -IF (OSG_GLU_TESS_CALLBACK_TRIPLEDOT) - ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT) -ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT) - IF(WIN32) @@ -254,7 +234,31 @@ ELSE(DESIRED_QT_VERSION) ENDIF(DESIRED_QT_VERSION) +# +# 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) +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}) +IF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT) + ADD_DEFINITIONS(-DGLU_TESS_CALLBACK_TRIPLEDOT) +ENDIF(OSG_GLU_TESS_CALLBACK_TRIPLEDOT) # Platform specific: # (We can approach this one of two ways. We can try to FIND everything