Skip to content
This repository was archived by the owner on Jul 23, 2024. It is now read-only.

Commit b82d941

Browse files
author
Pierre de Fréminville
committed
Use CMake imported targets
1 parent 6c72703 commit b82d941

13 files changed

Lines changed: 154 additions & 1308 deletions

File tree

depends/libhdfs3/CMake/FindBoost.cmake

Lines changed: 0 additions & 1162 deletions
This file was deleted.

depends/libhdfs3/CMake/FindCurl.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,3 +24,12 @@ INCLUDE(FindPackageHandleStandardArgs)
2424
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL DEFAULT_MSG CURL_LIBRARIES CURL_INCLUDE_DIR)
2525

2626
MARK_AS_ADVANCED(CURL_INCLUDE_DIR CURL_LIBRARIES)
27+
28+
if(CURL_FOUND AND NOT TARGET Curl::Curl)
29+
add_library(Curl::Curl INTERFACE IMPORTED)
30+
set_target_properties(Curl::Curl
31+
PROPERTIES
32+
INTERFACE_INCLUDE_DIRECTORIES "${CURL_INCLUDE_DIR}"
33+
INTERFACE_LINK_LIBRARIES "${CURL_LIBRARIES}"
34+
)
35+
endif()

depends/libhdfs3/CMake/FindGSasl.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,13 @@ INCLUDE(FindPackageHandleStandardArgs)
2323
# all listed variables are TRUE
2424
FIND_PACKAGE_HANDLE_STANDARD_ARGS(GSASL DEFAULT_MSG GSASL_LIBRARIES GSASL_INCLUDE_DIR)
2525

26-
MARK_AS_ADVANCED(GSASL_INCLUDE_DIR GSASL_LIBRARIES)
26+
MARK_AS_ADVANCED(GSASL_INCLUDE_DIR GSASL_LIBRARIES)
27+
28+
if(GSASL_FOUND AND NOT TARGET GSASL::GSASL)
29+
add_library(GSASL::GSASL INTERFACE IMPORTED)
30+
set_target_properties(GSASL::GSASL
31+
PROPERTIES
32+
INTERFACE_INCLUDE_DIRECTORIES "${GSASL_INCLUDE_DIR}"
33+
INTERFACE_LINK_LIBRARIES "${GSASL_LIBRARIES}"
34+
)
35+
endif()

depends/libhdfs3/CMake/FindGoogleTest.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,3 +63,12 @@ set(GoogleTest_LIBRARIES ${Gtest_LIBRARY} ${Gmock_LIBRARY})
6363
mark_as_advanced(
6464
GoogleTest_INCLUDE_DIR
6565
GoogleTest_LIBRARIES)
66+
67+
if(GoogleTest_FOUND AND NOT TARGET GoogleTest::GoogleTest)
68+
add_library(GoogleTest::GoogleTest INTERFACE IMPORTED)
69+
set_target_properties(GoogleTest::GoogleTest
70+
PROPERTIES
71+
INTERFACE_INCLUDE_DIRECTORIES "${GoogleTest_INCLUDE_DIR}"
72+
INTERFACE_LINK_LIBRARIES "${GoogleTest_LIBRARIES}"
73+
)
74+
endif()

depends/libhdfs3/CMake/FindKERBEROS.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@ INCLUDE(FindPackageHandleStandardArgs)
2121
FIND_PACKAGE_HANDLE_STANDARD_ARGS(KERBEROS DEFAULT_MSG KERBEROS_LIBRARIES KERBEROS_INCLUDE_DIRS)
2222

2323
MARK_AS_ADVANCED(KERBEROS_LIBRARIES KERBEROS_INCLUDE_DIRS)
24+
25+
if(KERBEROS_FOUND AND NOT TARGET KERBEROS::KERBEROS)
26+
add_library(KERBEROS::KERBEROS INTERFACE IMPORTED)
27+
set_target_properties(KERBEROS::KERBEROS
28+
PROPERTIES
29+
INTERFACE_INCLUDE_DIRECTORIES "${KERBEROS_INCLUDE_DIRS}"
30+
INTERFACE_LINK_LIBRARIES "${KERBEROS_LIBRARIES}"
31+
)
32+
endif()

