diff options
author | Brad King <brad.king@kitware.com> | 2017-08-08 14:46:00 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-08-08 17:28:38 (GMT) |
commit | 4f7d9eef51da4a72fd7c7a17bcbbcf83ffad3216 (patch) | |
tree | 83a106c6c37aaabad7f691951df6b951c4e15ac4 /Source/cmMakefile.cxx | |
parent | bfdfc6db9d51ac874ea12caa89c41a3211c917c2 (diff) | |
download | CMake-4f7d9eef51da4a72fd7c7a17bcbbcf83ffad3216.zip CMake-4f7d9eef51da4a72fd7c7a17bcbbcf83ffad3216.tar.gz CMake-4f7d9eef51da4a72fd7c7a17bcbbcf83ffad3216.tar.bz2 |
Features: Fix COMPILE_FEATURES genex for C++ 14 and 17 features
When `CXX_STANDARD` is not at least 14 or 17, features enabled by the
compiler for those standards should not be reported as existing by the
`COMPILE_FEATURES` genex. Fix the implementation and add a test.
Diffstat (limited to 'Source/cmMakefile.cxx')
-rw-r--r-- | Source/cmMakefile.cxx | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/Source/cmMakefile.cxx b/Source/cmMakefile.cxx index f077459..cb6cf2d 100644 --- a/Source/cmMakefile.cxx +++ b/Source/cmMakefile.cxx @@ -4381,6 +4381,18 @@ bool cmMakefile::HaveCxxStandardAvailable(cmTarget const* target, cmStrCmp(existingCxxStandard)) : cmArrayEnd(CXX_STANDARDS); + if (needCxx17 && + existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS), + cmArrayEnd(CXX_STANDARDS), + cmStrCmp("17"))) { + return false; + } + if (needCxx14 && + existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS), + cmArrayEnd(CXX_STANDARDS), + cmStrCmp("14"))) { + return false; + } if (needCxx11 && existingCxxIt < std::find_if(cmArrayBegin(CXX_STANDARDS), cmArrayEnd(CXX_STANDARDS), |