diff options
author | dundargoc <33953936+dundargoc@users.noreply.github.com> | 2023-02-03 00:00:15 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-02-03 00:00:15 +0100 |
commit | f9826e1dff5f1ac8212ca55a847c872c426142db (patch) | |
tree | aac7c81f6c1848d7c1edb7a31e263e4db391c0ce /cmake/GetCompileFlags.cmake | |
parent | ebd2372f928c6f1cfe823d36aabf479f6930232f (diff) | |
download | rneovim-f9826e1dff5f1ac8212ca55a847c872c426142db.tar.gz rneovim-f9826e1dff5f1ac8212ca55a847c872c426142db.tar.bz2 rneovim-f9826e1dff5f1ac8212ca55a847c872c426142db.zip |
build: stop relying on CMAKE_BUILD_TYPE to determine the build type (#22051)
Any logic involving CMAKE_BUILD_TYPE is automatically broken as it won't
work with multi-config generators. The only exception is if we
explicitly check whether the current generator is single-config as well.
Instead, use generator expressions or cmake variables that allows to set
options for certain build types only such as
INTERPROCEDURAL_OPTIMIZATION_<CONFIG>.
Opt to generate all headers with optimization level O2 with no debug
information for all build types as that is the simplest way to make it
behave the same for all generators.
Diffstat (limited to 'cmake/GetCompileFlags.cmake')
-rw-r--r-- | cmake/GetCompileFlags.cmake | 57 |
1 files changed, 0 insertions, 57 deletions
diff --git a/cmake/GetCompileFlags.cmake b/cmake/GetCompileFlags.cmake deleted file mode 100644 index 9b3c053871..0000000000 --- a/cmake/GetCompileFlags.cmake +++ /dev/null @@ -1,57 +0,0 @@ -function(get_compile_flags _compile_flags) - string(TOUPPER "${CMAKE_BUILD_TYPE}" build_type) - set(compile_flags ${CMAKE_C_COMPILER} ${CMAKE_C_FLAGS} ${CMAKE_C_FLAGS_${build_type}}) - - # Get flags set by target_compile_options(). - get_target_property(opt main_lib INTERFACE_COMPILE_OPTIONS) - if(opt) - list(APPEND compile_flags ${opt}) - endif() - - get_target_property(opt nvim COMPILE_OPTIONS) - if(opt) - list(APPEND compile_flags ${opt}) - endif() - - # Get flags set by target_compile_definitions(). - get_target_property(defs main_lib INTERFACE_COMPILE_DEFINITIONS) - if(defs) - foreach(def ${defs}) - list(APPEND compile_flags "-D${def}") - endforeach() - endif() - - get_target_property(defs nvim COMPILE_DEFINITIONS) - if(defs) - foreach(def ${defs}) - list(APPEND compile_flags "-D${def}") - endforeach() - endif() - - # Get include directories. - get_target_property(dirs main_lib INTERFACE_INCLUDE_DIRECTORIES) - if(dirs) - foreach(dir ${dirs}) - list(APPEND compile_flags "-I${dir}") - endforeach() - endif() - - get_target_property(dirs main_lib INTERFACE_SYSTEM_INCLUDE_DIRECTORIES) - if(dirs) - foreach(dir ${dirs}) - list(APPEND compile_flags "-I${dir}") - endforeach() - endif() - - get_target_property(dirs nvim INCLUDE_DIRECTORIES) - if(dirs) - foreach(dir ${dirs}) - list(APPEND compile_flags "-I${dir}") - endforeach() - endif() - - list(REMOVE_DUPLICATES compile_flags) - string(REPLACE ";" " " compile_flags "${compile_flags}") - - set(${_compile_flags} "${compile_flags}" PARENT_SCOPE) -endfunction() |