depends/libhdfs3/CMake/FindLibUUID.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,12 @@ INCLUDE(FindPackageHandleStandardArgs)
2121
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBUUID DEFAULT_MSG LIBUUID_LIBRARIES LIBUUID_INCLUDE_DIRS)
2222

2323
MARK_AS_ADVANCED(LIBUUID_LIBRARIES LIBUUID_INCLUDE_DIRS)
24+
25+
if(LIBUUID_FOUND AND NOT TARGET LibUUID::LibUUID)
26+
add_library(LibUUID::LibUUID INTERFACE IMPORTED)
27+
set_target_properties(LibUUID::LibUUID
28+
PROPERTIES
29+
INTERFACE_INCLUDE_DIRECTORIES "${LIBUUID_INCLUDE_DIRS}"
30+
INTERFACE_LINK_LIBRARIES "${LIBUUID_LIBRARIES}"
31+
)
32+
endif()

depends/libhdfs3/CMake/FindSSL.cmake

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,4 +23,13 @@ INCLUDE(FindPackageHandleStandardArgs)
2323
# all listed variables are TRUE
2424
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SSL DEFAULT_MSG SSL_LIBRARIES SSL_INCLUDE_DIR)
2525

26-
MARK_AS_ADVANCED(SSL_INCLUDE_DIR SSL_LIBRARIES)
26+
MARK_AS_ADVANCED(SSL_INCLUDE_DIR SSL_LIBRARIES)
27+
28+
if(SSL_FOUND AND NOT TARGET SSL::SSL)
29+
add_library(SSL::SSL INTERFACE IMPORTED)
30+
set_target_properties(SSL::SSL
31+
PROPERTIES
32+
INTERFACE_INCLUDE_DIRECTORIES "${SSL_INCLUDE_DIR}"
33+
INTERFACE_LINK_LIBRARIES "${SSL_LIBRARIES}"
34+
)
35+
endif()

depends/libhdfs3/CMakeLists.txt

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,8 @@ FIND_PACKAGE(KERBEROS REQUIRED)
2222
FIND_PACKAGE(GSasl REQUIRED)
2323
FIND_PACKAGE(GoogleTest REQUIRED)
2424
FIND_PACKAGE(SSL REQUIRED)
25-
FIND_PACKAGE(CURL REQUIRED)
26-
INCLUDE_DIRECTORIES(${GoogleTest_INCLUDE_DIR})
27-
LINK_LIBRARIES(${GoogleTest_LIBRARIES})
25+
FIND_PACKAGE(Curl REQUIRED)
26+
FIND_PACKAGE(Boost REQUIRED)
2827

2928
IF(OS_LINUX)
3029
FIND_PACKAGE(LibUUID REQUIRED)

depends/libhdfs3/src/CMakeLists.txt

