McMartin/FRUT

Visual Studio 2019 - ClangCl Toolset - LTCG flag

Xav83 opened this issue ยท 2 comments

Xav83 commented

Hi @McMartin ,

In our project, we have been experimenting with clangCl as a toolset of Visual Studio 2019 to compile our project with clang on Windows.
Everything seems to work well, except for the flag /LTCG which triggers an error since it doesn't exist for clang. ๐Ÿ˜ข

Since, we have only been experimenting with clangCl, disabling the flag manually in Visual Studio was good for us.
Regardless, I want to report this to you, because it may come from the cmake code below:

FRUT/cmake/Reprojucer.cmake

Lines 5565 to 5569 in 37dc1a7

if(MSVC_VERSION EQUAL 1800) # Visual Studio 2013
set(ltcg_link_flag "/LTCG")
else()
set(ltcg_link_flag "/LTCG:incremental")
endif()

FRUT/cmake/Reprojucer.cmake

Lines 5587 to 5592 in 37dc1a7

set_property(TARGET ${target} APPEND_STRING PROPERTY
LINK_FLAGS_${upper_config} " ${ltcg_link_flag}"
)
set_property(TARGET ${target} APPEND_STRING PROPERTY
STATIC_LIBRARY_FLAGS_${upper_config} " /LTCG"
)

FRUT/cmake/Reprojucer.cmake

Lines 5601 to 5606 in 37dc1a7

set_property(TARGET ${target} APPEND_STRING PROPERTY
LINK_FLAGS_${upper_config} " ${ltcg_link_flag}"
)
set_property(TARGET ${target} APPEND_STRING PROPERTY
STATIC_LIBRARY_FLAGS_${upper_config} " /LTCG"
)

To be sure, before submitting this issue, I have set the variable ltcg_link_flag to an empty string, and remove the others /LTCG, and then everything compiled fine with the toolset clangCl ๐Ÿ™‚

I hope this help you enhance FRUT support on Visual Studio 2019 ๐Ÿ™‚

Have a great day ๐Ÿ˜„

Hi @Xav83,

I'm currently installing the Clang for Windows component of Visual Studio 2019. I'll give this a try and report back!

@Xav83 I can't reproduce the error ๐Ÿ˜…
Which version of CMake are you using and what arguments are you passing to it exactly?
Could you please also share the output of calling cmake in a new binary directory, when it detects the C/CXX compiler and its features?
Thanks!