Patch 3451928: VS2008 trying to build *.h files in C projects

This commit is contained in:
Jason Perkins 2011-12-06 15:14:43 -05:00
parent ee83ae16d7
commit 07853b1e34
4 changed files with 25 additions and 6 deletions

View File

@ -43,6 +43,7 @@
* Bug: Visual Studio 2010 forces x86 when platform is Native
* Added new global _WORKING_DIR
* Patch 3351583: _PREMAKE_COMMAND variable (Konstantin Tokarev)
* Patch 3451928: VS2008 trying to build *.h files in C projects
-------

View File

@ -136,9 +136,10 @@
local cfg = premake.getconfig(prj, cfginfo.src_buildcfg, cfginfo.src_platform)
local usePCH = (not prj.flags.NoPCH and prj.pchsource == node.cfg.name)
local useCompileAs = (path.iscfile(fname) ~= premake.project.iscproject(prj))
local isSourceCode = path.iscppfile(fname)
local needsCompileAs = (path.iscfile(fname) ~= premake.project.iscproject(prj))
if usePCH or useCompileAs then
if usePCH or (isSourceCode and needsCompileAs) then
_p(depth, '<FileConfiguration')
_p(depth, '\tName="%s"', cfginfo.name)
_p(depth, '\t>')
@ -146,8 +147,7 @@
_p(depth, '\t\tName="%s"', iif(cfg.system == "Xbox360",
"VCCLX360CompilerTool",
"VCCLCompilerTool"))
if useCompileAs then
if needsCompileAs then
_p(depth, '\t\tCompileAs="%s"', iif(path.iscfile(fname), 1, 2))
end

View File

@ -1,5 +1,5 @@
--
-- tests/actions/vstudio/vc200x/files.lua
-- tests/actions/vstudio/vc200x/test_files.lua
-- Validate generation of <files/> block in Visual Studio 200x projects.
-- Copyright (c) 2009-2011 Jason Perkins and the Premake project
--
@ -80,6 +80,24 @@
end
--
-- Non-source code files, such as header files and documentation, should
-- be marked as such, so the compiler won't attempt to build them.
--
function suite.file_markedAsNonBuildable_onSupportFiles()
language "c"
files { "hello.lua" }
prepare()
test.capture [[
<File
RelativePath="hello.lua"
>
</File>
]]
end
--
-- Mixed language support
--

View File

@ -97,7 +97,7 @@
-- Visual Studio 2002-2008 C/C++ projects
dofile("actions/vstudio/vc200x/debugdir.lua")
dofile("actions/vstudio/vc200x/header.lua")
dofile("actions/vstudio/vc200x/files.lua")
dofile("actions/vstudio/vc200x/test_files.lua")
dofile("actions/vstudio/vc200x/test_filters.lua")
-- Visual Studio 2010 C/C++ projects