Advertisement
totalboy

The main CMake

Feb 13th, 2021
235
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. cmake_minimum_required(VERSION 3.1)
  2. set(PROJECT_NAME VKAPI)
  3. project(${PROJECT_NAME} LANGUAGES CXX)
  4.  
  5. set(VKAPI_MAJOR_VERSION "0")
  6. set(VKAPI_MINOR_VERSION "0")
  7. set(VKAPI_PATCH_VERSION "2")
  8. set(VKAPI_VERSION_STRING "${VKAPI_MAJOR_VERSION}.${VKAPI_MINOR_VERSION}.${VKAPI_PATCH_VERSION}")
  9.  
  10. set(CMAKE_INSTALL_PREFIX ${CMAKE_SOURCE_DIR})
  11. set(VKAPI_INCLUDE_DIRS bin/include CACHE PATH "The path to include's files")
  12.  
  13. option(BUILD_EXAMPLES "Determines whether examples should be performed" OFF)
  14.  
  15. file(GLOB TARGET_SRC "./src/*.cpp")
  16. file(GLOB TARGET_HEADERS "./include/*.hpp")
  17.  
  18. add_library(${PROJECT_NAME} STATIC ${TARGET_SRC} ${TARGET_HEADERS})
  19.  
  20. target_include_directories(${PROJECT_NAME} PUBLIC include)
  21.  
  22. # Include curl
  23. find_package(CURL REQUIRED)
  24. if (CURL_FOUND)
  25.     target_link_directories(${PROJECT_NAME} PUBLIC ${CURL_INCLUDE_DIRS})
  26.     target_link_libraries(${PROJECT_NAME} PUBLIC CURL::libcurl)
  27. endif()
  28.  
  29. set_target_properties(
  30.     ${PROJECT_NAME} PROPERTIES
  31.     CXX_STANDARD 14
  32.     CXX_STANDARD_REQUIRED on
  33.     PUBLIC_HEADER "${TARGET_HEADERS}"
  34. )
  35.  
  36. # if(BUILD_EXAMPLES)
  37. #     add_subdirectory(examples)
  38. # endif()
  39.  
  40. install(
  41.     EXPORT VKAPITargets
  42.     FILE VKAPIConfig.cmake
  43.     NAMESPACE VKAPI::
  44.     DESTINATION lib/cmake
  45. )
  46.  
  47. install(
  48.     TARGETS ${PROJECT_NAME} EXPORT VKAPITargets
  49.     LIBRARY DESTINATION lib
  50.     ARCHIVE DESTINATION lib
  51.     RUNTIME DESTINATION bin
  52.     PUBLIC_HEADER DESTINATION bin
  53. )
Advertisement
RAW Paste Data Copied
Advertisement