CMakeLists.txt 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. cmake_minimum_required(VERSION 3.1)
  2. cmake_policy(SET CMP0048 NEW)
  3. file(STRINGS "VERSION" version)
  4. project(alibabacloud-sdk VERSION ${version})
  5. message(STATUS "Project version: ${PROJECT_VERSION}")
  6. set(TARGET_OUTPUT_NAME_PREFIX "alibabacloud-sdk-" CACHE STRING "The target's output name prefix")
  7. option(BUILD_SHARED_LIBS "Enable shared library" ON)
  8. option(BUILD_UNIT_TESTS "Enable unit tests" OFF)
  9. option(BUILD_FUNCTION_TESTS "Enable function test" OFF)
  10. option(BUILD_PRODUCT "Build by lower name of product" OFF)
  11. set(LIB_TYPE STATIC)
  12. if(BUILD_SHARED_LIBS)
  13. set(LIB_TYPE SHARED)
  14. add_definitions(-DALIBABACLOUD_SHARED)
  15. endif()
  16. set_property(GLOBAL
  17. PROPERTY
  18. USE_FOLDERS ON)
  19. set(CMAKE_CXX_STANDARD 11)
  20. include(ExternalProject)
  21. include(GNUInstallDirs)
  22. add_subdirectory(3rdparty)
  23. add_subdirectory(core)
  24. if(BUILD_UNIT_TESTS)
  25. enable_testing()
  26. add_subdirectory(test/core)
  27. endif()
  28. if(BUILD_FUNCTION_TESTS)
  29. enable_testing()
  30. add_subdirectory(test/function_test/cdn)
  31. add_subdirectory(test/function_test/core)
  32. add_subdirectory(test/function_test/cs)
  33. add_subdirectory(test/function_test/ecs)
  34. add_subdirectory(test/function_test/nlp)
  35. add_subdirectory(test/function_test/rds)
  36. add_subdirectory(test/function_test/slb)
  37. add_subdirectory(test/function_test/vpc)
  38. endif()
  39. if(NOT BUILD_PRODUCT)
  40. message(FATAL_ERROR "INVALID FOLDER 'BUILD_PRODUCT'=${BUILD_PRODUCT}")
  41. else()
  42. add_subdirectory(${BUILD_PRODUCT})
  43. message(STATUS "'BUILD_PRODUCT'=${BUILD_PRODUCT}")
  44. endif()