diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-01-27 11:53:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-01-27 11:53:32 +0100 |
commit | d85ed00a8cc2274eff4409e2b18ba34178ae567a (patch) | |
tree | 9a6954588843aab5003b8c41e2ca84fed679a9b8 /cmake | |
parent | 9b43dcdbff4fd9418a66a4b356e3cb8a11762971 (diff) | |
download | rneovim-d85ed00a8cc2274eff4409e2b18ba34178ae567a.tar.gz rneovim-d85ed00a8cc2274eff4409e2b18ba34178ae567a.tar.bz2 rneovim-d85ed00a8cc2274eff4409e2b18ba34178ae567a.zip |
build: find unibilium without relying on libfindmacros (#22015)
This will remove the warning about the find module not providing a
version.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/FindUNIBILIUM.cmake | 12 | ||||
-rw-r--r-- | cmake/Findunibilium.cmake | 27 |
2 files changed, 27 insertions, 12 deletions
diff --git a/cmake/FindUNIBILIUM.cmake b/cmake/FindUNIBILIUM.cmake deleted file mode 100644 index 0bf27b45e2..0000000000 --- a/cmake/FindUNIBILIUM.cmake +++ /dev/null @@ -1,12 +0,0 @@ -# - Try to find unibilium -# Once done this will define -# UNIBILIUM_FOUND - System has unibilium -# UNIBILIUM_INCLUDE_DIRS - The unibilium include directories -# UNIBILIUM_LIBRARIES - The libraries needed to use unibilium - -include(LibFindMacros) - -libfind_pkg_detect(UNIBILIUM unibilium - FIND_PATH unibilium.h - FIND_LIBRARY unibilium) -libfind_process(UNIBILIUM) diff --git a/cmake/Findunibilium.cmake b/cmake/Findunibilium.cmake new file mode 100644 index 0000000000..fd8eb0cd7f --- /dev/null +++ b/cmake/Findunibilium.cmake @@ -0,0 +1,27 @@ +find_path(UNIBILIUM_INCLUDE_DIR unibilium.h) +find_library(UNIBILIUM_LIBRARY unibilium) + +find_package_handle_standard_args(unibilium + REQUIRED_VARS UNIBILIUM_INCLUDE_DIR UNIBILIUM_LIBRARY) + +add_library(unibilium INTERFACE) +target_include_directories(unibilium SYSTEM BEFORE INTERFACE ${UNIBILIUM_INCLUDE_DIR}) +target_link_libraries(unibilium INTERFACE ${UNIBILIUM_LIBRARY}) + +list(APPEND CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIR}") +list(APPEND CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARY}") +check_c_source_compiles(" +#include <unibilium.h> + +int +main(void) +{ + unibi_str_from_var(unibi_var_from_str(\"\")); + return unibi_num_from_var(unibi_var_from_num(0)); +} +" UNIBI_HAS_VAR_FROM) +list(REMOVE_ITEM CMAKE_REQUIRED_INCLUDES "${UNIBILIUM_INCLUDE_DIR}") +list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES "${UNIBILIUM_LIBRARY}") +if(UNIBI_HAS_VAR_FROM) + target_compile_definitions(main_lib INTERFACE NVIM_UNIBI_HAS_VAR_FROM) +endif() |