Open nikudyshko opened 5 years ago
@zachgk assign @larroy
@larroy Please comment if you want to take this issue.
those flags with dash are in the else branch of the MSVC conditional, how can they be added to your build flags? Can you add a print in the cmakefile to make sure you are in the MSVC branch? I agree these flags should not be present, something is wrong if they are.
Note that they are added in the else case:
else(MSVC)
include(CheckCXXCompilerFlag)
if(USE_CXX14_IF_AVAILABLE)
check_cxx_compiler_flag("-std=c++14" SUPPORT_CXX14)
endif()
check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11)
check_cxx_compiler_flag("-std=c++0x" SUPPORT_CXX0X)
I've added message()
'es after if(MSVC)
and else(MSVC)
. According to output, cmake goes through if
-branch (and this is how it should go, I suppose). As I mentioned, I've tried to replace every dash-style flags in every cmake-file in the source files folders, but that doesn't changed anything.
@larroy I guess, I've found a place, where error occurs.
In file CMakeLists.txt
there are following lines:
if(USE_CUDA AND FIRST_CUDA)
include(3rdparty/mshadow/cmake/Utils.cmake)
include(cmake/FirstClassLangCuda.cmake)
include_directories(${CMAKE_CUDA_TOOLKIT_INCLUDE_DIRECTORIES})
In the file FirstClassLangCuda.cmake
there are calls:
check_cxx_compiler_flag("-std=c++11" SUPPORT_CXX11)
if(USE_CXX14_IF_AVAILABLE)
check_cxx_compiler_flag("-std=c++14" SUPPORT_CXX14)
endif()
And that's where error appears. If I change -std=c++11
to /std:c++14
dection is successfull. (It looks like, that VS2015, VS2017 and VS2019 doesn't support /std:c++11
, that's why I used /std:c++14
for testing)
@lanking520 assign @larroy
@nikudyshko so in windows we don't need to supply the flag? Can we test for C++ standard iwith CMake in windows? What do you suggest to fix?
@larroy For Windows we still have MinGW, clang, etc. And it's better to leave testing for them as it is. As for VS - hard to tell. Versions before VS2015 don't even have /std
flags, so it's impossible to test them this way. Newer version have complete support of C++11 (except few things), so there is no reason to test them.
Unfortunately, I'm not a pro in CMake, can't suggest any good fixes, sorry.
For my builds I just replaced -std=c++11
and -std=c++14
with /std:c++14
, but that's more like workaround.
Description
During configuration process, I've noticed Cmake reporting failures when trying to detect C++11 support. If
USE_CXX14_IF_AVAILABLE
is enabled - Cmake also fails to detect it's suport. My compiler is MSVC 19, which is, obviously, supports these standarts. Looking through the logs, I've found out that compiler has been provided with incompatible GNU-style flags-std=c++11
and-std=c++14
, while for VS/std:c++11
and/std:c++14
are valid.Error Message
From
CMakeError.log
To Reproduce
Just download sources and try to configure it via Cmake (I've used GUI-version)
What have you tried to solve it?
I've tried to edit
CMakeLists.txt
files replacing every-std=c++11
and-std=c++14
with/std:c++11
and/std:c++14
. That didn't work, probably, I've missed something.Environment
I'm using Windows 10, VS 2019, Cmake 3.16