Skip to content

Build fails with clang-cl due to override of CMAKE_CXX_COMPILER(?) #2384

Closed
@emmenlau

Description

@emmenlau

I'm trying to build json 3.9.1 with clang-cl 10.0.0 (from Visual Studio 2019 current latest) on MSVC. The build fails for me already in the cmake configure stage. I could track the problem down to a line in cmake/download_test_data.cmake that overrides the detected compiler:

set(CXX_VERSION_RESULT "${CXX_VERSION_RESULT}; MSVC_VERSION=${MSVC_VERSION}; MSVC_TOOLSET_VERSION=${MSVC_TOOLSET_VERSION}")

I'm under the impression that the semicolon surrounding ... MSVC_VERSION=${MSVC_VERSION}; ... is interpreted by clang-cl as an end-of-line. There are related reports on the internet that would indicate this being the problem.

Here is the output from cmake:

-- The CXX compiler identification is Clang 10.0.0 with MSVC-like command-line
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/Llvm/x64/bin/clang-cl.exe - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using the multi-header code from C:/gitlabci/local/builds/XTJyb_7r/0/json/include/
-- Found Git: C:/cygwin64/bin/git.exe (found version "2.21.0") 
-- Operating system: Windows-10.0.19041; CYGWIN_NT-10.0 Aidan02 3.1.4(0.340/5/3) 2020-02-19 08:49 x86_64 Cygwin
-- Compiler: clang-cl: error: no input files
-- Configuring done
-- Generating done

Here are a few examples of the failling build:

-- Build files have been written to: C:/data/stable-tmp-MSVC-Haswell-7-x64-cl19.27.29111_clang10.0.0/Debug/json
[1/99] "clang-cl: error: no input files; MSVC_VERSION=1927; MSVC_TOOLSET_VERSION=142"   -TP  -IC:\gitlabci\local\builds\XTJyb_7r\0\json\test\thirdparty\doctest /MDd /Zi /arch:AVX2 /DDEBUG /DWINVER=_WIN32_WINNT_WIN7 /D_WIN32_WINNT=_WIN32_WINNT_WIN7 /D_ITERATOR_DEBUG_LEVEL=0 /D_CRT_SECURE_NO_DEPRECATE /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS    /DWIN32 /D_WINDOWS /W4 /GR /EHsc /wd4566 /wd4996 /MDd /Zi /Ob0 /Od /RTC1 /bigobj /showIncludes /Fotest\CMakeFiles\doctest_main.dir\src\unit.cpp.obj /Fdtest\CMakeFiles\doctest_main.dir\ -c C:\gitlabci\local\builds\XTJyb_7r\0\json\test\src\unit.cpp
FAILED: test/CMakeFiles/doctest_main.dir/src/unit.cpp.obj 
"clang-cl: error: no input files; MSVC_VERSION=1927; MSVC_TOOLSET_VERSION=142"   -TP  -IC:\gitlabci\local\builds\XTJyb_7r\0\json\test\thirdparty\doctest /MDd /Zi /arch:AVX2 /DDEBUG /DWINVER=_WIN32_WINNT_WIN7 /D_WIN32_WINNT=_WIN32_WINNT_WIN7 /D_ITERATOR_DEBUG_LEVEL=0 /D_CRT_SECURE_NO_DEPRECATE /D_SILENCE_ALL_CXX17_DEPRECATION_WARNINGS    /DWIN32 /D_WINDOWS /W4 /GR /EHsc /wd4566 /wd4996 /MDd /Zi /Ob0 /Od /RTC1 /bigobj /showIncludes /Fotest\CMakeFiles\doctest_main.dir\src\unit.cpp.obj /Fdtest\CMakeFiles\doctest_main.dir\ -c C:\gitlabci\local\builds\XTJyb_7r\0\json\test\src\unit.cpp
CreateProcess failed: The system cannot find the file specified.

I'm a bit puzzled what the override of CXX_VERSION_RESULT is used for. When I remove this line everything seems to work fine... is there a good reason to enforce an override?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions