diff --git a/CMakeLists.txt b/CMakeLists.txt index 5ad266f8..a6091750 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,9 +13,6 @@ set(GLFW_VERSION_FULL "${GLFW_VERSION}.${GLFW_VERSION_PATCH}${GLFW_VERSION_EXTRA option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ON) option(GLFW_BUILD_TESTS "Build the GLFW test programs" ON) -include(CheckFunctionExists) -include(CheckSymbolExists) - find_package(OpenGL REQUIRED) #-------------------------------------------------------------------- @@ -28,7 +25,6 @@ if (WIN32) set(_GLFW_WIN32_WGL 1) # Set up library and include paths - set(CMAKE_REQUIRED_LIBRARIES ${OPENGL_gl_LIBRARY}) list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR}) list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) endif (WIN32) @@ -43,18 +39,24 @@ if (UNIX AND NOT APPLE) set(_GLFW_X11_GLX 1) # Set up library and include paths - set(CMAKE_REQUIRED_LIBRARIES ${X11_X11_LIB} ${OPENGL_gl_LIBRARY}) - list(APPEND GLFW_INCLUDE_DIR ${X11_X11_INCLUDE_PATH}) - list(APPEND GLFW_LIBRARIES ${X11_X11_LIB}) - list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR}) - list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) + list(APPEND GLFW_INCLUDE_DIR ${X11_X11_INCLUDE_PATH} ${OPENGL_INCLUDE_DIR}) + list(APPEND GLFW_LIBRARIES ${X11_X11_LIB} ${OPENGL_gl_LIBRARY}) find_library(MATH_LIBRARY m) if (MATH_LIBRARY) - list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY}) + list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY}) endif(MATH_LIBRARY) - include(${CMAKE_CURRENT_SOURCE_DIR}/CMake/CheckX11Extensions.cmake) + find_library(RT_LIBRARY rt) + if (RT_LIBRARY) + list(APPEND GLFW_LIBRARIES ${RT_LIBRARY}) + endif(RT_LIBRARY) + + include(CheckFunctionExists) + include(CheckSymbolExists) + + include(${GLFW_SOURCE_DIR}/CMake/CheckX11Extensions.cmake) + set(CMAKE_REQUIRED_LIBRARIES ${GLFW_LIBRARIES}) # Check for XRandR (modern resolution switching extension) check_x11_xrandr() @@ -94,11 +96,6 @@ if (UNIX AND NOT APPLE) NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND NOT _GLFW_HAS_GLXGETPROCADDRESSEXT) - find_library(LIBRT rt) - if (LIBRT) - list(APPEND GLFW_LIBRARIES ${LIBRT}) - endif(LIBRT) - if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(_GLFW_USE_LINUX_JOYSTICKS 1) endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") @@ -115,12 +112,12 @@ if (UNIX AND APPLE) option(GLFW_BUILD_UNIVERSAL "Build the GLFW library and examples as Universal Binaries" FALSE) - # Universal build, decent set of warning flags... + # Universal build if (GLFW_BUILD_UNIVERSAL) message(STATUS "Building GLFW as Universal Binaries") set(CMAKE_OSX_ARCHITECTURES ppc;i386;ppc64;x86_64) set(CMAKE_OSX_SYSROOT /Developer/SDKs/MacOSX10.5.sdk) - set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5 -Wall -Wextra -Wno-unused-parameter -Werror") + set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5") else(GLFW_BUILD_UNIVERSAL) message(STATUS "Building GLFW only for the native architecture") endif(GLFW_BUILD_UNIVERSAL) @@ -165,11 +162,11 @@ install(FILES COPYING.txt readme.html #-------------------------------------------------------------------- # -- Documentation generation #-------------------------------------------------------------------- -#include("${CMAKE_CURRENT_SOURCE_DIR}/documentation.cmake") -#configure_file("${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in" -# "${CMAKE_CURRENT_BINARY_DIR}/Doxyfile" +#include("${GLFW_SOURCE_DIR}/documentation.cmake") +#configure_file("${GLFW_SOURCE_DIR}/Doxyfile.in" +# "${GLFW_BINARY_DIR}/Doxyfile" # IMMEDIATE @ONLY) -#add_doxygen_target("${CMAKE_CURRENT_BINARY_DIR}/Doxyfile") +#add_doxygen_target("${GLFW_BINARY_DIR}/Doxyfile") #add_subdirectory(docs) #--------------------------------------------------------------------