Lines changed: 37 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -58,18 +58,19 @@ ADD_CUSTOM_COMMAND(
5858
TARGET_LINK_LIBRARIES(libhdfs3-static pthread)
5959
TARGET_LINK_LIBRARIES(libhdfs3-shared pthread)
6060

61+
TARGET_LINK_LIBRARIES(libhdfs3-static Boost::boost)
62+
TARGET_LINK_LIBRARIES(libhdfs3-shared Boost::boost)
6163
IF(NEED_BOOST)
62-
INCLUDE_DIRECTORIES(${Boost_INCLUDE_DIR})
63-
TARGET_LINK_LIBRARIES(libhdfs3-static boost_thread)
64-
TARGET_LINK_LIBRARIES(libhdfs3-static boost_chrono)
65-
TARGET_LINK_LIBRARIES(libhdfs3-static boost_system)
66-
TARGET_LINK_LIBRARIES(libhdfs3-static boost_atomic)
67-
TARGET_LINK_LIBRARIES(libhdfs3-static boost_iostreams)
68-
TARGET_LINK_LIBRARIES(libhdfs3-shared boost_thread)
69-
TARGET_LINK_LIBRARIES(libhdfs3-shared boost_chrono)
70-
TARGET_LINK_LIBRARIES(libhdfs3-shared boost_system)
71-
TARGET_LINK_LIBRARIES(libhdfs3-shared boost_atomic)
72-
TARGET_LINK_LIBRARIES(libhdfs3-shared boost_iostreams)
64+
TARGET_LINK_LIBRARIES(libhdfs3-static Boost::thread)
65+
TARGET_LINK_LIBRARIES(libhdfs3-static Boost::chrono)
66+
TARGET_LINK_LIBRARIES(libhdfs3-static Boost::system)
67+
TARGET_LINK_LIBRARIES(libhdfs3-static Boost::atomic)
68+
TARGET_LINK_LIBRARIES(libhdfs3-static Boost::iostreams)
69+
TARGET_LINK_LIBRARIES(libhdfs3-shared Boost::thread)
70+
TARGET_LINK_LIBRARIES(libhdfs3-shared Boost::chrono)
71+
TARGET_LINK_LIBRARIES(libhdfs3-shared Boost::system)
72+
TARGET_LINK_LIBRARIES(libhdfs3-shared Boost::atomic)
73+
TARGET_LINK_LIBRARIES(libhdfs3-shared Boost::iostreams)
7374
ENDIF(NEED_BOOST)
7475

7576
IF(NEED_GCCEH)
@@ -78,43 +79,37 @@ IF(NEED_GCCEH)
7879
ENDIF(NEED_GCCEH)
7980

8081
IF(OS_LINUX)
81-
TARGET_LINK_LIBRARIES(libhdfs3-static ${LIBUUID_LIBRARIES})
82-
TARGET_LINK_LIBRARIES(libhdfs3-shared ${LIBUUID_LIBRARIES})
83-
INCLUDE_DIRECTORIES(${LIBUUID_INCLUDE_DIRS})
82+
TARGET_LINK_LIBRARIES(libhdfs3-static LibUUID::LibUUID)
83+
TARGET_LINK_LIBRARIES(libhdfs3-shared LibUUID::LibUUID)
8484
ENDIF(OS_LINUX)
8585

86-
INCLUDE_DIRECTORIES(${libhdfs3_ROOT_SOURCES_DIR})
87-
INCLUDE_DIRECTORIES(${libhdfs3_COMMON_SOURCES_DIR})
88-
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_BINARY_DIR})
89-
INCLUDE_DIRECTORIES(${PROTOBUF_INCLUDE_DIRS})
90-
INCLUDE_DIRECTORIES(${LIBXML2_INCLUDE_DIR})
91-
INCLUDE_DIRECTORIES(${KERBEROS_INCLUDE_DIRS})
92-
INCLUDE_DIRECTORIES(${GSASL_INCLUDE_DIR})
93-
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/mock)
94-
INCLUDE_DIRECTORIES(${SSL_INCLUDE_DIR})
95-
INCLUDE_DIRECTORIES(${CURL_INCLUDE_DIR})
96-
97-
TARGET_LINK_LIBRARIES(libhdfs3-static ${PROTOBUF_LIBRARIES})
98-
TARGET_LINK_LIBRARIES(libhdfs3-static ${LIBXML2_LIBRARIES})
99-
TARGET_LINK_LIBRARIES(libhdfs3-static ${KERBEROS_LIBRARIES})
100-
TARGET_LINK_LIBRARIES(libhdfs3-static ${GSASL_LIBRARIES})
101-
TARGET_LINK_LIBRARIES(libhdfs3-static ${SSL_LIBRARIES})
102-
TARGET_LINK_LIBRARIES(libhdfs3-static ${CURL_LIBRARIES})
103-
104-
TARGET_LINK_LIBRARIES(libhdfs3-shared ${PROTOBUF_LIBRARIES})
105-
TARGET_LINK_LIBRARIES(libhdfs3-shared ${LIBXML2_LIBRARIES})
106-
TARGET_LINK_LIBRARIES(libhdfs3-shared ${KERBEROS_LIBRARIES})
107-
TARGET_LINK_LIBRARIES(libhdfs3-shared ${GSASL_LIBRARIES})
108-
TARGET_LINK_LIBRARIES(libhdfs3-shared ${SSL_LIBRARIES})
109-
TARGET_LINK_LIBRARIES(libhdfs3-shared ${CURL_LIBRARIES})
86+
TARGET_INCLUDE_DIRECTORIES(libhdfs3-static PUBLIC ${libhdfs3_ROOT_SOURCES_DIR})
87+
TARGET_INCLUDE_DIRECTORIES(libhdfs3-static PUBLIC ${libhdfs3_COMMON_SOURCES_DIR})
88+
TARGET_INCLUDE_DIRECTORIES(libhdfs3-static PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
89+
TARGET_INCLUDE_DIRECTORIES(libhdfs3-static PUBLIC ${CMAKE_SOURCE_DIR}/mock)
90+
91+
TARGET_INCLUDE_DIRECTORIES(libhdfs3-shared PUBLIC ${libhdfs3_ROOT_SOURCES_DIR})
92+
TARGET_INCLUDE_DIRECTORIES(libhdfs3-shared PUBLIC ${libhdfs3_COMMON_SOURCES_DIR})
93+
TARGET_INCLUDE_DIRECTORIES(libhdfs3-shared PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
94+
TARGET_INCLUDE_DIRECTORIES(libhdfs3-shared PUBLIC ${CMAKE_SOURCE_DIR}/mock)
95+
96+
TARGET_LINK_LIBRARIES(libhdfs3-static protobuf::libprotobuf)
97+
TARGET_LINK_LIBRARIES(libhdfs3-static LibXml2::LibXml2)
98+
TARGET_LINK_LIBRARIES(libhdfs3-static KERBEROS::KERBEROS)
99+
TARGET_LINK_LIBRARIES(libhdfs3-static GSASL::GSASL)
100+
TARGET_LINK_LIBRARIES(libhdfs3-static SSL::SSL)
101+
TARGET_LINK_LIBRARIES(libhdfs3-static Curl::Curl)
102+
103+
TARGET_LINK_LIBRARIES(libhdfs3-shared protobuf::libprotobuf)
104+
TARGET_LINK_LIBRARIES(libhdfs3-shared LibXml2::LibXml2)
105+
TARGET_LINK_LIBRARIES(libhdfs3-shared KERBEROS::KERBEROS)
106+
TARGET_LINK_LIBRARIES(libhdfs3-shared GSASL::GSASL)
107+
TARGET_LINK_LIBRARIES(libhdfs3-shared SSL::SSL)
108+
TARGET_LINK_LIBRARIES(libhdfs3-shared Curl::Curl)
110109

111110
SET_TARGET_PROPERTIES(libhdfs3-static PROPERTIES OUTPUT_NAME "hdfs3")
112111
SET_TARGET_PROPERTIES(libhdfs3-shared PROPERTIES OUTPUT_NAME "hdfs3")
113112

114-
IF(NEED_BOOST)
115-
SET_TARGET_PROPERTIES(libhdfs3-shared libhdfs3-static PROPERTIES LINK_FLAGS "-L${Boost_LIBRARY_DIRS}")
116-
ENDIF(NEED_BOOST)
117-
118113
SET_TARGET_PROPERTIES(libhdfs3-shared PROPERTIES
119114
VERSION ${libhdfs3_VERSION_MAJOR}.${libhdfs3_VERSION_MINOR}.${libhdfs3_VERSION_PATCH}
120115
SOVERSION ${libhdfs3_VERSION_API})

depends/libhdfs3/src/client/CryptoCodec.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ namespace Hdfs {
126126
return -1;
127127
}
128128

129-
LOG(DEBUG3, "CryptoCodec init success, length of the decrypted key is : %llu, crypto method is : %d", AlgorithmBlockSize, crypto_method);
129+
LOG(DEBUG3, "CryptoCodec init success, length of the decrypted key is : %lu, crypto method is : %d", AlgorithmBlockSize, crypto_method);
130130
return 1;
131131

132132
}

0 commit comments

Comments
 (0)