aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDundar Goc <gocdundar@gmail.com>2022-06-22 20:06:15 +0200
committerDundar Goc <gocdundar@gmail.com>2022-08-03 09:52:05 +0200
commit6e2c6114f991b3b61887fd9d1b442623b4b03882 (patch)
treec8ac2b7d7a19ea58b11ed6fec7952328ab168ac4
parentcc1ceebf8f13aed1ec0cbe0ff1ad7b2d8a6f10be (diff)
downloadrneovim-6e2c6114f991b3b61887fd9d1b442623b4b03882.tar.gz
rneovim-6e2c6114f991b3b61887fd9d1b442623b4b03882.tar.bz2
rneovim-6e2c6114f991b3b61887fd9d1b442623b4b03882.zip
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.
-rw-r--r--cmake/InstallHelpers.cmake2
-rw-r--r--runtime/CMakeLists.txt4
-rwxr-xr-xsrc/nvim/CMakeLists.txt14
-rw-r--r--test/includes/CMakeLists.txt2
4 files changed, 8 insertions, 14 deletions
diff --git a/cmake/InstallHelpers.cmake b/cmake/InstallHelpers.cmake
index 9d997260cd..3786c4177f 100644
--- a/cmake/InstallHelpers.cmake
+++ b/cmake/InstallHelpers.cmake
@@ -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)
diff --git a/runtime/CMakeLists.txt b/runtime/CMakeLists.txt
index f656f1cbc3..e0a0b34d28 100644
--- a/runtime/CMakeLists.txt
+++ b/runtime/CMakeLists.txt
@@ -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()
diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt
index 017883a913..65af69c539 100755
--- a/src/nvim/CMakeLists.txt
+++ b/src/nvim/CMakeLists.txt
@@ -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}")
diff --git a/test/includes/CMakeLists.txt b/test/includes/CMakeLists.txt
index 4d7e962fbd..b4da4c0611 100644
--- a/test/includes/CMakeLists.txt
+++ b/test/includes/CMakeLists.txt
@@ -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}