mirror of
https://github.com/neovim/neovim.git
synced 2024-12-29 14:41:06 -07:00
build: replace deprecated cmake features with their modern alternatives
- Use DIRECTORY instead of PATH in get_filename_component - Use COMPILE_OPTIONS instead of COMPILE_FLAGS. COMPILE_FLAGS is treated as a single string while COMPILE_OPTIONS is a list, meaning that cmake will take care of any escaping and quoting automatically.
This commit is contained in:
parent
cc1ceebf8f
commit
6e2c6114f9
@ -45,7 +45,7 @@ function(create_install_dir_with_perms)
|
||||
while(NOT EXISTS \$ENV{DESTDIR}\${_current_dir} AND NOT \${_prev_dir} STREQUAL \${_current_dir})
|
||||
list(APPEND _parent_dirs \${_current_dir})
|
||||
set(_prev_dir \${_current_dir})
|
||||
get_filename_component(_current_dir \${_current_dir} PATH)
|
||||
get_filename_component(_current_dir \${_current_dir} DIRECTORY)
|
||||
endwhile()
|
||||
|
||||
if(_parent_dirs)
|
||||
|
@ -117,7 +117,7 @@ endif()
|
||||
globrecurse_wrapper(RUNTIME_PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR} *.awk *.sh *.bat)
|
||||
|
||||
foreach(PROG ${RUNTIME_PROGRAMS})
|
||||
get_filename_component(BASEDIR ${PROG} PATH)
|
||||
get_filename_component(BASEDIR ${PROG} DIRECTORY)
|
||||
install_helper(PROGRAMS ${PROG}
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/${BASEDIR})
|
||||
endforeach()
|
||||
@ -126,7 +126,7 @@ globrecurse_wrapper(RUNTIME_FILES ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
*.vim *.lua *.dict *.py *.rb *.ps *.spl *.tutor *.tutor.json)
|
||||
|
||||
foreach(F ${RUNTIME_FILES})
|
||||
get_filename_component(BASEDIR ${F} PATH)
|
||||
get_filename_component(BASEDIR ${F} DIRECTORY)
|
||||
install_helper(FILES ${F}
|
||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/${BASEDIR})
|
||||
endforeach()
|
||||
|
@ -225,7 +225,7 @@ foreach(sfile ${NVIM_SOURCES}
|
||||
"${GENERATED_KEYSETS}"
|
||||
"${GENERATED_UI_EVENTS_CLIENT}"
|
||||
)
|
||||
get_filename_component(full_d ${sfile} PATH)
|
||||
get_filename_component(full_d ${sfile} DIRECTORY)
|
||||
file(RELATIVE_PATH d "${CMAKE_CURRENT_LIST_DIR}" "${full_d}")
|
||||
if(${d} MATCHES "^[.][.]|auto/")
|
||||
file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
|
||||
@ -597,10 +597,7 @@ set_target_properties(
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
OUTPUT_NAME ${LIBNVIM_NAME}
|
||||
)
|
||||
set_property(
|
||||
TARGET libnvim
|
||||
APPEND_STRING PROPERTY COMPILE_FLAGS " -DMAKE_LIB "
|
||||
)
|
||||
target_compile_options(libnvim PRIVATE -DMAKE_LIB)
|
||||
|
||||
if(NOT LUAJIT_FOUND)
|
||||
message(STATUS "luajit not found, skipping nvim-test (unit tests) target")
|
||||
@ -626,10 +623,7 @@ else()
|
||||
PROPERTIES
|
||||
POSITION_INDEPENDENT_CODE ON
|
||||
)
|
||||
set_property(
|
||||
TARGET nvim-test
|
||||
APPEND_STRING PROPERTY COMPILE_FLAGS " -DUNIT_TESTING "
|
||||
)
|
||||
target_compile_options(nvim-test PRIVATE -DUNIT_TESTING)
|
||||
endif()
|
||||
|
||||
if(CLANG_ASAN_UBSAN)
|
||||
@ -664,7 +658,7 @@ elseif(CLANG_TSAN)
|
||||
endif()
|
||||
|
||||
function(get_test_target prefix sfile relative_path_var target_var)
|
||||
get_filename_component(full_d "${sfile}" PATH)
|
||||
get_filename_component(full_d "${sfile}" DIRECTORY)
|
||||
file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}")
|
||||
if(d MATCHES "^[.][.]")
|
||||
file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
|
||||
|
@ -16,7 +16,7 @@ endforeach()
|
||||
|
||||
foreach(hfile ${PRE_HEADERS})
|
||||
string(REGEX REPLACE ^pre/ post/ post_hfile ${hfile})
|
||||
get_filename_component(hdir ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile} PATH)
|
||||
get_filename_component(hdir ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile} DIRECTORY)
|
||||
file(MAKE_DIRECTORY ${hdir})
|
||||
add_custom_command(
|
||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile}
|
||||
|
Loading…
Reference in New Issue
Block a user