CMakeLists.txt 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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(sts_public_header
  18. include/alibabacloud/sts/StsClient.h
  19. include/alibabacloud/sts/StsExport.h )
  20. set(sts_public_header_model
  21. include/alibabacloud/sts/model/AssumeRoleRequest.h
  22. include/alibabacloud/sts/model/AssumeRoleResult.h
  23. include/alibabacloud/sts/model/AssumeRoleWithOIDCRequest.h
  24. include/alibabacloud/sts/model/AssumeRoleWithOIDCResult.h
  25. include/alibabacloud/sts/model/AssumeRoleWithSAMLRequest.h
  26. include/alibabacloud/sts/model/AssumeRoleWithSAMLResult.h
  27. include/alibabacloud/sts/model/GetCallerIdentityRequest.h
  28. include/alibabacloud/sts/model/GetCallerIdentityResult.h )
  29. set(sts_src
  30. src/StsClient.cc
  31. src/model/AssumeRoleRequest.cc
  32. src/model/AssumeRoleResult.cc
  33. src/model/AssumeRoleWithOIDCRequest.cc
  34. src/model/AssumeRoleWithOIDCResult.cc
  35. src/model/AssumeRoleWithSAMLRequest.cc
  36. src/model/AssumeRoleWithSAMLResult.cc
  37. src/model/GetCallerIdentityRequest.cc
  38. src/model/GetCallerIdentityResult.cc )
  39. add_library(sts ${LIB_TYPE}
  40. ${sts_public_header}
  41. ${sts_public_header_model}
  42. ${sts_src})
  43. set_target_properties(sts
  44. PROPERTIES
  45. LINKER_LANGUAGE CXX
  46. ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  47. LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  48. RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
  49. OUTPUT_NAME ${TARGET_OUTPUT_NAME_PREFIX}sts
  50. )
  51. if(${LIB_TYPE} STREQUAL "SHARED")
  52. set_target_properties(sts
  53. PROPERTIES
  54. DEFINE_SYMBOL ALIBABACLOUD_STS_LIBRARY)
  55. endif()
  56. target_include_directories(sts
  57. PRIVATE include
  58. ${CMAKE_SOURCE_DIR}/core/include
  59. )
  60. target_link_libraries(sts
  61. core)
  62. if(CMAKE_HOST_WIN32)
  63. ExternalProject_Get_Property(jsoncpp INSTALL_DIR)
  64. set(jsoncpp_install_dir ${INSTALL_DIR})
  65. add_dependencies(sts
  66. jsoncpp)
  67. target_include_directories(sts
  68. PRIVATE ${jsoncpp_install_dir}/include)
  69. target_link_libraries(sts
  70. ${jsoncpp_install_dir}/lib/jsoncpp.lib)
  71. set_target_properties(sts
  72. PROPERTIES
  73. COMPILE_OPTIONS "/bigobj")
  74. else()
  75. target_include_directories(sts
  76. PRIVATE /usr/include/jsoncpp)
  77. target_link_libraries(sts
  78. jsoncpp)
  79. endif()
  80. install(FILES ${sts_public_header}
  81. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/sts)
  82. install(FILES ${sts_public_header_model}
  83. DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/alibabacloud/sts/model)
  84. install(TARGETS sts
  85. ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
  86. LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
  87. RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
  88. )