From 35341509f13b9054fe7782fde2cb3a9f42f6e81d Mon Sep 17 00:00:00 2001 From: Matthias Maier Date: Mon, 1 Aug 2016 11:38:01 -0500 Subject: [PATCH] CMake: Bugfix: Strip input variables for CHECK_COMPILER_SETUP CMake 2.8.8 (and possibly till 2.8.11) do not normalize CMAKE_REQUIRED_FLAGS and CMAKE_REQUIRED_LIBRARIES correctly leading to stray "-l " in the linker command line. Fix this by normalizing the input of CHECK_COMPILER_SETUP by stripping leading and trailing whitespace --- cmake/macros/macro_check_compiler_setup.cmake | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cmake/macros/macro_check_compiler_setup.cmake b/cmake/macros/macro_check_compiler_setup.cmake index c1d3a9e820..32c33a77aa 100644 --- a/cmake/macros/macro_check_compiler_setup.cmake +++ b/cmake/macros/macro_check_compiler_setup.cmake @@ -25,7 +25,13 @@ # ${_var} is set to true, otherwise it is set to false. # -MACRO(CHECK_COMPILER_SETUP _compiler_flags _linker_flags _var) +MACRO(CHECK_COMPILER_SETUP _compiler_flags_unstr _linker_flags_unstr _var) + # + # Strip leading and trailing whitespace to make CMake 2.8.8 happy + # + STRING(STRIP "${_compiler_flags_unstr}" _compiler_flags) + STRING(STRIP "${_linker_flags_unstr}" _linker_flags) + # # Rerun this test if flags have changed: # -- 2.39.5