From af9624440bdd26eb57ba73416daa6716aedc9643 Mon Sep 17 00:00:00 2001 From: Henry Schreiner Date: Fri, 28 Apr 2023 14:41:59 -0400 Subject: [PATCH] fix(cmake): output was not exported Signed-off-by: Henry Schreiner --- tools/pybind11Common.cmake | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/tools/pybind11Common.cmake b/tools/pybind11Common.cmake index 7b415619236..c6f19fa89d8 100644 --- a/tools/pybind11Common.cmake +++ b/tools/pybind11Common.cmake @@ -262,19 +262,16 @@ include(CheckCXXCompilerFlag) # cached base on the result variable. If the flags work, sets them in # cxxflags_out/linkerflags_out internal cache variables (in addition to # ${result}). -function(_pybind11_return_if_cxx_and_linker_flags_work result cxxflags linkerflags cxxflags_out - linkerflags_out) +macro(_pybind11_return_if_cxx_and_linker_flags_work result cxxflags linkerflags cxxflags_out + linkerflags_out) set(CMAKE_REQUIRED_LIBRARIES ${linkerflags}) check_cxx_compiler_flag("${cxxflags}" ${result}) if(${result}) - set(${cxxflags_out} - "${cxxflags}" - PARENT_SCOPE) - set(${linkerflags_out} - "${linkerflags}" - PARENT_SCOPE) + set(${cxxflags_out} "${cxxflags}") + set(${linkerflags_out} "${linkerflags}") endif() -endfunction() + unset(CMAKE_REQUIRED_LIBRARIES) +endmacro() function(_pybind11_generate_lto target prefer_thin_lto) if(MINGW)