CMakeLists.txt 2.4 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(dms_public_header
  18. include/alibabacloud/dms/DmsClient.h
  19. include/alibabacloud/dms/DmsExport.h )
  20. set(dms_public_header_model
  21. include/alibabacloud/dms/model/CreateAirflowLoginTokenRequest.h
  22. include/alibabacloud/dms/model/CreateAirflowLoginTokenResult.h )
  23. set(dms_src
  24. src/DmsClient.cc
  25. src/model/CreateAirflowLoginTokenRequest.cc
  26. src/model/CreateAirflowLoginTokenResult.cc )
  27. add_library(dms ${LIB_TYPE}
  28. ${dms_public_header}
  29. ${dms_public_header_model}
  30. ${dms_src})
  31. set_target_properties(dms
  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}dms
  38. )
  39. if(${LIB_TYPE} STREQUAL "SHARED")
  40. set_target_properties(dms
  41. PROPERTIES
  42. DEFINE_SYMBOL ALIBABACLOUD_DMS_LIBRARY)
  43. endif()
  44. target_include_directories(dms
  45. PRIVATE include
  46. ${CMAKE_SOURCE_DIR}/core/include
  47. )
  48. target_link_libraries(dms
  49. core)
  50. if(CMAKE_HOST_WIN32)
  51. ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
  52. set(jsoncpp_install_dir ${INSTALL_DIR})
  53. add_dependencies(dms
  54. jsoncpp)
  55. target_include_directories(dms
  56. PRIVATE ${jsoncpp_install_dir}/include)
  57. target_link_libraries(dms
  58. ${jsoncpp_install_dir}/lib/jsoncpp.lib)
  59. set_target_properties(dms
  60. PROPERTIES
  61. COMPILE_OPTIONS "/bigobj")
  62. else()
  63. target_include_directories(dms
  64. PRIVATE /usr/include/jsoncpp)
  65. target_link_libraries(dms
  66. jsoncpp)
  67. endif()
  68. install(FILES ${dms_public_header}
  69. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/dms)
  70. install(FILES ${dms_public_header_model}
  71. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/dms/model)
  72. install(TARGETS dms
  73. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  74. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  75. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  76. )