Bug 421010 - Workspace build variable takes effect after a build
Summary: Workspace build variable takes effect after a build
Status: NEW
Alias: None
Product: CDT
Classification: Tools
Component: cdt-core (show other bugs)
Version: 8.2.1   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact: Jonah Graham CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-11-04 13:38 EST by Chris Genly CLA
Modified: 2020-09-04 15:18 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Chris Genly CLA 2013-11-04 13:38:56 EST
Set a variable using the Eclipse preference C/C++, Build, Build Variables. 
Add a variable and give it a value.
  RELEASE_LIBRARIES_DIRECTORY_OPTION=VAL

Now build a C/C++ project, where the command in the build configuration uses RELEASE_LIBRARIES_DIRECTORY_OPTION.  The value of RELEASE_LIBRARIES_DIRECTORY_OPTION is not used properly until the second build. I can see the wrong value being placed in the console for the first build, but appear correctly in the second build.

For my build configuration I have the following project properties.

C/C++ Build
  Builder Settings 
    Build command: hyperx_
    Build (Incremental Build): build.tcl ${HWMODEL_OPTION} ${RELEASE_LIBRARIES_DIRECTORY_OPTION}
  
hyperx_ is a tcl interpreter.

I came across the problem by setting a variable programmatically rather than through Eclipse preferences.

		IUserVarSupplier fUserSup = CCorePlugin.getUserVarSupplier();
		IStorableCdtVariables workspaceVariablesCopy = fUserSup.getWorkspaceVariablesCopy();
		workspaceVariablesCopy.createMacro(name, type, value);
		fUserSup.setWorkspaceVariables(workspaceVariablesCopy);
		fUserSup.storeWorkspaceVariables(true);

The same delayed effect occurs. 

Is there a programmatic workaround I can use now to tell the CDT builder to, say, flush a cache?

Bug 244438 may be related.