gts546167 / swtoolkit

Automatically exported from code.google.com/p/swtoolkit
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

ComponentTestProgram() should not remove _WINDOWS from CPPDEFINES #10

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Create a test program using ComponentTestProgram() that links with a lib 
that is also part of the product.
2. Optionally, enable precompiled headers (MSVC).
3. Run hammer.

What is the expected output? What do you see instead?
The build should succeed without recompiling the lib or failing.

What version of the product are you using? On what operating system?
0.9.1
Windows
MSVC 2005

Please provide any additional information below.
When I followed the steps above, Igot a compile error because "'/D_WINDOWS' 
specified for precompiled header but not for current compile". By default, 
using ComponentTestProgram() causes _WINDOWS to be removed from CPPDEFINES. 
I found this in the source and documentation: 
http://code.google.com/p/swtoolkit/wiki/Glossary#COMPONENT_TEST_SUBSYSTEM_W
INDOWS. I understand why LINKFLAGS gets changed - we have similar code in 
our build.scons, but it does not seem correct to change CPPDEFINES. There 
are at least two problems with doing so:
 * This causes all code to be recompiled when building tests, which means 
the tested code could potentially be different from the product code
 * Build errors when using recompiled headers.

The workaround is to define COMPONENT_TEST_SUBSYSTEM_WINDOWS in the 
environment before calling ComponentTestProgram(), but I think the 
CPPDEFINES change should be removed by default.

Original issue reported on code.google.com by ddor...@google.com on 1 Dec 2009 at 2:03