diff options
author | Justin M. Keyes <justinkz@gmail.com> | 2022-06-19 19:51:16 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-19 19:51:16 +0200 |
commit | b2ed439bd5ab1b431bb61f8754554c48453495c5 (patch) | |
tree | ac510cd24c54ef9a49a9d3865cb61152cd9cfe6b /cmake | |
parent | a195dc7c83b3da16e293ddb468ef18254957b4a4 (diff) | |
parent | ae7a4ad3d70c5a7653d2211dd89884d401186ab2 (diff) | |
download | rneovim-b2ed439bd5ab1b431bb61f8754554c48453495c5.tar.gz rneovim-b2ed439bd5ab1b431bb61f8754554c48453495c5.tar.bz2 rneovim-b2ed439bd5ab1b431bb61f8754554c48453495c5.zip |
Merge #19015 delete cmake code
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/DefCmdTarget.cmake | 32 | ||||
-rw-r--r-- | cmake/FindLua.cmake | 197 | ||||
-rw-r--r-- | cmake/UninstallHelper.cmake | 13 | ||||
-rw-r--r-- | cmake/UninstallHelper.cmake.in | 21 |
4 files changed, 25 insertions, 238 deletions
diff --git a/cmake/DefCmdTarget.cmake b/cmake/DefCmdTarget.cmake index 1ee5cdd60e..48e90cf5c8 100644 --- a/cmake/DefCmdTarget.cmake +++ b/cmake/DefCmdTarget.cmake @@ -1,27 +1,19 @@ -# Defines a target named ${target} and a command with (symbolic) output -# ${target}-cmd. If ${prg} is undefined the target prints "not found". +# Defines a target named ${target}. If ${prg} is undefined the target prints +# "not found". # -# - Use add_custom_command(…APPEND) to build the command after this. -# - Use add_custom_target(…DEPENDS) to run the command from a target. +# - Use add_custom_command(TARGET <target_name> ...) to append a command to the +# target. function(def_cmd_target target prg prg_name prg_fatal) - # Define a mostly-empty command, which can be appended-to. - add_custom_command(OUTPUT ${target}-cmd - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - COMMAND ${CMAKE_COMMAND} -E echo "${target}" - ) - # Symbolic (does not generate an artifact). - set_source_files_properties(${target}-cmd PROPERTIES SYMBOLIC "true") + add_custom_target(${target}) - if(prg OR NOT prg_fatal) - add_custom_target(${target} - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} - DEPENDS ${target}-cmd) - if(NOT prg) - add_custom_command(OUTPUT ${target}-cmd APPEND + if(NOT prg) + if(prg_fatal) + add_custom_command(TARGET ${target} + COMMAND ${CMAKE_COMMAND} -E echo "${target}: ${prg_name} not found" + COMMAND false) + else() + add_custom_command(TARGET ${target} COMMAND ${CMAKE_COMMAND} -E echo "${target}: SKIP: ${prg_name} not found") endif() - else() - add_custom_target(${target} false - COMMENT "${target}: ${prg_name} not found") endif() endfunction() diff --git a/cmake/FindLua.cmake b/cmake/FindLua.cmake deleted file mode 100644 index 7ba13e1f56..0000000000 --- a/cmake/FindLua.cmake +++ /dev/null @@ -1,197 +0,0 @@ -# Distributed under the OSI-approved BSD 3-Clause License. See accompanying -# file Copyright.txt or https://cmake.org/licensing for details. - -#.rst: -# FindLua -# ------- -# -# -# -# Locate Lua library This module defines -# -# :: -# -# LUA_FOUND - if false, do not try to link to Lua -# LUA_LIBRARIES - both lua and lualib -# LUA_INCLUDE_DIR - where to find lua.h -# LUA_VERSION_STRING - the version of Lua found -# LUA_VERSION_MAJOR - the major version of Lua -# LUA_VERSION_MINOR - the minor version of Lua -# LUA_VERSION_PATCH - the patch version of Lua -# -# -# -# Note that the expected include convention is -# -# :: -# -# #include "lua.h" -# -# and not -# -# :: -# -# #include <lua/lua.h> -# -# This is because, the lua location is not standardized and may exist in -# locations other than lua/ - -unset(_lua_include_subdirs) -unset(_lua_library_names) -unset(_lua_append_versions) - -# this is a function only to have all the variables inside go away automatically -function(_lua_set_version_vars) - set(LUA_VERSIONS5 5.4 5.3 5.2 5.1 5.0) - - if (Lua_FIND_VERSION_EXACT) - if (Lua_FIND_VERSION_COUNT GREATER 1) - set(_lua_append_versions ${Lua_FIND_VERSION_MAJOR}.${Lua_FIND_VERSION_MINOR}) - endif () - elseif (Lua_FIND_VERSION) - # once there is a different major version supported this should become a loop - if (NOT Lua_FIND_VERSION_MAJOR GREATER 5) - if (Lua_FIND_VERSION_COUNT EQUAL 1) - set(_lua_append_versions ${LUA_VERSIONS5}) - else () - foreach (subver IN LISTS LUA_VERSIONS5) - if (NOT subver VERSION_LESS ${Lua_FIND_VERSION}) - list(APPEND _lua_append_versions ${subver}) - endif () - endforeach () - endif () - endif () - else () - # once there is a different major version supported this should become a loop - set(_lua_append_versions ${LUA_VERSIONS5}) - endif () - - list(APPEND _lua_include_subdirs "include/lua" "include") - - foreach (ver IN LISTS _lua_append_versions) - string(REGEX MATCH "^([0-9]+)\\.([0-9]+)$" _ver "${ver}") - list(APPEND _lua_include_subdirs - include/lua${CMAKE_MATCH_1}${CMAKE_MATCH_2} - include/lua${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - include/lua-${CMAKE_MATCH_1}.${CMAKE_MATCH_2} - ) - endforeach () - - set(_lua_include_subdirs "${_lua_include_subdirs}" PARENT_SCOPE) - set(_lua_append_versions "${_lua_append_versions}" PARENT_SCOPE) -endfunction(_lua_set_version_vars) - -function(_lua_check_header_version _hdr_file) - # At least 5.[012] have different ways to express the version - # so all of them need to be tested. Lua 5.2 defines LUA_VERSION - # and LUA_RELEASE as joined by the C preprocessor, so avoid those. - file(STRINGS "${_hdr_file}" lua_version_strings - REGEX "^#define[ \t]+LUA_(RELEASE[ \t]+\"Lua [0-9]|VERSION([ \t]+\"Lua [0-9]|_[MR])).*") - - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MAJOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MAJOR ";${lua_version_strings};") - if (LUA_VERSION_MAJOR MATCHES "^[0-9]+$") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_MINOR[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_MINOR ";${lua_version_strings};") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION_RELEASE[ \t]+\"([0-9])\"[ \t]*;.*" "\\1" LUA_VERSION_PATCH ";${lua_version_strings};") - set(LUA_VERSION_STRING "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}.${LUA_VERSION_PATCH}") - else () - string(REGEX REPLACE ".*;#define[ \t]+LUA_RELEASE[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") - if (NOT LUA_VERSION_STRING MATCHES "^[0-9.]+$") - string(REGEX REPLACE ".*;#define[ \t]+LUA_VERSION[ \t]+\"Lua ([0-9.]+)\"[ \t]*;.*" "\\1" LUA_VERSION_STRING ";${lua_version_strings};") - endif () - string(REGEX REPLACE "^([0-9]+)\\.[0-9.]*$" "\\1" LUA_VERSION_MAJOR "${LUA_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.([0-9]+)[0-9.]*$" "\\1" LUA_VERSION_MINOR "${LUA_VERSION_STRING}") - string(REGEX REPLACE "^[0-9]+\\.[0-9]+\\.([0-9]).*" "\\1" LUA_VERSION_PATCH "${LUA_VERSION_STRING}") - endif () - foreach (ver IN LISTS _lua_append_versions) - if (ver STREQUAL "${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR}") - set(LUA_VERSION_MAJOR ${LUA_VERSION_MAJOR} PARENT_SCOPE) - set(LUA_VERSION_MINOR ${LUA_VERSION_MINOR} PARENT_SCOPE) - set(LUA_VERSION_PATCH ${LUA_VERSION_PATCH} PARENT_SCOPE) - set(LUA_VERSION_STRING ${LUA_VERSION_STRING} PARENT_SCOPE) - return() - endif () - endforeach () -endfunction(_lua_check_header_version) - -_lua_set_version_vars() - -if (LUA_INCLUDE_DIR AND EXISTS "${LUA_INCLUDE_DIR}/lua.h") - _lua_check_header_version("${LUA_INCLUDE_DIR}/lua.h") -endif () - -if (NOT LUA_VERSION_STRING) - foreach (subdir IN LISTS _lua_include_subdirs) - unset(LUA_INCLUDE_PREFIX CACHE) - find_path(LUA_INCLUDE_PREFIX ${subdir}/lua.h - HINTS - ENV LUA_DIR - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw # Fink - /opt/local # DarwinPorts - /opt/csw # Blastwave - /opt - ) - if (LUA_INCLUDE_PREFIX) - _lua_check_header_version("${LUA_INCLUDE_PREFIX}/${subdir}/lua.h") - if (LUA_VERSION_STRING) - set(LUA_INCLUDE_DIR "${LUA_INCLUDE_PREFIX}/${subdir}") - break() - endif () - endif () - endforeach () -endif () -unset(_lua_include_subdirs) -unset(_lua_append_versions) - -if (LUA_VERSION_STRING) - set(_lua_library_names - lua${LUA_VERSION_MAJOR}${LUA_VERSION_MINOR} - lua${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} - lua-${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} - lua.${LUA_VERSION_MAJOR}.${LUA_VERSION_MINOR} - ) -endif () - -find_library(LUA_LIBRARY - NAMES ${_lua_library_names} lua - HINTS - ENV LUA_DIR - PATH_SUFFIXES lib - PATHS - ~/Library/Frameworks - /Library/Frameworks - /sw - /opt/local - /opt/csw - /opt -) -unset(_lua_library_names) - -if (LUA_LIBRARY) - # include the math library for Unix - if (UNIX AND NOT APPLE AND NOT BEOS) - find_library(LUA_MATH_LIBRARY m) - set(LUA_LIBRARIES "${LUA_LIBRARY};${LUA_MATH_LIBRARY}") - - # include dl library for statically-linked Lua library - get_filename_component(LUA_LIB_EXT ${LUA_LIBRARY} EXT) - if(LUA_LIB_EXT STREQUAL CMAKE_STATIC_LIBRARY_SUFFIX) - list(APPEND LUA_LIBRARIES ${CMAKE_DL_LIBS}) - endif() - - # For Windows and Mac, don't need to explicitly include the math library - else () - set(LUA_LIBRARIES "${LUA_LIBRARY}") - endif () -endif () - -include(FindPackageHandleStandardArgs) -# handle the QUIETLY and REQUIRED arguments and set LUA_FOUND to TRUE if -# all listed variables are TRUE -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Lua - REQUIRED_VARS LUA_LIBRARIES LUA_INCLUDE_DIR - VERSION_VAR LUA_VERSION_STRING) - -mark_as_advanced(LUA_INCLUDE_DIR LUA_LIBRARY LUA_MATH_LIBRARY) diff --git a/cmake/UninstallHelper.cmake b/cmake/UninstallHelper.cmake new file mode 100644 index 0000000000..9a3d30af59 --- /dev/null +++ b/cmake/UninstallHelper.cmake @@ -0,0 +1,13 @@ +if(NOT EXISTS "${CMAKE_BINARY_DIR}/install_manifest.txt") + message(FATAL_ERROR "Cannot find install manifest: ${CMAKE_BINARY_DIR}/install_manifest.txt") +endif() + +file(STRINGS "${CMAKE_BINARY_DIR}/install_manifest.txt" files) +foreach(file ${files}) + message(STATUS "Uninstalling $ENV{DESTDIR}${file}") + if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") + file(REMOVE $ENV{DESTDIR}${file}) + else() + message(STATUS "File $ENV{DESTDIR}${file} does not exist.") + endif() +endforeach() diff --git a/cmake/UninstallHelper.cmake.in b/cmake/UninstallHelper.cmake.in deleted file mode 100644 index c2d34d4796..0000000000 --- a/cmake/UninstallHelper.cmake.in +++ /dev/null @@ -1,21 +0,0 @@ -if(NOT EXISTS "@CMAKE_BINARY_DIR@/install_manifest.txt") - message(FATAL_ERROR "Cannot find install manifest: @CMAKE_BINARY_DIR@/install_manifest.txt") -endif() - -file(READ "@CMAKE_BINARY_DIR@/install_manifest.txt" files) -string(REGEX REPLACE "\n" ";" files "${files}") -foreach(file ${files}) - message(STATUS "Uninstalling $ENV{DESTDIR}${file}") - if(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - exec_program( - "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" - OUTPUT_VARIABLE rm_out - RETURN_VALUE rm_retval - ) - if(NOT "${rm_retval}" STREQUAL 0) - message(FATAL_ERROR "Problem when removing $ENV{DESTDIR}${file}") - endif() - else(IS_SYMLINK "$ENV{DESTDIR}${file}" OR EXISTS "$ENV{DESTDIR}${file}") - message(STATUS "File $ENV{DESTDIR}${file} does not exist.") - endif() -endforeach() |