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

43 lines
1.2 KiB

  1. cmake_minimum_required(VERSION 3.7)
  2. project(dr_wav)
  3. add_library(dr_wav ${PROJECT_SOURCE_DIR}/dr_wav.cpp)
  4. # Set compiler flags
  5. if(CMAKE_COMPILER_IS_GNUCC)
  6. set(CMAKE_CXX_FLAGS "-Wall -Wextra")
  7. set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS} -g")
  8. set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3")
  9. elseif(MSVC)
  10. set(CMAKE_C_FLAGS "/W3 /MP /MT")
  11. set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS}")
  12. set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS} /Ox")
  13. endif()
  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 header
  21. install(
  22. FILES ${PROJECT_SOURCE_DIR}/dr_wav.h
  23. DESTINATION include/dr_libs)
  24. # Install CMake config file
  25. install(EXPORT ${PROJECT_NAME}-targets
  26. FILE ${PROJECT_NAME}-targets.cmake
  27. DESTINATION lib/cmake/${PROJECT_NAME})
  28. include(CMakePackageConfigHelpers)
  29. configure_package_config_file(
  30. ${PROJECT_SOURCE_DIR}/${PROJECT_NAME}-config.cmake.in
  31. ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
  32. INSTALL_DESTINATION lib/cmake/${PROJECT_NAME})
  33. install(
  34. FILES ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake
  35. DESTINATION lib/cmake/${PROJECT_NAME})