🛠️🐜 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.

47 lines
1.3 KiB

  1. cmake_minimum_required(VERSION 3.7)
  2. project(stb)
  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(stb
  14. ${PROJECT_SOURCE_DIR}/stb_image.c
  15. ${PROJECT_SOURCE_DIR}/stb_image_write.c)
  16. # Install library
  17. install(TARGETS ${PROJECT_NAME}
  18. EXPORT ${PROJECT_NAME}-targets
  19. ARCHIVE DESTINATION lib
  20. LIBRARY DESTINATION lib
  21. RUNTIME DESTINATION bin)
  22. # Install headers
  23. install(
  24. FILES
  25. ${PROJECT_SOURCE_DIR}/stb_image.h
  26. ${PROJECT_SOURCE_DIR}/stb_image_write.h
  27. DESTINATION include/stb)
  28. # Install CMake config file
  29. install(EXPORT ${PROJECT_NAME}-targets
  30. FILE ${PROJECT_NAME}-targets.cmake
  31. DESTINATION lib/cmake/${PROJECT_NAME})
  32. include(CMakePackageConfigHelpers)
  33. configure_package_config_file(
  34. ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-config.cmake.in
  35. ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
  36. INSTALL_DESTINATION lib/cmake/${PROJECT_NAME})
  37. install(
  38. FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
  39. DESTINATION lib/cmake/${PROJECT_NAME})