CMakeLists.txt 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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(et-industry-openapi_public_header
  18. include/alibabacloud/et-industry-openapi/Et_industry_openapiClient.h
  19. include/alibabacloud/et-industry-openapi/Et_industry_openapiExport.h )
  20. set(et-industry-openapi_public_header_model
  21. include/alibabacloud/et-industry-openapi/model/UploadDeviceDataRequest.h
  22. include/alibabacloud/et-industry-openapi/model/UploadDeviceDataResult.h )
  23. set(et-industry-openapi_src
  24. src/Et-industry-openapiClient.cc
  25. src/model/UploadDeviceDataRequest.cc
  26. src/model/UploadDeviceDataResult.cc )
  27. add_library(et-industry-openapi ${LIB_TYPE}
  28. ${et-industry-openapi_public_header}
  29. ${et-industry-openapi_public_header_model}
  30. ${et-industry-openapi_src})
  31. set_target_properties(et-industry-openapi
  32. PROPERTIES
  33. LINKER_LANGUAGE CXX
  34. ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  35. LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  36. RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
  37. OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}et-industry-openapi
  38. )
  39. if(${LIB_TYPE} STREQUAL "SHARED")
  40. set_target_properties(et-industry-openapi
  41. PROPERTIES
  42. DEFINE_SYMBOL ALIBABACLOUD_ET_INDUSTRY_OPENAPI_LIBRARY)
  43. endif()
  44. target_include_directories(et-industry-openapi
  45. PRIVATE include
  46. ${CMAKE_SOURCE_DIR}/core/include
  47. )
  48. target_link_libraries(et-industry-openapi
  49. core)
  50. if(CMAKE_HOST_WIN32)
  51. ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
  52. set(jsoncpp_install_dir ${INSTALL_DIR})
  53. add_dependencies(et-industry-openapi
  54. jsoncpp)
  55. target_include_directories(et-industry-openapi
  56. PRIVATE ${jsoncpp_install_dir}/include)
  57. target_link_libraries(et-industry-openapi
  58. ${jsoncpp_install_dir}/lib/jsoncpp.lib)
  59. set_target_properties(et-industry-openapi
  60. PROPERTIES
  61. COMPILE_OPTIONS "/bigobj")
  62. else()
  63. target_include_directories(et-industry-openapi
  64. PRIVATE /usr/include/jsoncpp)
  65. target_link_libraries(et-industry-openapi
  66. jsoncpp)
  67. endif()
  68. install(FILES ${et-industry-openapi_public_header}
  69. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/et-industry-openapi)
  70. install(FILES ${et-industry-openapi_public_header_model}
  71. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/et-industry-openapi/model)
  72. install(TARGETS et-industry-openapi
  73. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  74. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  75. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  76. )