Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Visual Studio 2019 - ClangCl Toolset - LTCG flag #646

Open
Xav83 opened this issue Jun 26, 2020 · 2 comments
Open

Visual Studio 2019 - ClangCl Toolset - LTCG flag #646

Xav83 opened this issue Jun 26, 2020 · 2 comments

Comments

@Xav83
Copy link

Xav83 commented Jun 26, 2020

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 😄

@McMartin
Copy link
Owner

McMartin commented Jun 29, 2020

Hi @Xav83,

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

@McMartin
Copy link
Owner

McMartin commented Jun 29, 2020

@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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants