diff options
author | James McCoy <jamessan@jamessan.com> | 2024-03-10 19:58:35 -0400 |
---|---|---|
committer | James McCoy <jamessan@jamessan.com> | 2024-03-10 19:58:35 -0400 |
commit | 74b2f6c3d95647ad07f56bf9ed6865a8db3dfb97 (patch) | |
tree | 85fb7cb923e9fb2f88547bf19f1fe18f8594dc34 | |
parent | b465ede2c7a4fb39cf84682d645a3acd08631010 (diff) | |
download | rneovim-74b2f6c3d95647ad07f56bf9ed6865a8db3dfb97.tar.gz rneovim-74b2f6c3d95647ad07f56bf9ed6865a8db3dfb97.tar.bz2 rneovim-74b2f6c3d95647ad07f56bf9ed6865a8db3dfb97.zip |
fix: ignore non-existent properties during header generation
`get_target_property(<var> ...)` sets `<var>` to `<var>-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.
-rw-r--r-- | src/nvim/CMakeLists.txt | 21 |
1 files changed, 13 insertions, 8 deletions
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) |