From 438b4361cc761a2950689668f008cfe06c1510f7 Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 10 Jan 2023 18:49:57 +0100 Subject: 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. --- test/includes/CMakeLists.txt | 1 - 1 file changed, 1 deletion(-) (limited to 'test/includes') diff --git a/test/includes/CMakeLists.txt b/test/includes/CMakeLists.txt index b4da4c0611..0d30736091 100644 --- a/test/includes/CMakeLists.txt +++ b/test/includes/CMakeLists.txt @@ -23,7 +23,6 @@ foreach(hfile ${PRE_HEADERS}) COMMAND ${CMAKE_C_COMPILER} -std=c99 -E -P ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} ${gen_cflags} - -I${LIBUV_INCLUDE_DIRS} -o ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile}) list(APPEND POST_HEADERS ${post_hfile}) endforeach() -- cgit From 322c83896d6fe6ccc4f799f282d8e1feb7cf7ebe Mon Sep 17 00:00:00 2001 From: dundargoc <33953936+dundargoc@users.noreply.github.com> Date: Tue, 24 Jan 2023 00:03:25 +0100 Subject: build: remove unnecessary unit test code (#21940) The files generated by test/includes/CMakeLists.txt have been unused since commit c49e22d396. The unittests include the headers in test/includes directly without any processing, meaning that the CMakeLists.txt file is no longer necessary. --- test/includes/CMakeLists.txt | 31 ------------------------------- 1 file changed, 31 deletions(-) delete mode 100644 test/includes/CMakeLists.txt (limited to 'test/includes') diff --git a/test/includes/CMakeLists.txt b/test/includes/CMakeLists.txt deleted file mode 100644 index 0d30736091..0000000000 --- a/test/includes/CMakeLists.txt +++ /dev/null @@ -1,31 +0,0 @@ -file(GLOB_RECURSE PRE_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} pre/*.h) - -# We need to add the SDK directories on OS X, and perhaps other operating -# systems. -set(gen_cflags) -foreach(gen_include ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES}) - list(APPEND gen_cflags ${CMAKE_INCLUDE_FLAG_C}${gen_include}) -endforeach() - -get_directory_property(gen_cdefs COMPILE_DEFINITIONS) -foreach(gen_cdef ${gen_cdefs}) - if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS") - list(APPEND gen_cflags "-D${gen_cdef}") - endif() -endforeach() - -foreach(hfile ${PRE_HEADERS}) - string(REGEX REPLACE ^pre/ post/ post_hfile ${hfile}) - 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} - COMMAND ${CMAKE_C_COMPILER} -std=c99 -E -P - ${CMAKE_CURRENT_SOURCE_DIR}/${hfile} - ${gen_cflags} - -o ${CMAKE_CURRENT_BINARY_DIR}/${post_hfile}) - list(APPEND POST_HEADERS ${post_hfile}) -endforeach() - -add_custom_target(unittest-headers DEPENDS ${POST_HEADERS}) -set_target_properties(unittest-headers PROPERTIES FOLDER test) -- cgit