From eb2509aef9faa428112b5da0f4e5730962def7af Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sun, 7 Jul 2019 13:01:38 +0200 Subject: [PATCH] build: fix GetCompileFlags for CMake #10444 Ref: https://github.com/neovim/neovim/pull/10363#issuecomment-508916959 --- cmake/GetCompileFlags.cmake | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/cmake/GetCompileFlags.cmake b/cmake/GetCompileFlags.cmake index 77a5260780..482eacca16 100644 --- a/cmake/GetCompileFlags.cmake +++ b/cmake/GetCompileFlags.cmake @@ -1,6 +1,6 @@ function(get_compile_flags _compile_flags) # Create template akin to CMAKE_C_COMPILE_OBJECT. - set(compile_flags " ") + set(compile_flags " ") # Get C compiler. string(REPLACE @@ -13,9 +13,11 @@ function(get_compile_flags _compile_flags) get_directory_property(compile_definitions DIRECTORY "src/nvim" COMPILE_DEFINITIONS) - # NOTE: list(JOIN) requires CMake 3.12. + # NOTE: list(JOIN) requires CMake 3.12, string(CONCAT) requires CMake 3. string(REPLACE ";" " -D" compile_definitions "${compile_definitions}") - string(CONCAT compile_definitions "-D" "${compile_definitions}") + if(compile_definitions) + set(compile_definitions " -D${compile_definitions}") + endif() string(REPLACE "" "${compile_definitions}"