mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
b80a8e2c16
Ensure bundled libraries and include directories are always searched first before any others. This will provide a more consistent experience as the search order of the builtin find_ functions can vary depending on system. This should make the build process faster when building with bundled deps as we limit the search to only the .deps directory. Separating the search between .deps and everything makes debugging find_-related problems simpler if you need to check how dependencies are found. For libraries, we divide the search process into the following order: 1. Only search in .deps directory and only search for static libraries. 2. Only search in .deps directory and search for all libraries. 3. Search everywhere and search for all libraries. Make an exception for FindLibintl.cmake as changing the search order seems to break some tests on macos.
25 lines
1.1 KiB
CMake
25 lines
1.1 KiB
CMake
find_path2(MSGPACK_INCLUDE_DIR msgpack/version_master.h)
|
|
|
|
if(MSGPACK_INCLUDE_DIR)
|
|
file(READ ${MSGPACK_INCLUDE_DIR}/msgpack/version_master.h msgpack_version_h)
|
|
string(REGEX REPLACE ".*MSGPACK_VERSION_MAJOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MAJOR "${msgpack_version_h}")
|
|
string(REGEX REPLACE ".*MSGPACK_VERSION_MINOR +([0-9]+).*" "\\1" MSGPACK_VERSION_MINOR "${msgpack_version_h}")
|
|
string(REGEX REPLACE ".*MSGPACK_VERSION_REVISION +([0-9]+).*" "\\1" MSGPACK_VERSION_REVISION "${msgpack_version_h}")
|
|
set(MSGPACK_VERSION_STRING "${MSGPACK_VERSION_MAJOR}.${MSGPACK_VERSION_MINOR}.${MSGPACK_VERSION_REVISION}")
|
|
else()
|
|
set(MSGPACK_VERSION_STRING)
|
|
endif()
|
|
|
|
find_library2(MSGPACK_LIBRARY NAMES msgpackc msgpack msgpackc_import msgpack-c
|
|
NAMES_PER_DIR)
|
|
|
|
mark_as_advanced(MSGPACK_INCLUDE_DIR MSGPACK_LIBRARY)
|
|
|
|
find_package_handle_standard_args(Msgpack
|
|
REQUIRED_VARS MSGPACK_LIBRARY MSGPACK_INCLUDE_DIR
|
|
VERSION_VAR MSGPACK_VERSION_STRING)
|
|
|
|
add_library(msgpack INTERFACE)
|
|
target_include_directories(msgpack SYSTEM BEFORE INTERFACE ${MSGPACK_INCLUDE_DIR})
|
|
target_link_libraries(msgpack INTERFACE ${MSGPACK_LIBRARY})
|