CMakeLists.txt 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. #
  2. # Licensed to the Apache Software Foundation (ASF) under one
  3. # or more contributor license agreements. See the NOTICE file
  4. # distributed with this work for additional information
  5. # regarding copyright ownership. The ASF licenses this file
  6. # to you under the Apache License, Version 2.0 (the
  7. # "License"); you may not use this file except in compliance
  8. # with the License. You may obtain a copy of the License at
  9. #
  10. # http://www.apache.org/licenses/LICENSE-2.0
  11. #
  12. # Unless required by applicable law or agreed to in writing, software
  13. # distributed under the License is distributed on an "AS IS" BASIS,
  14. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. # See the License for the specific language governing permissions and
  16. # limitations under the License.
  17. #
  18. find_package(Boost 1.72 COMPONENTS program_options REQUIRED)
  19. # Default LIBHDFSPP_DIR to the default install location. You can override
  20. # it by add -DLIBHDFSPP_DIR=... to your cmake invocation
  21. set(LIBHDFSPP_DIR CACHE STRING ${CMAKE_INSTALL_PREFIX})
  22. include_directories( ${LIBHDFSPP_DIR}/include )
  23. link_directories( ${LIBHDFSPP_DIR}/lib )
  24. add_library(tools_common_obj OBJECT tools_common.cc)
  25. add_library(tools_common $<TARGET_OBJECTS:tools_common_obj>)
  26. add_library(hdfs_tool_obj OBJECT hdfs-tool.cc)
  27. target_include_directories(hdfs_tool_obj PRIVATE ../tools)
  28. add_executable(hdfs_cat hdfs_cat.cc)
  29. target_link_libraries(hdfs_cat tools_common hdfspp_static)
  30. add_executable(hdfs_chgrp hdfs_chgrp.cc)
  31. target_link_libraries(hdfs_chgrp tools_common hdfspp_static)
  32. add_executable(hdfs_chown hdfs_chown.cc)
  33. target_link_libraries(hdfs_chown tools_common hdfspp_static)
  34. add_executable(hdfs_chmod hdfs_chmod.cc)
  35. target_link_libraries(hdfs_chmod tools_common hdfspp_static)
  36. add_executable(hdfs_find hdfs_find.cc)
  37. target_link_libraries(hdfs_find tools_common hdfspp_static)
  38. add_executable(hdfs_mkdir hdfs_mkdir.cc)
  39. target_link_libraries(hdfs_mkdir tools_common hdfspp_static)
  40. add_executable(hdfs_rm hdfs_rm.cc)
  41. target_link_libraries(hdfs_rm tools_common hdfspp_static)
  42. add_executable(hdfs_ls hdfs_ls.cc)
  43. target_link_libraries(hdfs_ls tools_common hdfspp_static)
  44. add_executable(hdfs_stat hdfs_stat.cc)
  45. target_link_libraries(hdfs_stat tools_common hdfspp_static)
  46. add_executable(hdfs_count hdfs_count.cc)
  47. target_link_libraries(hdfs_count tools_common hdfspp_static)
  48. add_executable(hdfs_df hdfs_df.cc)
  49. target_link_libraries(hdfs_df tools_common hdfspp_static)
  50. add_executable(hdfs_du hdfs_du.cc)
  51. target_link_libraries(hdfs_du tools_common hdfspp_static)
  52. add_executable(hdfs_get hdfs_get.cc)
  53. target_link_libraries(hdfs_get tools_common hdfspp_static)
  54. add_executable(hdfs_copyToLocal hdfs_copyToLocal.cc)
  55. target_link_libraries(hdfs_copyToLocal tools_common hdfspp_static)
  56. add_executable(hdfs_moveToLocal hdfs_moveToLocal.cc)
  57. target_link_libraries(hdfs_moveToLocal tools_common hdfspp_static)
  58. add_executable(hdfs_setrep hdfs_setrep.cc)
  59. target_link_libraries(hdfs_setrep tools_common hdfspp_static)
  60. add_library(hdfs_allowSnapshot_lib STATIC $<TARGET_OBJECTS:hdfs_tool_obj> hdfs-allow-snapshot/hdfs-allow-snapshot.cc)
  61. target_include_directories(hdfs_allowSnapshot_lib PRIVATE ../tools allow-snapshot ${Boost_INCLUDE_DIRS})
  62. target_link_libraries(hdfs_allowSnapshot_lib PRIVATE Boost::boost Boost::program_options tools_common hdfspp_static)
  63. add_executable(hdfs_allowSnapshot hdfs-allow-snapshot/main.cc)
  64. target_include_directories(hdfs_allowSnapshot PRIVATE ../tools)
  65. target_link_libraries(hdfs_allowSnapshot PRIVATE hdfs_allowSnapshot_lib)
  66. add_executable(hdfs_disallowSnapshot hdfs_disallowSnapshot.cc)
  67. target_link_libraries(hdfs_disallowSnapshot tools_common hdfspp_static)
  68. add_executable(hdfs_createSnapshot hdfs_createSnapshot.cc)
  69. target_link_libraries(hdfs_createSnapshot tools_common hdfspp_static)
  70. add_executable(hdfs_renameSnapshot hdfs_renameSnapshot.cc)
  71. target_link_libraries(hdfs_renameSnapshot tools_common hdfspp_static)
  72. add_executable(hdfs_deleteSnapshot hdfs_deleteSnapshot.cc)
  73. target_link_libraries(hdfs_deleteSnapshot tools_common hdfspp_static)
  74. add_executable(hdfs_tail hdfs_tail.cc)
  75. target_link_libraries(hdfs_tail tools_common hdfspp_static)