diff --git a/.gitattributes b/.gitattributes index 020757e11c8..f7c8aecde88 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1639,6 +1639,7 @@ Installation/cmake/modules/FindCORE.cmake -text Installation/cmake/modules/FindGMP.cmake -text Installation/cmake/modules/FindGMPXX.cmake -text Installation/cmake/modules/FindMPFR.cmake -text +Installation/cmake/modules/FindOpenGL.cmake -text Installation/cmake/modules/FindPackageHandleStandardArgs.cmake -text Installation/cmake/modules/FindQGLViewer.cmake -text Installation/cmake/modules/FindTAUCS.cmake -text diff --git a/Installation/CMakeLists.txt b/Installation/CMakeLists.txt index 999f9d15c32..b1e23fcfe77 100644 --- a/Installation/CMakeLists.txt +++ b/Installation/CMakeLists.txt @@ -17,6 +17,8 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.4.5 FATAL_ERROR) # Where to look first for cmake modules, before ${CMAKE_ROOT}/Modules/ is checked set(CGAL_CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules) +set(ORIGINAL_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ) + set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CGAL_CMAKE_MODULE_PATH} ) # This allows else(), endif(), etc... (without repeating the expression) diff --git a/Installation/cmake/modules/FindOpenGL.cmake b/Installation/cmake/modules/FindOpenGL.cmake new file mode 100644 index 00000000000..f9077471c2e --- /dev/null +++ b/Installation/cmake/modules/FindOpenGL.cmake @@ -0,0 +1,17 @@ +if ( NOT FIND_OPENGL_WRAPPER ) + +set ( FIND_OPENGL_WRAPPER 1 ) + +set(SAVED_CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ) + +set(CMAKE_MODULE_PATH ${ORIG_CMAKE_MODULE_PATH} ) + +find_package(OpenGL) + +if ( OPENGL_FOUND AND APPLE_LEOPARD ) + set (CMAKE_SHARED_LINKER_FLAGS "-Wl,-dylib_file,/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib:/System/Library/Frameworks/OpenGL.framework/Versions/A/Libraries/libGL.dylib") +endif() + +set(CMAKE_MODULE_PATH ${SAVED_CMAKE_MODULE_PATH} ) + +endif() \ No newline at end of file diff --git a/Installation/cmake/modules/GeneratorSpecificSettings.cmake b/Installation/cmake/modules/GeneratorSpecificSettings.cmake index 6874d67a22b..09208ed9a3d 100644 --- a/Installation/cmake/modules/GeneratorSpecificSettings.cmake +++ b/Installation/cmake/modules/GeneratorSpecificSettings.cmake @@ -29,6 +29,17 @@ set( GENERATOR_SPECIFIC_SETTINGS_FILE_INCLUDED 1 ) set( CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -library=stlport4" ) endif() + # From james Bigler, in the cmake users list. + IF (APPLE) + exec_program(uname ARGS -v OUTPUT_VARIABLE DARWIN_VERSION) + string(REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION}) + message(STATUS "DARWIN_VERSION=${DARWIN_VERSION}") + if (DARWIN_VERSION GREATER 8) + message(STATUS "Mac Leopard detected") + set(APPLE_LEOPARD 1) + endif() + endif() + if ( CMAKE_BUILD_TYPE ) # If a build type is specified, VC project files contain only a configurartion for that build type