mirror of
https://github.com/reactos/CMake.git
synced 2025-01-07 11:40:23 +00:00
VS,Xcode: Fix TARGET_PROPERTY genex in source COMPILE_FLAGS property
This already worked in other generators. Also add a test case. Fixes: #17314
This commit is contained in:
parent
db730f3e50
commit
303cd7037a
@ -668,7 +668,8 @@ cmXCodeObject* cmGlobalXCodeGenerator::CreateXCodeSourceFile(
|
||||
std::string configName = "NO-PER-CONFIG-SUPPORT-IN-XCODE";
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> compiledExpr =
|
||||
ge.Parse(cflags);
|
||||
const char* processed = compiledExpr->Evaluate(lg, configName);
|
||||
const char* processed =
|
||||
compiledExpr->Evaluate(lg, configName, false, gtgt);
|
||||
if (compiledExpr->GetHadContextSensitiveCondition()) {
|
||||
std::ostringstream e;
|
||||
/* clang-format off */
|
||||
|
@ -1454,7 +1454,7 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
|
||||
if (const char* cflags = sf.GetProperty("COMPILE_FLAGS")) {
|
||||
cmGeneratorExpression ge;
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(cflags);
|
||||
fc.CompileFlags = cge->Evaluate(lg, *i);
|
||||
fc.CompileFlags = cge->Evaluate(lg, *i, false, gt);
|
||||
needfc = true;
|
||||
}
|
||||
if (lg->FortranProject) {
|
||||
|
@ -2125,8 +2125,8 @@ bool cmVisualStudio10TargetGenerator::OutputSourceSpecificFlags(
|
||||
if (configDependentFlags) {
|
||||
cmGeneratorExpression ge;
|
||||
std::unique_ptr<cmCompiledGeneratorExpression> cge = ge.Parse(flags);
|
||||
std::string evaluatedFlags =
|
||||
cge->Evaluate(this->LocalGenerator, *config);
|
||||
std::string evaluatedFlags = cge->Evaluate(
|
||||
this->LocalGenerator, *config, false, this->GeneratorTarget);
|
||||
clOptions.Parse(evaluatedFlags.c_str());
|
||||
} else {
|
||||
clOptions.Parse(flags.c_str());
|
||||
|
@ -258,11 +258,13 @@ add_custom_target(check-part4 ALL
|
||||
VERBATIM
|
||||
)
|
||||
|
||||
add_executable(srcgenex srcgenex.c)
|
||||
set_property(SOURCE srcgenex.c PROPERTY COMPILE_FLAGS "-DNAME=$<TARGET_PROPERTY:NAME>")
|
||||
|
||||
#-----------------------------------------------------------------------------
|
||||
# Cover test properties with generator expressions.
|
||||
add_executable(echo echo.c)
|
||||
add_executable(pwd pwd.c)
|
||||
set_property(SOURCE echo.c PROPERTY COMPILE_FLAGS $<1:-DSRC_GENEX_WORKS>)
|
||||
|
||||
add_test(NAME echo-configuration COMMAND echo $<CONFIGURATION>)
|
||||
set_property(TEST echo-configuration PROPERTY
|
||||
|
@ -3,9 +3,6 @@
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifndef SRC_GENEX_WORKS
|
||||
#error SRC_GENEX_WORKS not defined
|
||||
#endif
|
||||
printf("%s\n", argv[1]);
|
||||
return EXIT_SUCCESS;
|
||||
}
|
||||
|
12
Tests/GeneratorExpression/srcgenex.c
Normal file
12
Tests/GeneratorExpression/srcgenex.c
Normal file
@ -0,0 +1,12 @@
|
||||
int srcgenex(void)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifndef NAME
|
||||
#error NAME not defined
|
||||
#endif
|
||||
return NAME();
|
||||
}
|
Loading…
Reference in New Issue
Block a user