From c207095445286321cbb319ab1498c34b204760cf Mon Sep 17 00:00:00 2001 From: Daniel Hahler Date: Sat, 29 Jun 2019 20:37:48 +0200 Subject: build: CMake: do not set CMP0059 to old (#10363) Keeps using add_definitions for compatibility with older CMake. Newer CMake (3.12) would have `add_compile_definitions`, but it is not required, since `add_defitions` was meant to be used for compile/preprocessor definitions initially anyway. Ref: https://github.com/neovim/neovim/pull/4389 --- cmake/GetCompileFlags.cmake | 27 +++++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) (limited to 'cmake') diff --git a/cmake/GetCompileFlags.cmake b/cmake/GetCompileFlags.cmake index 527bc88cdd..77a5260780 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 @@ -9,13 +9,28 @@ function(get_compile_flags _compile_flags) compile_flags "${compile_flags}") - # Get flags set by add_definition(). - get_directory_property(definitions + # Get flags set by add_definitions(). + get_directory_property(compile_definitions DIRECTORY "src/nvim" - DEFINITIONS) + COMPILE_DEFINITIONS) + # NOTE: list(JOIN) requires CMake 3.12. + string(REPLACE ";" " -D" compile_definitions "${compile_definitions}") + string(CONCAT compile_definitions "-D" "${compile_definitions}") string(REPLACE - "" - "${definitions}" + "" + "${compile_definitions}" + compile_flags + "${compile_flags}") + + # Get flags set by add_compile_options(). + get_directory_property(compile_options + DIRECTORY "src/nvim" + COMPILE_OPTIONS) + # NOTE: list(JOIN) requires CMake 3.12. + string(REPLACE ";" " " compile_options "${compile_options}") + string(REPLACE + "" + "${compile_options}" compile_flags "${compile_flags}") -- cgit