diff --git a/CHANGES.txt b/CHANGES.txt index 5e63234a..c3a276db 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 ------- diff --git a/src/actions/vstudio/vs200x_vcproj.lua b/src/actions/vstudio/vs200x_vcproj.lua index d79c4bf9..f90533a7 100644 --- a/src/actions/vstudio/vs200x_vcproj.lua +++ b/src/actions/vstudio/vs200x_vcproj.lua @@ -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, '') @@ -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 diff --git a/tests/actions/vstudio/vc200x/files.lua b/tests/actions/vstudio/vc200x/test_files.lua similarity index 89% rename from tests/actions/vstudio/vc200x/files.lua rename to tests/actions/vstudio/vc200x/test_files.lua index 4633674f..02b888ee 100644 --- a/tests/actions/vstudio/vc200x/files.lua +++ b/tests/actions/vstudio/vc200x/test_files.lua @@ -1,5 +1,5 @@ -- --- tests/actions/vstudio/vc200x/files.lua +-- tests/actions/vstudio/vc200x/test_files.lua -- Validate generation of 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 [[ + + + ]] + end + + -- -- Mixed language support -- diff --git a/tests/premake4.lua b/tests/premake4.lua index acc358db..8524d661 100644 --- a/tests/premake4.lua +++ b/tests/premake4.lua @@ -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