diff options
author | Luke Chen <luke.chen@mongodb.com> | 2021-11-02 18:34:29 +1100 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-11-02 07:59:03 +0000 |
commit | 318cd8acd85ebe2d48ee87339ad5d63eea4612d5 (patch) | |
tree | 81c465160cf547418d835482949b1c51733bcda7 /src/third_party/wiredtiger/cmake | |
parent | 4820b9ad9659aa7ad1a9e20f25cd2604531eddef (diff) | |
download | mongo-318cd8acd85ebe2d48ee87339ad5d63eea4612d5.tar.gz |
Import wiredtiger: 667eff40028852a989c9295be0e1c8c9d323ba75 from branch mongodb-master
ref: bc1c3dc0d4..667eff4002
for: 5.2.0
WT-8285 Simplify CMakes use of third party libraries
Diffstat (limited to 'src/third_party/wiredtiger/cmake')
7 files changed, 304 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/cmake/helpers.cmake b/src/third_party/wiredtiger/cmake/helpers.cmake index bec3477d45e..77a7961e499 100644 --- a/src/third_party/wiredtiger/cmake/helpers.cmake +++ b/src/third_party/wiredtiger/cmake/helpers.cmake @@ -422,13 +422,14 @@ function(config_lib config_name description) find_library(has_lib_${config_name} ${CONFIG_LIB_LIB}) set(CMAKE_REQUIRED_FLAGS) set(has_lib "0") + set(has_include "") if(has_lib_${config_name}) set(has_lib ${has_lib_${config_name}}) if (CONFIG_LIB_HEADER) find_path(include_path_${config_name} ${CONFIG_LIB_HEADER}) if (include_path_${config_name}) message("-- Looking for library ${CONFIG_LIB_LIB}: found ${has_lib_${config_name}}, include path ${include_path_${config_name}}") - include_directories(${include_path_${config_name}}) + set(has_include ${include_path_${config_name}}) else() message("-- Looking for library ${CONFIG_LIB_LIB}: found ${has_lib_${config_name}}") endif() @@ -444,8 +445,10 @@ function(config_lib config_name description) if(${config_name}_DISABLED) unset(${config_name}_DISABLED CACHE) set(${config_name} ${has_lib} CACHE STRING "${description}" FORCE) + set(${config_name}_INCLUDES ${has_include} CACHE STRING "Additional include paths for ${config_name}" FORCE) else() set(${config_name} ${has_lib} CACHE STRING "${description}") + set(${config_name}_INCLUDES ${has_include} CACHE STRING "Additional include paths for ${config_name}") endif() # 'check_library_exists' sets our given temp variable into the cache. Clear this so it doesn't persist between # configuration runs. diff --git a/src/third_party/wiredtiger/cmake/third_party/gperftools.cmake b/src/third_party/wiredtiger/cmake/third_party/gperftools.cmake new file mode 100644 index 00000000000..1062050f9b1 --- /dev/null +++ b/src/third_party/wiredtiger/cmake/third_party/gperftools.cmake @@ -0,0 +1,50 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +if(NOT HAVE_LIBTCMALLOC) + # We don't need to construct a tcmalloc library target. + return() +endif() + +if(TARGET wt::tcmalloc) + # Avoid redefining the imported library. + return() +endif() + +# Construct an imported tcmalloc target the project can use. We use the double colons (::) as +# a convention to tell CMake that the target name is associated with an IMPORTED target (which +# allows CMake to issue a diagnostic message if the library wasn't found). +add_library(wt::tcmalloc SHARED IMPORTED GLOBAL) +set_target_properties(wt::tcmalloc PROPERTIES + IMPORTED_LOCATION ${HAVE_LIBTCMALLOC} +) +if(HAVE_LIBTCMALLOC_INCLUDES) + set_target_properties(wt::tcmalloc PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${HAVE_LIBTCMALLOC_INCLUDES} + ) +endif() diff --git a/src/third_party/wiredtiger/cmake/third_party/lz4.cmake b/src/third_party/wiredtiger/cmake/third_party/lz4.cmake new file mode 100644 index 00000000000..55653a0c8ed --- /dev/null +++ b/src/third_party/wiredtiger/cmake/third_party/lz4.cmake @@ -0,0 +1,50 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +if(NOT HAVE_LIBLZ4) + # We don't need to construct a lz4 library target. + return() +endif() + +if(TARGET wt::lz4) + # Avoid redefining the imported library, given this file can be used as an include. + return() +endif() + +# Define the imported lz4 library target that can be subsequently linked across the build system. +# We use the double colons (::) as a convention to tell CMake that the target name is associated +# with an IMPORTED target (which allows CMake to issue a diagnostic message if the library wasn't found). +add_library(wt::lz4 SHARED IMPORTED GLOBAL) +set_target_properties(wt::lz4 PROPERTIES + IMPORTED_LOCATION ${HAVE_LIBLZ4} +) +if (HAVE_LIBLZ4_INCLUDES) + set_target_properties(wt::lz4 PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${HAVE_LIBLZ4_INCLUDES} + ) +endif() diff --git a/src/third_party/wiredtiger/cmake/third_party/snappy.cmake b/src/third_party/wiredtiger/cmake/third_party/snappy.cmake new file mode 100644 index 00000000000..a7c3bc8540b --- /dev/null +++ b/src/third_party/wiredtiger/cmake/third_party/snappy.cmake @@ -0,0 +1,50 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +if(NOT HAVE_LIBSNAPPY) + # We don't need to construct a snappy library target. + return() +endif() + +if(TARGET wt::snappy) + # Avoid redefining the imported library. + return() +endif() + +# Define the imported snappy library target that can be subsequently linked across the build system. +# We use the double colons (::) as a convention to tell CMake that the target name is associated +# with an IMPORTED target (which allows CMake to issue a diagnostic message if the library wasn't found). +add_library(wt::snappy SHARED IMPORTED GLOBAL) +set_target_properties(wt::snappy PROPERTIES + IMPORTED_LOCATION ${HAVE_LIBSNAPPY} +) +if (HAVE_LIBSNAPPY_INCLUDES) + set_target_properties(wt::snappy PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${HAVE_LIBSNAPPY_INCLUDES} + ) +endif() diff --git a/src/third_party/wiredtiger/cmake/third_party/sodium.cmake b/src/third_party/wiredtiger/cmake/third_party/sodium.cmake new file mode 100644 index 00000000000..4def57766e7 --- /dev/null +++ b/src/third_party/wiredtiger/cmake/third_party/sodium.cmake @@ -0,0 +1,50 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +if(NOT HAVE_LIBSODIUM) + # We don't need to construct a sodium library target. + return() +endif() + +if(TARGET wt::sodium) + # Avoid redefining the imported library. + return() +endif() + +# Define the imported sodium library target that can be subsequently linked across the build system. +# We use the double colons (::) as a convention to tell CMake that the target name is associated +# with an IMPORTED target (which allows CMake to issue a diagnostic message if the library wasn't found). +add_library(wt::sodium SHARED IMPORTED GLOBAL) +set_target_properties(wt::sodium PROPERTIES + IMPORTED_LOCATION ${HAVE_LIBSODIUM} +) +if (HAVE_LIBSODIUM_INCLUDES) + set_target_properties(wt::sodium PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${HAVE_LIBSODIUM_INCLUDES} + ) +endif() diff --git a/src/third_party/wiredtiger/cmake/third_party/zlib.cmake b/src/third_party/wiredtiger/cmake/third_party/zlib.cmake new file mode 100644 index 00000000000..b3b89fd8498 --- /dev/null +++ b/src/third_party/wiredtiger/cmake/third_party/zlib.cmake @@ -0,0 +1,50 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +if(NOT HAVE_LIBZ) + # We don't need to construct a zlib library target. + return() +endif() + +if(TARGET wt::zlib) + # Avoid redefining the imported library. + return() +endif() + +# Define the imported zlib library target that can be subsequently linked across the build system. +# We use the double colons (::) as a convention to tell CMake that the target name is associated +# with an IMPORTED target (which allows CMake to issue a diagnostic message if the library wasn't found). +add_library(wt::zlib SHARED IMPORTED GLOBAL) +set_target_properties(wt::zlib PROPERTIES + IMPORTED_LOCATION ${HAVE_LIBZ} +) +if (HAVE_LIBZ_INCLUDES) + set_target_properties(wt::zlib PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${HAVE_LIBZ_INCLUDES} + ) +endif() diff --git a/src/third_party/wiredtiger/cmake/third_party/zstd.cmake b/src/third_party/wiredtiger/cmake/third_party/zstd.cmake new file mode 100644 index 00000000000..3f25c158e7d --- /dev/null +++ b/src/third_party/wiredtiger/cmake/third_party/zstd.cmake @@ -0,0 +1,50 @@ +# +# Public Domain 2014-present MongoDB, Inc. +# Public Domain 2008-2014 WiredTiger, Inc. +# +# This is free and unencumbered software released into the public domain. +# +# Anyone is free to copy, modify, publish, use, compile, sell, or +# distribute this software, either in source code form or as a compiled +# binary, for any purpose, commercial or non-commercial, and by any +# means. +# +# In jurisdictions that recognize copyright laws, the author or authors +# of this software dedicate any and all copyright interest in the +# software to the public domain. We make this dedication for the benefit +# of the public at large and to the detriment of our heirs and +# successors. We intend this dedication to be an overt act of +# relinquishment in perpetuity of all present and future rights to this +# software under copyright law. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +# IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR +# OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +# ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +# OTHER DEALINGS IN THE SOFTWARE. +# + +if(NOT HAVE_LIBZSTD) + # We don't need to construct a zstd library target. + return() +endif() + +if(TARGET wt::zstd) + # Avoid redefining the imported library. + return() +endif() + +# Define the imported zstd library target that can be subsequently linked across the build system. +# We use the double colons (::) as a convention to tell CMake that the target name is associated +# with an IMPORTED target (which allows CMake to issue a diagnostic message if the library wasn't found). +add_library(wt::zstd SHARED IMPORTED GLOBAL) +set_target_properties(wt::zstd PROPERTIES + IMPORTED_LOCATION ${HAVE_LIBZSTD} +) +if (HAVE_LIBZSTD_INCLUDES) + set_target_properties(wt::zstd PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES ${HAVE_LIBZSTD_INCLUDES} + ) +endif() |