Skip to content

externalincludedirs not working with vs2022 clang wsl2 #2546

@xoorath

Description

@xoorath

I'm trying to use externalincludes with vs2022, clang and wsl2.

I have a minimal example attached here: externalincludes_wsl2.zip

It contains the following premake5.lua file:

workspace "externalincludes_wsl2"
    configurations { "Debug" }
    platforms { "linux" }
    system "linux"
    toolchainversion "wsl2"
    toolset "clang"


project "externalincludes_wsl2"
    kind "ConsoleApp"
    language "C++"
    files {  "main.cpp" }
    externalincludedirs { './external' }

I'm generating with the command line premake5.exe vs2022.

The command line Visual Studio is using for the generated project does not include any -isystem as I would expect for clang:

"clang++" -W"switch" -W"no-deprecated-declarations" -W"empty-body" -W"conversion" -W"return-type" -W"parentheses" -W"no-pointer-sign" -W"no-format" -W"uninitialized" -W"unreachable-code" -W"unused-function" -W"unused-value" -W"unused-variable" -std=c++11 -Wall -fno-strict-aliasing -g1 "clang++" -O0 -fthreadsafe-statics -D "NDEBUG" -W"switch" -W"no-deprecated-declarations" -W"empty-body" -W"conversion" -W"return-type" -W"parentheses" -W"no-format" -W"uninitialized" -W"unreachable-code" -W"unused-function" -W"unused-value" -W"unused-variable" -frtti -fomit-frame-pointer -std=c11 -fexceptions "1" -o "C:\Users\redacted\Desktop\externalincludes_wsl2\obj\%(filename).o" 

Some observations

The generated vcxproj file does have the include set in <ExternalIncludePath>, however that is not reflected in the Visual Studio project property pages where it is for linux + wsl project configurations.

In order to get this to work I can manually set the following settings in the IDE:

Screenshot of the visual studio property pages highlighting the VC++ Directories External Includes setting with $(ProjectDir)external/ set Screenshot of the visual studio property pages highlighting the Copy Sources Additional Sources To Copy setting with $(ProjectDir)external/ set

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions