Skip to content

Commit

Permalink
(#16818) imath: fix for msvc c++20 build
Browse files Browse the repository at this point in the history
* Enable __cplusplus macro in msvc

* imath: fix logic to handle cppstd higher than default

---------

Co-authored-by: Luis Caro Campos <[email protected]>
  • Loading branch information
jhabermas and jcar87 authored Apr 13, 2023
1 parent cd8c633 commit 504af70
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions recipes/imath/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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):
Expand Down

0 comments on commit 504af70

Please sign in to comment.