CMakeLists.txt 3.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. #
  2. # Copyright 2009-2017 Alibaba Cloud All rights reserved.
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. #
  16. set(public_header_dir ${CMAKE_CURRENT_SOURCE_DIR}/../include)
  17. set(dbfs_public_header
  18. include/alibabacloud/dbfs/DBFSClient.h
  19. include/alibabacloud/dbfs/DBFSExport.h )
  20. set(dbfs_public_header_model
  21. include/alibabacloud/dbfs/model/AttachDbfsRequest.h
  22. include/alibabacloud/dbfs/model/AttachDbfsResult.h
  23. include/alibabacloud/dbfs/model/CreateDbfsRequest.h
  24. include/alibabacloud/dbfs/model/CreateDbfsResult.h
  25. include/alibabacloud/dbfs/model/DeleteDbfsRequest.h
  26. include/alibabacloud/dbfs/model/DeleteDbfsResult.h
  27. include/alibabacloud/dbfs/model/DetachDbfsRequest.h
  28. include/alibabacloud/dbfs/model/DetachDbfsResult.h
  29. include/alibabacloud/dbfs/model/GetDbfsRequest.h
  30. include/alibabacloud/dbfs/model/GetDbfsResult.h
  31. include/alibabacloud/dbfs/model/ListDbfsRequest.h
  32. include/alibabacloud/dbfs/model/ListDbfsResult.h
  33. include/alibabacloud/dbfs/model/ResizeDbfsRequest.h
  34. include/alibabacloud/dbfs/model/ResizeDbfsResult.h )
  35. set(dbfs_src
  36. src/DBFSClient.cc
  37. src/model/AttachDbfsRequest.cc
  38. src/model/AttachDbfsResult.cc
  39. src/model/CreateDbfsRequest.cc
  40. src/model/CreateDbfsResult.cc
  41. src/model/DeleteDbfsRequest.cc
  42. src/model/DeleteDbfsResult.cc
  43. src/model/DetachDbfsRequest.cc
  44. src/model/DetachDbfsResult.cc
  45. src/model/GetDbfsRequest.cc
  46. src/model/GetDbfsResult.cc
  47. src/model/ListDbfsRequest.cc
  48. src/model/ListDbfsResult.cc
  49. src/model/ResizeDbfsRequest.cc
  50. src/model/ResizeDbfsResult.cc )
  51. add_library(dbfs ${LIB_TYPE}
  52. ${dbfs_public_header}
  53. ${dbfs_public_header_model}
  54. ${dbfs_src})
  55. set_target_properties(dbfs
  56. PROPERTIES
  57. LINKER_LANGUAGE CXX
  58. ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  59. LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  60. RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
  61. OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}dbfs
  62. )
  63. if(${LIB_TYPE} STREQUAL "SHARED")
  64. set_target_properties(dbfs
  65. PROPERTIES
  66. DEFINE_SYMBOL ALIBABACLOUD_DBFS_LIBRARY)
  67. endif()
  68. target_include_directories(dbfs
  69. PRIVATE include
  70. ${CMAKE_SOURCE_DIR}/core/include
  71. )
  72. target_link_libraries(dbfs
  73. core)
  74. if(CMAKE_HOST_WIN32)
  75. ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
  76. set(jsoncpp_install_dir ${INSTALL_DIR})
  77. add_dependencies(dbfs
  78. jsoncpp)
  79. target_include_directories(dbfs
  80. PRIVATE ${jsoncpp_install_dir}/include)
  81. target_link_libraries(dbfs
  82. ${jsoncpp_install_dir}/lib/jsoncpp.lib)
  83. set_target_properties(dbfs
  84. PROPERTIES
  85. COMPILE_OPTIONS "/bigobj")
  86. else()
  87. target_include_directories(dbfs
  88. PRIVATE /usr/include/jsoncpp)
  89. target_link_libraries(dbfs
  90. jsoncpp)
  91. endif()
  92. install(FILES ${dbfs_public_header}
  93. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/dbfs)
  94. install(FILES ${dbfs_public_header_model}
  95. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/dbfs/model)
  96. install(TARGETS dbfs
  97. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  98. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  99. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  100. )