diff options
author | Andrey Starodubtsev <andrey.starodubtsev@gmail.com> | 2020-09-27 19:41:25 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-09-30 16:24:13 (GMT) |
commit | c1f1eaf7a4e4f1dfaba9a1fb1738aad48296bcda (patch) | |
tree | 58dd23e2f5ad16dd68821f700ceff644b353adbd | |
parent | 558ce94016f898aee596acc570e97a149f1b3dbf (diff) | |
download | CMake-c1f1eaf7a4e4f1dfaba9a1fb1738aad48296bcda.zip CMake-c1f1eaf7a4e4f1dfaba9a1fb1738aad48296bcda.tar.gz CMake-c1f1eaf7a4e4f1dfaba9a1fb1738aad48296bcda.tar.bz2 |
VS: Teach CMAKE_MFC_FLAG to support generator expressions
-rw-r--r-- | Help/release/dev/genexpr-for-mfc-flag.rst | 4 | ||||
-rw-r--r-- | Help/variable/CMAKE_MFC_FLAG.rst | 3 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 2 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 3 | ||||
-rw-r--r-- | Tests/MFC/CMakeLists.txt.in | 3 |
5 files changed, 13 insertions, 2 deletions
diff --git a/Help/release/dev/genexpr-for-mfc-flag.rst b/Help/release/dev/genexpr-for-mfc-flag.rst new file mode 100644 index 0000000..c56a290 --- /dev/null +++ b/Help/release/dev/genexpr-for-mfc-flag.rst @@ -0,0 +1,4 @@ +genexpr-for-mfc-flag +-------------------- + +* The :variable:`CMAKE_MFC_FLAG` variable now supports generator expressions. diff --git a/Help/variable/CMAKE_MFC_FLAG.rst b/Help/variable/CMAKE_MFC_FLAG.rst index 2c4d1c5..118e9c6 100644 --- a/Help/variable/CMAKE_MFC_FLAG.rst +++ b/Help/variable/CMAKE_MFC_FLAG.rst @@ -15,3 +15,6 @@ Usage example: add_definitions(-D_AFXDLL) set(CMAKE_MFC_FLAG 2) add_executable(CMakeSetup WIN32 ${SRCS}) + +Contents of ``CMAKE_MFC_FLAG`` may use +:manual:`generator expressions <cmake-generator-expressions(7)>`. diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 7795654..504268e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -583,7 +583,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration( { std::string mfcFlag; if (cmProp p = this->Makefile->GetDefinition("CMAKE_MFC_FLAG")) { - mfcFlag = *p; + mfcFlag = cmGeneratorExpression::Evaluate(*p, this, configName); } else { mfcFlag = "0"; } diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index ae4a5be..326ab15 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -1224,7 +1224,8 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues( cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; cmProp mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); if (mfcFlag) { - std::string const mfcFlagValue = *mfcFlag; + std::string const mfcFlagValue = + cmGeneratorExpression::Evaluate(*mfcFlag, this->LocalGenerator, config); std::string useOfMfcValue = "false"; if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { diff --git a/Tests/MFC/CMakeLists.txt.in b/Tests/MFC/CMakeLists.txt.in index bf98e91..3632e03 100644 --- a/Tests/MFC/CMakeLists.txt.in +++ b/Tests/MFC/CMakeLists.txt.in @@ -65,3 +65,6 @@ if("${CMAKE_MFC_FLAG}" STREQUAL "2") set(CMAKE_INSTALL_MFC_LIBRARIES ON) include(InstallRequiredSystemLibraries) endif() + +# Encode the value inside a generator expression to test evaluation. +set(CMAKE_MFC_FLAG "$<1:${CMAKE_MFC_FLAG}>") |