CMakeLists.txt 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  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(snsuapi_public_header
  18. include/alibabacloud/snsuapi/SnsuapiClient.h
  19. include/alibabacloud/snsuapi/SnsuapiExport.h )
  20. set(snsuapi_public_header_model
  21. include/alibabacloud/snsuapi/model/MobileStartSpeedUpRequest.h
  22. include/alibabacloud/snsuapi/model/MobileStartSpeedUpResult.h
  23. include/alibabacloud/snsuapi/model/BandStopSpeedUpRequest.h
  24. include/alibabacloud/snsuapi/model/BandStopSpeedUpResult.h
  25. include/alibabacloud/snsuapi/model/BandStatusQueryRequest.h
  26. include/alibabacloud/snsuapi/model/BandStatusQueryResult.h
  27. include/alibabacloud/snsuapi/model/MobileStatusQueryRequest.h
  28. include/alibabacloud/snsuapi/model/MobileStatusQueryResult.h
  29. include/alibabacloud/snsuapi/model/BandOfferOrderRequest.h
  30. include/alibabacloud/snsuapi/model/BandOfferOrderResult.h
  31. include/alibabacloud/snsuapi/model/MobileStopSpeedUpRequest.h
  32. include/alibabacloud/snsuapi/model/MobileStopSpeedUpResult.h
  33. include/alibabacloud/snsuapi/model/BandPrecheckRequest.h
  34. include/alibabacloud/snsuapi/model/BandPrecheckResult.h
  35. include/alibabacloud/snsuapi/model/BandStartSpeedUpRequest.h
  36. include/alibabacloud/snsuapi/model/BandStartSpeedUpResult.h )
  37. set(snsuapi_src
  38. src/SnsuapiClient.cc
  39. src/model/MobileStartSpeedUpRequest.cc
  40. src/model/MobileStartSpeedUpResult.cc
  41. src/model/BandStopSpeedUpRequest.cc
  42. src/model/BandStopSpeedUpResult.cc
  43. src/model/BandStatusQueryRequest.cc
  44. src/model/BandStatusQueryResult.cc
  45. src/model/MobileStatusQueryRequest.cc
  46. src/model/MobileStatusQueryResult.cc
  47. src/model/BandOfferOrderRequest.cc
  48. src/model/BandOfferOrderResult.cc
  49. src/model/MobileStopSpeedUpRequest.cc
  50. src/model/MobileStopSpeedUpResult.cc
  51. src/model/BandPrecheckRequest.cc
  52. src/model/BandPrecheckResult.cc
  53. src/model/BandStartSpeedUpRequest.cc
  54. src/model/BandStartSpeedUpResult.cc )
  55. add_library(snsuapi ${LIB_TYPE}
  56. ${snsuapi_public_header}
  57. ${snsuapi_public_header_model}
  58. ${snsuapi_src})
  59. set_target_properties(snsuapi
  60. PROPERTIES
  61. LINKER_LANGUAGE CXX
  62. ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  63. LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  64. RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
  65. OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}snsuapi
  66. )
  67. if(${LIB_TYPE} STREQUAL "SHARED")
  68. set_target_properties(snsuapi
  69. PROPERTIES
  70. DEFINE_SYMBOL ALIBABACLOUD_SNSUAPI_LIBRARY)
  71. endif()
  72. target_include_directories(snsuapi
  73. PRIVATE include
  74. ${CMAKE_SOURCE_DIR}/core/include
  75. )
  76. target_link_libraries(snsuapi
  77. core)
  78. if(CMAKE_HOST_WIN32)
  79. ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
  80. set(jsoncpp_install_dir ${INSTALL_DIR})
  81. add_dependencies(snsuapi
  82. jsoncpp)
  83. target_include_directories(snsuapi
  84. PRIVATE ${jsoncpp_install_dir}/include)
  85. target_link_libraries(snsuapi
  86. ${jsoncpp_install_dir}/lib/jsoncpp.lib)
  87. set_target_properties(snsuapi
  88. PROPERTIES
  89. COMPILE_OPTIONS "/bigobj")
  90. else()
  91. target_include_directories(snsuapi
  92. PRIVATE /usr/include/jsoncpp)
  93. target_link_libraries(snsuapi
  94. jsoncpp)
  95. endif()
  96. install(FILES ${snsuapi_public_header}
  97. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/snsuapi)
  98. install(FILES ${snsuapi_public_header_model}
  99. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/snsuapi/model)
  100. install(TARGETS snsuapi
  101. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  102. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  103. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  104. )