mirror of
https://github.com/neovim/neovim.git
synced 2024-12-20 03:05:11 -07:00
438b4361cc
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.
24 lines
956 B
CMake
24 lines
956 B
CMake
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)
|
|
add_executable(streams-test EXCLUDE_FROM_ALL streams-test.c)
|
|
|
|
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)
|