Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/windirstat/premake-4.x-stable.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/actions/make/make_cpp.lua6
-rw-r--r--tests/actions/make/test_make_pch.lua17
2 files changed, 22 insertions, 1 deletions
diff --git a/src/actions/make/make_cpp.lua b/src/actions/make/make_cpp.lua
index 2b2c763..b3630f2 100644
--- a/src/actions/make/make_cpp.lua
+++ b/src/actions/make/make_cpp.lua
@@ -305,7 +305,11 @@
local pch = cfg.pchheader
for _, incdir in ipairs(cfg.includedirs) do
- local testname = path.join(incdir, pch)
+
+ -- convert this back to an absolute path for os.isfile()
+ local abspath = path.getabsolute(path.join(cfg.project.location, incdir))
+
+ local testname = path.join(abspath, pch)
if os.isfile(testname) then
pch = path.getrelative(cfg.location, testname)
break
diff --git a/tests/actions/make/test_make_pch.lua b/tests/actions/make/test_make_pch.lua
index 75d9d9d..4664661 100644
--- a/tests/actions/make/test_make_pch.lua
+++ b/tests/actions/make/test_make_pch.lua
@@ -85,6 +85,7 @@ $(GCH): $(PCH)
]]
end
+
--
-- Ensure that PCH is included on all files that use it.
--
@@ -101,3 +102,19 @@ $(OBJDIR)/main.o: main.cpp
]]
end
+
+--
+-- If the header is located on one of the include file
+-- search directories, it should get found automatically.
+--
+
+ function suite.findsPCH_onIncludeDirs()
+ location "MyProject"
+ pchheader "premake.h"
+ includedirs { "../src/host" }
+ prepare()
+ _.pchconfig(cfg)
+ test.capture [[
+ PCH = ../../src/host/premake.h
+ ]]
+ end