I want to link Google Test (https://github.com/google/googletest) with my project. I added gtest as submodule in following directory:
%{wks.location}/sengine/vendor/gtest
I have following premake5 script in gtest directory:
project "gtest"
kind "StaticLib"
language "C++"
targetdir ("bin/" .. outputdir .. "/%{prj.name}")
objdir ("bin-int/" .. outputdir .. "/%{prj.name}")
files
{
"googletest/include/gtest/**.h",
"googletest/src/gtest-all.cc",
}
filter "system:windows"
systemversion "latest"
cppdialect "C++17"
staticruntime "On"
filter "configurations:Debug"
runtime "Debug"
symbols "on"
filter "configurations:Release"
runtime "Release"
optimize "on"
Errors like this unveil:
D:\dev\sengine\sengine\vendor\gtest\googletest\src\gtest-all.cc(38,10): fatal error C1083: Cannot open include file: 'gtest/gtest.h': No such file or directory
I don't really know how should I change my script so I can for example include gtest.h like this:
#include <gtest/gtest.h>
googletest expects that the directory googletest/include
dir is a root include directory. You can infer this because <>
are used (compared to ""
for relative paths in the project) and the path is given relative to this directory in gtest-all.cc
.
I work more with CMake an have no experience with premake5 but usually you need to specify include directory roots manually.
Apparently premake5 has a similar mechanism: Include directories