From 74b2f6c3d95647ad07f56bf9ed6865a8db3dfb97 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 10 Mar 2024 19:58:35 -0400 Subject: fix: ignore non-existent properties during header generation `get_target_property( ...)` sets `` to `-NOTFOUND` if the property doesn't exist for the given target. Detect this situation to avoid adding various `-Dprop-NOTFOUND` and `-Iprop-NOTFOUND` to the command-line when generating the headers. --- src/nvim/CMakeLists.txt | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 047b22edcc..7aa7904286 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -450,18 +450,23 @@ endif() #------------------------------------------------------------------------------- get_target_property(prop main_lib INTERFACE_COMPILE_DEFINITIONS) -foreach(gen_cdef ${prop}) - if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS") - list(APPEND gen_cflags "-D${gen_cdef}") - endif() -endforeach() +if(NOT "${prop}" STREQUAL "prop-NOTFOUND") + foreach(gen_cdef ${prop}) + if(NOT ${gen_cdef} MATCHES "INCLUDE_GENERATED_DECLARATIONS") + list(APPEND gen_cflags "-D${gen_cdef}") + endif() + endforeach() +endif() get_directory_property(targets BUILDSYSTEM_TARGETS) foreach(target ${targets}) get_target_property(prop ${target} INTERFACE_INCLUDE_DIRECTORIES) - foreach(gen_include ${prop}) - list(APPEND gen_cflags "-I${gen_include}") - endforeach() + if(NOT "${prop}" STREQUAL "prop-NOTFOUND") + message(STATUS "${target} props '${prop}'") + foreach(gen_include ${prop}) + list(APPEND gen_cflags "-I${gen_include}") + endforeach() + endif() endforeach() if(APPLE AND CMAKE_OSX_SYSROOT) -- cgit From 118fd8367c3953abb43800a7c1ea0bcc0221e9cd Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sun, 10 Mar 2024 20:02:32 -0400 Subject: fix: deduplicate gen_cflags Since many of the targets have common include paths, `gen_cflags` accumulates a lot of duplicate flags. --- src/nvim/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src') diff --git a/src/nvim/CMakeLists.txt b/src/nvim/CMakeLists.txt index 7aa7904286..7e22203aba 100644 --- a/src/nvim/CMakeLists.txt +++ b/src/nvim/CMakeLists.txt @@ -469,6 +469,8 @@ foreach(target ${targets}) endif() endforeach() +list(REMOVE_DUPLICATES gen_cflags) + if(APPLE AND CMAKE_OSX_SYSROOT) list(APPEND gen_cflags "-isysroot" "${CMAKE_OSX_SYSROOT}") endif() -- cgit