mirror of
https://github.com/neovim/neovim.git
synced 2024-12-31 17:13:26 -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})
|
while(NOT EXISTS \$ENV{DESTDIR}\${_current_dir} AND NOT \${_prev_dir} STREQUAL \${_current_dir})
|
||||||
list(APPEND _parent_dirs \${_current_dir})
|
list(APPEND _parent_dirs \${_current_dir})
|
||||||
set(_prev_dir \${_current_dir})
|
set(_prev_dir \${_current_dir})
|
||||||
get_filename_component(_current_dir \${_current_dir} PATH)
|
get_filename_component(_current_dir \${_current_dir} DIRECTORY)
|
||||||
endwhile()
|
endwhile()
|
||||||
|
|
||||||
if(_parent_dirs)
|
if(_parent_dirs)
|
||||||
|
@ -117,7 +117,7 @@ endif()
|
|||||||
globrecurse_wrapper(RUNTIME_PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR} *.awk *.sh *.bat)
|
globrecurse_wrapper(RUNTIME_PROGRAMS ${CMAKE_CURRENT_SOURCE_DIR} *.awk *.sh *.bat)
|
||||||
|
|
||||||
foreach(PROG ${RUNTIME_PROGRAMS})
|
foreach(PROG ${RUNTIME_PROGRAMS})
|
||||||
get_filename_component(BASEDIR ${PROG} PATH)
|
get_filename_component(BASEDIR ${PROG} DIRECTORY)
|
||||||
install_helper(PROGRAMS ${PROG}
|
install_helper(PROGRAMS ${PROG}
|
||||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/${BASEDIR})
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/${BASEDIR})
|
||||||
endforeach()
|
endforeach()
|
||||||
@ -126,7 +126,7 @@ globrecurse_wrapper(RUNTIME_FILES ${CMAKE_CURRENT_SOURCE_DIR}
|
|||||||
*.vim *.lua *.dict *.py *.rb *.ps *.spl *.tutor *.tutor.json)
|
*.vim *.lua *.dict *.py *.rb *.ps *.spl *.tutor *.tutor.json)
|
||||||
|
|
||||||
foreach(F ${RUNTIME_FILES})
|
foreach(F ${RUNTIME_FILES})
|
||||||
get_filename_component(BASEDIR ${F} PATH)
|
get_filename_component(BASEDIR ${F} DIRECTORY)
|
||||||
install_helper(FILES ${F}
|
install_helper(FILES ${F}
|
||||||
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/${BASEDIR})
|
DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/nvim/runtime/${BASEDIR})
|
||||||
endforeach()
|
endforeach()
|
||||||
|
@ -225,7 +225,7 @@ foreach(sfile ${NVIM_SOURCES}
|
|||||||
"${GENERATED_KEYSETS}"
|
"${GENERATED_KEYSETS}"
|
||||||
"${GENERATED_UI_EVENTS_CLIENT}"
|
"${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}")
|
file(RELATIVE_PATH d "${CMAKE_CURRENT_LIST_DIR}" "${full_d}")
|
||||||
if(${d} MATCHES "^[.][.]|auto/")
|
if(${d} MATCHES "^[.][.]|auto/")
|
||||||
file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
|
file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
|
||||||
@ -597,10 +597,7 @@ set_target_properties(
|
|||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
OUTPUT_NAME ${LIBNVIM_NAME}
|
OUTPUT_NAME ${LIBNVIM_NAME}
|
||||||
)
|
)
|
||||||
set_property(
|
target_compile_options(libnvim PRIVATE -DMAKE_LIB)
|
||||||
TARGET libnvim
|
|
||||||
APPEND_STRING PROPERTY COMPILE_FLAGS " -DMAKE_LIB "
|
|
||||||
)
|
|
||||||
|
|
||||||
if(NOT LUAJIT_FOUND)
|
if(NOT LUAJIT_FOUND)
|
||||||
message(STATUS "luajit not found, skipping nvim-test (unit tests) target")
|
message(STATUS "luajit not found, skipping nvim-test (unit tests) target")
|
||||||
@ -626,10 +623,7 @@ else()
|
|||||||
PROPERTIES
|
PROPERTIES
|
||||||
POSITION_INDEPENDENT_CODE ON
|
POSITION_INDEPENDENT_CODE ON
|
||||||
)
|
)
|
||||||
set_property(
|
target_compile_options(nvim-test PRIVATE -DUNIT_TESTING)
|
||||||
TARGET nvim-test
|
|
||||||
APPEND_STRING PROPERTY COMPILE_FLAGS " -DUNIT_TESTING "
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(CLANG_ASAN_UBSAN)
|
if(CLANG_ASAN_UBSAN)
|
||||||
@ -664,7 +658,7 @@ elseif(CLANG_TSAN)
|
|||||||
endif()
|
endif()
|
||||||
|
|
||||||
function(get_test_target prefix sfile relative_path_var target_var)
|
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}")
|
file(RELATIVE_PATH d "${PROJECT_SOURCE_DIR}/src/nvim" "${full_d}")
|
||||||
if(d MATCHES "^[.][.]")
|
if(d MATCHES "^[.][.]")
|
||||||
file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
|
file(RELATIVE_PATH d "${GENERATED_DIR}" "${full_d}")
|
||||||
|
@ -16,7 +16,7 @@ endforeach()
|
|||||||
|
|
||||||
foreach(hfile ${PRE_HEADERS})
|
foreach(hfile ${PRE_HEADERS})
|
||||||
string(REGEX REPLACE ^pre/ post/ post_hfile ${hfile})
|
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})
|
file(MAKE_DIRECTORY ${hdir})
|
||||||
add_custom_command(
|
add_custom_command(
|
||||||
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile}
|
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile}
|
||||||
|
Loading…
Reference in New Issue
Block a user