From 504af70ce008bb9c8098a1026455d70ea7e8ea00 Mon Sep 17 00:00:00 2001 From: jhabermas <86484040+jhabermas@users.noreply.github.com> Date: Thu, 13 Apr 2023 12:22:51 +0100 Subject: [PATCH] (#16818) imath: fix for msvc c++20 build * Enable __cplusplus macro in msvc * imath: fix logic to handle cppstd higher than default --------- Co-authored-by: Luis Caro Campos <3535649+jcar87@users.noreply.github.com> --- recipes/imath/all/conanfile.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/recipes/imath/all/conanfile.py b/recipes/imath/all/conanfile.py index 79c783b58dc0a..ca052909386af 100644 --- a/recipes/imath/all/conanfile.py +++ b/recipes/imath/all/conanfile.py @@ -2,6 +2,7 @@ from conan.tools.build import check_min_cppstd from conan.tools.cmake import CMake, CMakeToolchain, cmake_layout from conan.tools.files import collect_libs, copy, get, rmdir +from conan.tools.microsoft import is_msvc import os required_conan_version = ">=1.53.0" @@ -49,6 +50,10 @@ def source(self): def generate(self): tc = CMakeToolchain(self) + if is_msvc(self) and self.settings.compiler.get_safe("cppstd"): + # when msvc is working with a C++ standard level higher + # than the default, we need the __cplusplus macro to be correct + tc.variables["CMAKE_CXX_FLAGS"] = "/Zc:__cplusplus" tc.generate() def build(self):