🛠️🐜 Antkeeper superbuild with dependencies included https://antkeeper.com
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 lines
1.2 KiB

  1. cmake_minimum_required(VERSION 3.7)
  2. project(glad)
  3. # Set compiler flags
  4. if(CMAKE_COMPILER_IS_GNUCC)
  5. set(CMAKE_CXX_FLAGS "-Wall -Wextra")
  6. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
  7. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
  8. elseif(MSVC)
  9. set(CMAKE_C_FLAGS "/W3 /MP /MT")
  10. set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}")
  11. set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} /Ox")
  12. endif()
  13. add_library(${PROJECT_NAME} ${PROJECT_SOURCE_DIR}/glad.c)
  14. # Install library
  15. install(TARGETS ${PROJECT_NAME}
  16. EXPORT ${PROJECT_NAME}-targets
  17. ARCHIVE DESTINATION lib
  18. LIBRARY DESTINATION lib
  19. RUNTIME DESTINATION bin)
  20. # Install headers
  21. install(
  22. FILES
  23. ${PROJECT_SOURCE_DIR}/glad.h
  24. ${PROJECT_SOURCE_DIR}/khrplatform.h
  25. DESTINATION include/glad)
  26. # Install CMake config file
  27. install(EXPORT ${PROJECT_NAME}-targets
  28. FILE ${PROJECT_NAME}-targets.cmake
  29. DESTINATION lib/cmake/${PROJECT_NAME})
  30. include(CMakePackageConfigHelpers)
  31. configure_package_config_file(
  32. ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-config.cmake.in
  33. ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
  34. INSTALL_DESTINATION lib/cmake/${PROJECT_NAME})
  35. install(
  36. FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
  37. DESTINATION lib/cmake/${PROJECT_NAME})