aboutsummaryrefslogtreecommitdiff
path: root/test/functional
diff options
context:
space:
mode:
authordundargoc <33953936+dundargoc@users.noreply.github.com>2023-01-10 18:49:57 +0100
committerGitHub <noreply@github.com>2023-01-10 18:49:57 +0100
commit438b4361cc761a2950689668f008cfe06c1510f7 (patch)
treeb950de8e32fa68e35d8287ac4cafe12754094bf8 /test/functional
parent9b1112cf48238260b170b8763b18a02a58159c2a (diff)
downloadrneovim-438b4361cc761a2950689668f008cfe06c1510f7.tar.gz
rneovim-438b4361cc761a2950689668f008cfe06c1510f7.tar.bz2
rneovim-438b4361cc761a2950689668f008cfe06c1510f7.zip
build: use modern cmake (#21589)
Replace old-school cmake with the so-called "Modern CMake", meaning preferring using targets and properties over directory settings and variables. This allows greater flexibility, robustness and clarity over how the code works. The following deprecated commands will be replaced with their modern alternatives that operates on a specific target, rather than all targets in the current directory: - add_compile_options -> target_compile_options - include_directories -> target_include_directories - link_libraries -> target_link_libraries - add_definitions -> target_compile_definitions There are mainly four main targets that we currently use: nvim, libnvim, nvim-test (used by unittests) and ${texe} (used by check-single-includes). The goal is to explicitly define the dependencies of each target fully, rather than having everything be dependent on everything else.
Diffstat (limited to 'test/functional')
-rw-r--r--test/functional/fixtures/CMakeLists.txt23
1 files changed, 16 insertions, 7 deletions
diff --git a/test/functional/fixtures/CMakeLists.txt b/test/functional/fixtures/CMakeLists.txt
index a5410c2f8c..6e64b1e4dc 100644
--- a/test/functional/fixtures/CMakeLists.txt
+++ b/test/functional/fixtures/CMakeLists.txt
@@ -1,14 +1,23 @@
-add_executable(tty-test EXCLUDE_FROM_ALL tty-test.c)
-target_link_libraries(tty-test ${LIBUV_LIBRARIES})
+add_library(test_lib INTERFACE)
+if(MINGW)
+ target_link_libraries(test_lib INTERFACE -municode)
+endif()
+if(WIN32)
+ target_compile_definitions(test_lib INTERFACE MSWIN)
+endif()
+target_link_libraries(test_lib INTERFACE nvim)
+add_executable(tty-test EXCLUDE_FROM_ALL tty-test.c)
add_executable(shell-test EXCLUDE_FROM_ALL shell-test.c)
# Fake pwsh (powershell) for testing make_filter_cmd(). #16271
add_executable(pwsh-test EXCLUDE_FROM_ALL shell-test.c)
add_executable(printargs-test EXCLUDE_FROM_ALL printargs-test.c)
add_executable(printenv-test EXCLUDE_FROM_ALL printenv-test.c)
-if(MINGW)
- set_target_properties(printenv-test PROPERTIES LINK_FLAGS -municode)
-endif()
-
add_executable(streams-test EXCLUDE_FROM_ALL streams-test.c)
-target_link_libraries(streams-test ${LIBUV_LIBRARIES})
+
+target_link_libraries(tty-test PRIVATE test_lib)
+target_link_libraries(shell-test PRIVATE test_lib)
+target_link_libraries(pwsh-test PRIVATE test_lib)
+target_link_libraries(printargs-test PRIVATE test_lib)
+target_link_libraries(printenv-test PRIVATE test_lib)
+target_link_libraries(streams-test PRIVATE test_lib)