minesweeper

A minewseeper implementation to play around with Hare and Raylib
git clone https://git.tronto.net/minesweeper
Download | Log | Files | Refs | README | LICENSE

CMakeLists.txt (5951B)


      1 cmake_minimum_required(VERSION 3.4...3.28 FATAL_ERROR)
      2 
      3 project(GLFW VERSION 3.4.0 LANGUAGES C)
      4 
      5 if (POLICY CMP0069)
      6     cmake_policy(SET CMP0069 NEW)
      7 endif()
      8 
      9 if (POLICY CMP0077)
     10     cmake_policy(SET CMP0077 NEW)
     11 endif()
     12 
     13 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
     14 
     15 string(COMPARE EQUAL "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_SOURCE_DIR}" GLFW_STANDALONE)
     16 
     17 option(BUILD_SHARED_LIBS "Build shared libraries" OFF)
     18 option(GLFW_BUILD_EXAMPLES "Build the GLFW example programs" ${GLFW_STANDALONE})
     19 option(GLFW_BUILD_TESTS "Build the GLFW test programs" ${GLFW_STANDALONE})
     20 option(GLFW_BUILD_DOCS "Build the GLFW documentation" ON)
     21 option(GLFW_INSTALL "Generate installation target" ON)
     22 
     23 include(GNUInstallDirs)
     24 include(CMakeDependentOption)
     25 
     26 if (GLFW_USE_OSMESA)
     27     message(FATAL_ERROR "GLFW_USE_OSMESA has been removed; set the GLFW_PLATFORM init hint")
     28 endif()
     29 
     30 if (DEFINED GLFW_USE_WAYLAND AND UNIX AND NOT APPLE)
     31     message(FATAL_ERROR
     32         "GLFW_USE_WAYLAND has been removed; delete the CMake cache and set GLFW_BUILD_WAYLAND and GLFW_BUILD_X11 instead")
     33 endif()
     34 
     35 cmake_dependent_option(GLFW_BUILD_WIN32 "Build support for Win32" ON "WIN32" OFF)
     36 cmake_dependent_option(GLFW_BUILD_COCOA "Build support for Cocoa" ON "APPLE" OFF)
     37 cmake_dependent_option(GLFW_BUILD_X11 "Build support for X11" ON "UNIX;NOT APPLE" OFF)
     38 cmake_dependent_option(GLFW_BUILD_WAYLAND "Build support for Wayland" ON "UNIX;NOT APPLE" OFF)
     39 
     40 cmake_dependent_option(GLFW_USE_HYBRID_HPG "Force use of high-performance GPU on hybrid systems" OFF
     41                        "WIN32" OFF)
     42 cmake_dependent_option(USE_MSVC_RUNTIME_LIBRARY_DLL "Use MSVC runtime library DLL" ON
     43                        "MSVC" OFF)
     44 
     45 set(GLFW_LIBRARY_TYPE "${GLFW_LIBRARY_TYPE}" CACHE STRING
     46     "Library type override for GLFW (SHARED, STATIC, OBJECT, or empty to follow BUILD_SHARED_LIBS)")
     47 
     48 if (GLFW_LIBRARY_TYPE)
     49     if (GLFW_LIBRARY_TYPE STREQUAL "SHARED")
     50         set(GLFW_BUILD_SHARED_LIBRARY TRUE)
     51     else()
     52         set(GLFW_BUILD_SHARED_LIBRARY FALSE)
     53     endif()
     54 else()
     55     set(GLFW_BUILD_SHARED_LIBRARY ${BUILD_SHARED_LIBS})
     56 endif()
     57 
     58 list(APPEND CMAKE_MODULE_PATH "${GLFW_SOURCE_DIR}/CMake/modules")
     59 
     60 find_package(Threads REQUIRED)
     61 
     62 #--------------------------------------------------------------------
     63 # Report backend selection
     64 #--------------------------------------------------------------------
     65 if (GLFW_BUILD_WIN32)
     66     message(STATUS "Including Win32 support")
     67 endif()
     68 if (GLFW_BUILD_COCOA)
     69     message(STATUS "Including Cocoa support")
     70 endif()
     71 if (GLFW_BUILD_WAYLAND)
     72     message(STATUS "Including Wayland support")
     73 endif()
     74 if (GLFW_BUILD_X11)
     75     message(STATUS "Including X11 support")
     76 endif()
     77 
     78 #--------------------------------------------------------------------
     79 # Apply Microsoft C runtime library option
     80 # This is here because it also applies to tests and examples
     81 #--------------------------------------------------------------------
     82 if (MSVC AND NOT USE_MSVC_RUNTIME_LIBRARY_DLL)
     83     if (CMAKE_VERSION VERSION_LESS 3.15)
     84         foreach (flag CMAKE_C_FLAGS
     85                       CMAKE_C_FLAGS_DEBUG
     86                       CMAKE_C_FLAGS_RELEASE
     87                       CMAKE_C_FLAGS_MINSIZEREL
     88                       CMAKE_C_FLAGS_RELWITHDEBINFO)
     89 
     90             if (flag MATCHES "/MD")
     91                 string(REGEX REPLACE "/MD" "/MT" ${flag} "${${flag}}")
     92             endif()
     93             if (flag MATCHES "/MDd")
     94                 string(REGEX REPLACE "/MDd" "/MTd" ${flag} "${${flag}}")
     95             endif()
     96 
     97         endforeach()
     98     else()
     99         set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
    100     endif()
    101 endif()
    102 
    103 #--------------------------------------------------------------------
    104 # Create generated files
    105 #--------------------------------------------------------------------
    106 include(CMakePackageConfigHelpers)
    107 
    108 set(GLFW_CONFIG_PATH "${CMAKE_INSTALL_LIBDIR}/cmake/glfw3")
    109 
    110 configure_package_config_file(CMake/glfw3Config.cmake.in
    111                               src/glfw3Config.cmake
    112                               INSTALL_DESTINATION "${GLFW_CONFIG_PATH}"
    113                               NO_CHECK_REQUIRED_COMPONENTS_MACRO)
    114 
    115 write_basic_package_version_file(src/glfw3ConfigVersion.cmake
    116                                  VERSION ${GLFW_VERSION}
    117                                  COMPATIBILITY SameMajorVersion)
    118 
    119 #--------------------------------------------------------------------
    120 # Add subdirectories
    121 #--------------------------------------------------------------------
    122 add_subdirectory(src)
    123 
    124 if (GLFW_BUILD_EXAMPLES)
    125     add_subdirectory(examples)
    126 endif()
    127 
    128 if (GLFW_BUILD_TESTS)
    129     add_subdirectory(tests)
    130 endif()
    131 
    132 if (GLFW_BUILD_DOCS)
    133     add_subdirectory(docs)
    134 endif()
    135 
    136 #--------------------------------------------------------------------
    137 # Install files other than the library
    138 # The library is installed by src/CMakeLists.txt
    139 #--------------------------------------------------------------------
    140 if (GLFW_INSTALL)
    141     install(DIRECTORY include/GLFW DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}
    142             FILES_MATCHING PATTERN glfw3.h PATTERN glfw3native.h)
    143 
    144     install(FILES "${GLFW_BINARY_DIR}/src/glfw3Config.cmake"
    145                   "${GLFW_BINARY_DIR}/src/glfw3ConfigVersion.cmake"
    146             DESTINATION "${GLFW_CONFIG_PATH}")
    147 
    148     install(EXPORT glfwTargets FILE glfw3Targets.cmake
    149             EXPORT_LINK_INTERFACE_LIBRARIES
    150             DESTINATION "${GLFW_CONFIG_PATH}")
    151     install(FILES "${GLFW_BINARY_DIR}/src/glfw3.pc"
    152             DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
    153 
    154     # Only generate this target if no higher-level project already has
    155     if (NOT TARGET uninstall)
    156         configure_file(CMake/cmake_uninstall.cmake.in
    157                        cmake_uninstall.cmake IMMEDIATE @ONLY)
    158 
    159         add_custom_target(uninstall
    160                           "${CMAKE_COMMAND}" -P
    161                           "${GLFW_BINARY_DIR}/cmake_uninstall.cmake")
    162         set_target_properties(uninstall PROPERTIES FOLDER "GLFW3")
    163     endif()
    164 endif()
    165