1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-20 04:24:36 +08:00

VS: Teach CMAKE_MFC_FLAG to support generator expressions

This commit is contained in:
Andrey Starodubtsev
2020-09-27 22:41:25 +03:00
committed by Brad King
parent 558ce94016
commit c1f1eaf7a4
5 changed files with 13 additions and 2 deletions

View File

@@ -0,0 +1,4 @@
genexpr-for-mfc-flag
--------------------
* The :variable:`CMAKE_MFC_FLAG` variable now supports generator expressions.

View File

@@ -15,3 +15,6 @@ Usage example:
add_definitions(-D_AFXDLL) add_definitions(-D_AFXDLL)
set(CMAKE_MFC_FLAG 2) set(CMAKE_MFC_FLAG 2)
add_executable(CMakeSetup WIN32 ${SRCS}) add_executable(CMakeSetup WIN32 ${SRCS})
Contents of ``CMAKE_MFC_FLAG`` may use
:manual:`generator expressions <cmake-generator-expressions(7)>`.

View File

@@ -583,7 +583,7 @@ void cmLocalVisualStudio7Generator::WriteConfiguration(
{ {
std::string mfcFlag; std::string mfcFlag;
if (cmProp p = this->Makefile->GetDefinition("CMAKE_MFC_FLAG")) { if (cmProp p = this->Makefile->GetDefinition("CMAKE_MFC_FLAG")) {
mfcFlag = *p; mfcFlag = cmGeneratorExpression::Evaluate(*p, this, configName);
} else { } else {
mfcFlag = "0"; mfcFlag = "0";
} }

View File

@@ -1224,7 +1224,8 @@ void cmVisualStudio10TargetGenerator::WriteMSToolConfigurationValues(
cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator; cmGlobalVisualStudio10Generator* gg = this->GlobalGenerator;
cmProp mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG"); cmProp mfcFlag = this->Makefile->GetDefinition("CMAKE_MFC_FLAG");
if (mfcFlag) { if (mfcFlag) {
std::string const mfcFlagValue = *mfcFlag; std::string const mfcFlagValue =
cmGeneratorExpression::Evaluate(*mfcFlag, this->LocalGenerator, config);
std::string useOfMfcValue = "false"; std::string useOfMfcValue = "false";
if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) { if (this->GeneratorTarget->GetType() <= cmStateEnums::OBJECT_LIBRARY) {

View File

@@ -65,3 +65,6 @@ if("${CMAKE_MFC_FLAG}" STREQUAL "2")
set(CMAKE_INSTALL_MFC_LIBRARIES ON) set(CMAKE_INSTALL_MFC_LIBRARIES ON)
include(InstallRequiredSystemLibraries) include(InstallRequiredSystemLibraries)
endif() endif()
# Encode the value inside a generator expression to test evaluation.
set(CMAKE_MFC_FLAG "$<1:${CMAKE_MFC_FLAG}>")