[build] Add /Zc:__cplusplus switch to fix __cplusplus on MSVC#6422
[build] Add /Zc:__cplusplus switch to fix __cplusplus on MSVC#6422AlrIsmail wants to merge 1 commit intoPointCloudLibrary:masterfrom
Conversation
|
First of all, thank you for the pull request. Line 6 in c423d30 pcl/common/include/pcl/pcl_macros.h Line 429 in c423d30 So within PCL, I do not see an immediate benefit of adding the Additionally, I am not sure if it is a good idea to force that option onto downstream projects (that use PCL via PCLConfig.cmake). I have not looked that deep into it, but I assume there is a reason why it is opt-in, instead of Honestly, I think the most careful option would be to continue as before: Not using |
|
From what I can gather it seems to be best just to continue as it is now and close the two as "won't change". Its only if MS at some point "enforce" the use of /Zc:__cplusplus and deprecates ie. _MSVC_LANG. But as it doesn't really gives us any benefits, I would just leave it as is and close the issue, as it is a relatively quick change to add if required (updates from _MSVC_LANG to __cplusplus >= 201703L and equivalent would take time, though I don't know how many places it is used). |
|
I count three places where Then I will close this pull request and the issue. |
Fixes #3494.
This PR adds the
/Zc:__cpluspluscompiler flag when building with MSVC 15.7 or newer to ensure the__cplusplusmacro correctly reports the C++ standard version.Key Changes:
/Zc:__cplusplusto globalCMAKE_CXX_FLAGSfor MSVC 15.7+.PCLCONFIG_COMPILE_OPTIONStopcl_pclconfig.cmakefor storing/exporting compile options.PCLConfig.cmake.inso downstream projects inherit the flag.Verification: Verified CMake logic via mock tests for older and newer MSVC versions, ensuring alignment with existing PCL build patterns.