CMake file formatting.

This commit is contained in:
Camilla Berglund 2012-02-29 20:15:39 +01:00
parent a82598ea24
commit cd7b9b1568
4 changed files with 30 additions and 32 deletions

View File

@ -27,7 +27,7 @@ if (WIN32)
# Set up library and include paths # Set up library and include paths
list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR}) list(APPEND GLFW_INCLUDE_DIR ${OPENGL_INCLUDE_DIR})
list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
endif (WIN32) endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Set up GLFW for Xlib and GLX on Unix-like systems with X Windows # Set up GLFW for Xlib and GLX on Unix-like systems with X Windows
@ -47,12 +47,12 @@ if (UNIX AND NOT APPLE)
find_library(MATH_LIBRARY m) find_library(MATH_LIBRARY m)
if (MATH_LIBRARY) if (MATH_LIBRARY)
list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY}) list(APPEND GLFW_LIBRARIES ${MATH_LIBRARY})
endif(MATH_LIBRARY) endif()
find_library(RT_LIBRARY rt) find_library(RT_LIBRARY rt)
if (RT_LIBRARY) if (RT_LIBRARY)
list(APPEND GLFW_LIBRARIES ${RT_LIBRARY}) list(APPEND GLFW_LIBRARIES ${RT_LIBRARY})
endif(RT_LIBRARY) endif()
include(CheckFunctionExists) include(CheckFunctionExists)
include(CheckSymbolExists) include(CheckSymbolExists)
@ -83,24 +83,22 @@ if (UNIX AND NOT APPLE)
if (NOT _GLFW_HAS_GLXGETPROCADDRESS) if (NOT _GLFW_HAS_GLXGETPROCADDRESS)
check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB) check_function_exists(glXGetProcAddressARB _GLFW_HAS_GLXGETPROCADDRESSARB)
endif (NOT _GLFW_HAS_GLXGETPROCADDRESS) endif()
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB) if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB)
check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT) check_function_exists(glXGetProcAddressEXT _GLFW_HAS_GLXGETPROCADDRESSEXT)
endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB) endif()
if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND if (NOT _GLFW_HAS_GLXGETPROCADDRESS AND
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
NOT _GLFW_HAS_GLXGETPROCADDRESSEXT) NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
message(WARNING "No glXGetProcAddressXXX variant found") message(WARNING "No glXGetProcAddressXXX variant found")
endif (NOT _GLFW_HAS_GLXGETPROCADDRESS AND endif()
NOT _GLFW_HAS_GLXGETPROCADDRESSARB AND
NOT _GLFW_HAS_GLXGETPROCADDRESSEXT)
if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
set(_GLFW_USE_LINUX_JOYSTICKS 1) set(_GLFW_USE_LINUX_JOYSTICKS 1)
endif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") endif()
endif(UNIX AND NOT APPLE) endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Set up GLFW for Cocoa and NSOpenGL on Mac OS X # Set up GLFW for Cocoa and NSOpenGL on Mac OS X
@ -121,7 +119,7 @@ if (UNIX AND APPLE)
set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5") set(CMAKE_C_FLAGS "-mmacosx-version-min=10.5")
else(GLFW_BUILD_UNIVERSAL) else(GLFW_BUILD_UNIVERSAL)
message(STATUS "Building GLFW only for the native architecture") message(STATUS "Building GLFW only for the native architecture")
endif(GLFW_BUILD_UNIVERSAL) endif()
# Set up library and include paths # Set up library and include paths
find_library(COCOA_FRAMEWORK Cocoa) find_library(COCOA_FRAMEWORK Cocoa)
@ -131,7 +129,7 @@ if (UNIX AND APPLE)
list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY}) list(APPEND GLFW_LIBRARIES ${OPENGL_gl_LIBRARY})
list(APPEND GLFW_LIBRARIES ${IOKIT_FRAMEWORK}) list(APPEND GLFW_LIBRARIES ${IOKIT_FRAMEWORK})
list(APPEND GLFW_LIBRARIES ${CORE_FOUNDATION_FRAMEWORK}) list(APPEND GLFW_LIBRARIES ${CORE_FOUNDATION_FRAMEWORK})
endif(UNIX AND APPLE) endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Add subdirectories # Add subdirectories
@ -140,11 +138,11 @@ add_subdirectory(src)
if (GLFW_BUILD_EXAMPLES) if (GLFW_BUILD_EXAMPLES)
add_subdirectory(examples) add_subdirectory(examples)
endif(GLFW_BUILD_EXAMPLES) endif()
if (GLFW_BUILD_TESTS) if (GLFW_BUILD_TESTS)
add_subdirectory(tests) add_subdirectory(tests)
endif(GLFW_BUILD_TESTS) endif()
#-------------------------------------------------------------------- #--------------------------------------------------------------------
# Create shared configuration header # Create shared configuration header
@ -175,7 +173,7 @@ configure_file("${GLFW_SOURCE_DIR}/docs/Doxyfile.in"
# Uninstall operation # Uninstall operation
# Don't generate this target if a higher-level project already has # Don't generate this target if a higher-level project already has
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if(NOT TARGET uninstall) if (NOT TARGET uninstall)
configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in configure_file(${GLFW_SOURCE_DIR}/cmake_uninstall.cmake.in
${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY) ${GLFW_BINARY_DIR}/cmake_uninstall.cmake IMMEDIATE @ONLY)

View File

@ -7,14 +7,14 @@ include_directories(${GLFW_SOURCE_DIR}/include
${GLFW_SOURCE_DIR}/support ${GLFW_SOURCE_DIR}/support
${OPENGL_INCLUDE_DIR}) ${OPENGL_INCLUDE_DIR})
if(APPLE) if (APPLE)
# Set fancy names for bundles # Set fancy names for bundles
add_executable(Boing MACOSX_BUNDLE boing.c) add_executable(Boing MACOSX_BUNDLE boing.c)
add_executable(Gears MACOSX_BUNDLE gears.c) add_executable(Gears MACOSX_BUNDLE gears.c)
add_executable("Split View" MACOSX_BUNDLE splitview.c) add_executable("Split View" MACOSX_BUNDLE splitview.c)
add_executable(Triangle MACOSX_BUNDLE triangle.c) add_executable(Triangle MACOSX_BUNDLE triangle.c)
add_executable(Wave MACOSX_BUNDLE wave.c) add_executable(Wave MACOSX_BUNDLE wave.c)
else(APPLE) else()
# Set boring names for executables # Set boring names for executables
add_executable(boing WIN32 boing.c) add_executable(boing WIN32 boing.c)
add_executable(gears WIN32 gears.c) add_executable(gears WIN32 gears.c)
@ -22,13 +22,13 @@ else(APPLE)
add_executable(splitview WIN32 splitview.c) add_executable(splitview WIN32 splitview.c)
add_executable(triangle WIN32 triangle.c) add_executable(triangle WIN32 triangle.c)
add_executable(wave WIN32 wave.c) add_executable(wave WIN32 wave.c)
endif(APPLE) endif()
set(WINDOWS_BINARIES boing gears heightmap splitview triangle wave) set(WINDOWS_BINARIES boing gears heightmap splitview triangle wave)
if(MSVC) if (MSVC)
# Tell MSVC to use main instead of WinMain for Windows subsystem executables # Tell MSVC to use main instead of WinMain for Windows subsystem executables
set_target_properties(${WINDOWS_BINARIES} PROPERTIES set_target_properties(${WINDOWS_BINARIES} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup") LINK_FLAGS "/ENTRY:mainCRTStartup")
endif(MSVC) endif()

View File

@ -1,15 +1,15 @@
if(UNIX) if(UNIX)
if(_GLFW_HAS_XRANDR) if (_GLFW_HAS_XRANDR)
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr") set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xrandr")
endif(_GLFW_HAS_XRANDR) endif()
if(_GLFW_HAS_XF86VIDMODE) if (_GLFW_HAS_XF86VIDMODE)
set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm") set(GLFW_PKGLIBS "${GLFW_PKGLIBS} xxf86vm")
endif(_GLFW_HAS_XF86VIDMODE) endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake configure_file(${CMAKE_CURRENT_SOURCE_DIR}/libglfw.pc.cmake
${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY) ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc @ONLY)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig) install(FILES ${CMAKE_CURRENT_BINARY_DIR}/libglfw.pc DESTINATION lib/pkgconfig)
endif(UNIX) endif()
include_directories(${GLFW_SOURCE_DIR}/src include_directories(${GLFW_SOURCE_DIR}/src
${GLFW_BINARY_DIR}/src ${GLFW_BINARY_DIR}/src
@ -37,7 +37,7 @@ elseif(_GLFW_X11_GLX)
x11_window.c) x11_window.c)
else() else()
message(FATAL_ERROR "No supported platform was selected") message(FATAL_ERROR "No supported platform was selected")
endif(_GLFW_COCOA_NSGL) endif()
add_library(libglfwStatic STATIC ${libglfw_SOURCES}) add_library(libglfwStatic STATIC ${libglfw_SOURCES})
add_library(libglfwShared SHARED ${libglfw_SOURCES}) add_library(libglfwShared SHARED ${libglfw_SOURCES})
@ -54,16 +54,16 @@ if(WIN32)
PREFIX "" PREFIX ""
IMPORT_PREFIX "" IMPORT_PREFIX ""
IMPORT_SUFFIX "dll.lib") IMPORT_SUFFIX "dll.lib")
endif(WIN32) endif()
if(APPLE) if(APPLE)
# Append -fno-common to the compile flags to work around a bug in the Apple GCC # Append -fno-common to the compile flags to work around a bug in the Apple GCC
get_target_property(CFLAGS libglfwShared COMPILE_FLAGS) get_target_property(CFLAGS libglfwShared COMPILE_FLAGS)
if(NOT CFLAGS) if (NOT CFLAGS)
set(CFLAGS "") set(CFLAGS "")
endif(NOT CFLAGS) endif()
set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common") set_target_properties(libglfwShared PROPERTIES COMPILE_FLAGS "${CFLAGS} -fno-common")
endif(APPLE) endif()
install(TARGETS libglfwStatic libglfwShared DESTINATION lib) install(TARGETS libglfwStatic libglfwShared DESTINATION lib)

View File

@ -61,9 +61,9 @@ set(WINDOWS_BINARIES accuracy sharing tearing title windows)
set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma glfwinfo iconify set(CONSOLE_BINARIES defaults events fsaa fsfocus gamma glfwinfo iconify
joysticks listmodes peter reopen) joysticks listmodes peter reopen)
if(MSVC) if (MSVC)
# Tell MSVC to use main instead of WinMain for Windows subsystem executables # Tell MSVC to use main instead of WinMain for Windows subsystem executables
set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES set_target_properties(${WINDOWS_BINARIES} ${CONSOLE_BINARIES} PROPERTIES
LINK_FLAGS "/ENTRY:mainCRTStartup") LINK_FLAGS "/ENTRY:mainCRTStartup")
endif(MSVC) endif()