-
Notifications
You must be signed in to change notification settings - Fork 6.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cmake: cmake related cleanups #5662
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
# - Find JeMalloc library | ||
# Find the native JeMalloc includes and library | ||
# | ||
# JEMALLOC_INCLUDE_DIR - where to find jemalloc.h, etc. | ||
# JEMALLOC_LIBRARIES - List of libraries when using jemalloc. | ||
# JEMALLOC_FOUND - True if jemalloc found. | ||
# JeMalloc_INCLUDE_DIRS - where to find jemalloc.h, etc. | ||
# JeMalloc_LIBRARIES - List of libraries when using jemalloc. | ||
# JeMalloc_FOUND - True if jemalloc found. | ||
|
||
find_path(JEMALLOC_INCLUDE_DIR | ||
find_path(JeMalloc_INCLUDE_DIRS | ||
NAMES jemalloc/jemalloc.h | ||
HINTS ${JEMALLOC_ROOT_DIR}/include) | ||
|
||
find_library(JEMALLOC_LIBRARIES | ||
find_library(JeMalloc_LIBRARIES | ||
NAMES jemalloc | ||
HINTS ${JEMALLOC_ROOT_DIR}/lib) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(jemalloc DEFAULT_MSG JEMALLOC_LIBRARIES JEMALLOC_INCLUDE_DIR) | ||
find_package_handle_standard_args(JeMalloc DEFAULT_MSG JeMalloc_LIBRARIES JeMalloc_INCLUDE_DIRS) | ||
|
||
mark_as_advanced( | ||
JEMALLOC_LIBRARIES | ||
JEMALLOC_INCLUDE_DIR) | ||
JeMalloc_LIBRARIES | ||
JeMalloc_INCLUDE_DIRS) | ||
|
||
if(JeMalloc_FOUND AND NOT (TARGET JeMalloc::JeMalloc)) | ||
add_library (JeMalloc::JeMalloc UNKNOWN IMPORTED) | ||
set_target_properties(JeMalloc::JeMalloc | ||
PROPERTIES | ||
IMPORTED_LOCATION ${JeMalloc_LIBRARIES} | ||
INTERFACE_INCLUDE_DIRECTORIES ${JeMalloc_INCLUDE_DIRS}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,33 @@ | ||
# - Find TBB | ||
# Find the Thread Building Blocks library and includes | ||
# | ||
# TBB_INCLUDE_DIR - where to find tbb.h, etc. | ||
# TBB_INCLUDE_DIRS - where to find tbb.h, etc. | ||
# TBB_LIBRARIES - List of libraries when using TBB. | ||
# TBB_FOUND - True if TBB found. | ||
|
||
if(NOT DEFINED TBB_ROOT_DIR) | ||
set(TBB_ROOT_DIR "$ENV{TBBROOT}") | ||
endif() | ||
|
||
find_path(TBB_INCLUDE_DIR | ||
NAMES tbb/tbb.h | ||
HINTS ${TBB_ROOT_DIR}/include) | ||
find_path(TBB_INCLUDE_DIRS | ||
NAMES tbb/tbb.h | ||
HINTS ${TBB_ROOT_DIR}/include) | ||
|
||
find_library(TBB_LIBRARIES | ||
NAMES tbb | ||
HINTS ${TBB_ROOT_DIR}/lib ENV LIBRARY_PATH) | ||
NAMES tbb | ||
HINTS ${TBB_ROOT_DIR}/lib ENV LIBRARY_PATH) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(TBB DEFAULT_MSG TBB_LIBRARIES TBB_INCLUDE_DIR) | ||
find_package_handle_standard_args(TBB DEFAULT_MSG TBB_LIBRARIES TBB_INCLUDE_DIRS) | ||
|
||
mark_as_advanced( | ||
TBB_LIBRARIES | ||
TBB_INCLUDE_DIR) | ||
TBB_LIBRARIES | ||
TBB_INCLUDE_DIRS) | ||
|
||
if(TBB_FOUND AND NOT (TARGET TBB::TBB)) | ||
add_library (TBB::TBB UNKNOWN IMPORTED) | ||
set_target_properties(TBB::TBB | ||
PROPERTIES | ||
IMPORTED_LOCATION ${TBB_LIBRARIES} | ||
INTERFACE_INCLUDE_DIRECTORIES ${TBB_INCLUDE_DIRS}) | ||
endif() |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
# - Find Lz4 | ||
# Find the lz4 compression library and includes | ||
# | ||
# LZ4_INCLUDE_DIR - where to find lz4.h, etc. | ||
# LZ4_LIBRARIES - List of libraries when using lz4. | ||
# LZ4_FOUND - True if lz4 found. | ||
# lz4_INCLUDE_DIRS - where to find lz4.h, etc. | ||
# lz4_LIBRARIES - List of libraries when using lz4. | ||
# lz4_FOUND - True if lz4 found. | ||
|
||
find_path(LZ4_INCLUDE_DIR | ||
find_path(lz4_INCLUDE_DIRS | ||
NAMES lz4.h | ||
HINTS ${LZ4_ROOT_DIR}/include) | ||
HINTS ${lz4_ROOT_DIR}/include) | ||
|
||
find_library(LZ4_LIBRARIES | ||
find_library(lz4_LIBRARIES | ||
NAMES lz4 | ||
HINTS ${LZ4_ROOT_DIR}/lib) | ||
HINTS ${lz4_ROOT_DIR}/lib) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(lz4 DEFAULT_MSG LZ4_LIBRARIES LZ4_INCLUDE_DIR) | ||
find_package_handle_standard_args(lz4 DEFAULT_MSG lz4_LIBRARIES lz4_INCLUDE_DIRS) | ||
|
||
mark_as_advanced( | ||
LZ4_LIBRARIES | ||
LZ4_INCLUDE_DIR) | ||
lz4_LIBRARIES | ||
lz4_INCLUDE_DIRS) | ||
|
||
if(lz4_FOUND AND NOT (TARGET lz4::lz4)) | ||
add_library(lz4::lz4 UNKNOWN IMPORTED) | ||
set_target_properties(lz4::lz4 | ||
PROPERTIES | ||
IMPORTED_LOCATION ${lz4_LIBRARIES} | ||
INTERFACE_INCLUDE_DIRECTORIES ${lz4_INCLUDE_DIRS}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,29 @@ | ||
# - Find Snappy | ||
# Find the snappy compression library and includes | ||
# | ||
# SNAPPY_INCLUDE_DIR - where to find snappy.h, etc. | ||
# SNAPPY_LIBRARIES - List of libraries when using snappy. | ||
# SNAPPY_FOUND - True if snappy found. | ||
# snappy_INCLUDE_DIRS - where to find snappy.h, etc. | ||
# snappy_LIBRARIES - List of libraries when using snappy. | ||
# snappy_FOUND - True if snappy found. | ||
|
||
find_path(SNAPPY_INCLUDE_DIR | ||
find_path(snappy_INCLUDE_DIRS | ||
NAMES snappy.h | ||
HINTS ${SNAPPY_ROOT_DIR}/include) | ||
HINTS ${snappy_ROOT_DIR}/include) | ||
|
||
find_library(SNAPPY_LIBRARIES | ||
NAMES snappy | ||
HINTS ${SNAPPY_ROOT_DIR}/lib) | ||
HINTS ${snappy_ROOT_DIR}/lib) | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(snappy DEFAULT_MSG SNAPPY_LIBRARIES SNAPPY_INCLUDE_DIR) | ||
find_package_handle_standard_args(snappy DEFAULT_MSG snappy_LIBRARIES snappy_INCLUDE_DIRS) | ||
|
||
mark_as_advanced( | ||
SNAPPY_LIBRARIES | ||
SNAPPY_INCLUDE_DIR) | ||
snappy_LIBRARIES | ||
snappy_INCLUDE_DIRS) | ||
|
||
if(snappy_FOUND AND NOT (TARGET snappy::snappy)) | ||
add_library (snappy::snappy UNKNOWN IMPORTED) | ||
set_target_properties(snappy::snappy | ||
PROPERTIES | ||
IMPORTED_LOCATION ${snappy_LIBRARIES} | ||
INTERFACE_INCLUDE_DIRECTORIES ${snappy_INCLUDE_DIRS}) | ||
endif() |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov Why do you remove this line? Seems that cannot find it in include path. Errors like
/root/cs/suzanwen/repos/C++/storage/rocksdb_xxx/rocksdb/util/compression.h:31:20: fatal error: snappy.h: No such file or directory #include <snappy.h> ^ compilation terminated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because, IIUC, snappy::snappy should be able to populate the "INSTALL_INTERFACE" property to the library/executable linked against it, so cmake will determine the correct build property of consumer of snappy::snappy and library publicly linked against this library.
rocksdb/cmake/modules/Findsnappy.cmake
Line 28 in f65ec09
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, that's right for the most targets, such as
ROCKSDB_STATIC_LIB
. But not forTESTUTILLIB
. Plz have a glance at the following snippet.rocksdb/CMakeLists.txt
Line 1072 in f65ec09
snappy.h
was included indb/db_test_util.cc
(just as the source file in targetTESTUTILLIB
). Porbably we need make it works fine withtarget_link_libraries(${TESTUTILLIB} ${LIBS})
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@tchaikov #6043 pr as it is, plz make a review.