cmake: Command-line parsing errors result in CMAKE_BINARY_DIR being an empty string
TLDR;
CMake is failing with the following error:
Failed to set working directory
i.e.
[12:24:35]-- Selecting Windows SDK version to target Windows 10.0.17134.
[12:24:37]-- The CXX compiler identification is MSVC 19.0.24215.1
[12:24:37]-- Selecting Windows SDK version to target Windows 10.0.17134.
[12:24:37]-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/bin/x86_amd64/cl.exe
[12:24:37]CMake Error at C:/Program Files/CMake/share/cmake-3.13/Modules/CMakeTestCXXCompiler.cmake:30 (try_compile):
[12:24:37] Failed to set working directory to /CMakeFiles/CMakeTmp/testCXXCompiler.cxx
[12:24:37] : Invalid argument
[12:24:37]Call Stack (most recent call first):
[12:24:37]-- Configuring incomplete, errors occurred!
[12:24:37] CMakeLists.txt:2 (project)
[12:24:37]See also "/CMakeFiles/CMakeOutput.log".
Longer explanation
I'm running CMake version 3.13.1
I am calling CMake with:
cmake -S .. -G "Visual Studio 14 2015" -A x64 -DBUILD_TEST=ON
When it fails I see that it created (and wasn't a good citizen and cleaned them up) a directory and some files here:
C:\>dir CMakeFiles /s /b
C:\CMakeCache.txt
C:\CMakeFiles\3.13.1
C:\CMakeFiles\cmake.check_cache
C:\CMakeFiles\CMakeOutput.log
C:\CMakeFiles\CMakeTmp
C:\CMakeFiles\3.13.1\CMakeRCCompiler.cmake
C:\CMakeFiles\3.13.1\CompilerIdCXX
C:\CMakeFiles\3.13.1\VCTargetsPath.txt
C:\CMakeFiles\3.13.1\VCTargetsPath.vcxproj
C:\CMakeFiles\3.13.1\x64
C:\CMakeFiles\3.13.1\CompilerIdCXX\CMakeCXXCompilerId.cpp
C:\CMakeFiles\3.13.1\CompilerIdCXX\CompilerIdCXX.exe
C:\CMakeFiles\3.13.1\CompilerIdCXX\CompilerIdCXX.vcxproj
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug
C:\CMakeFiles\3.13.1\CompilerIdCXX\tmp
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug\CMakeCXXCompilerId.obj
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\CL.command.1.tlog
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\CL.read.1.tlog
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\CL.write.1.tlog
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\CompilerIdCXX.lastbuildstate
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\link.command.1.tlog
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\link.read.1.tlog
C:\CMakeFiles\3.13.1\CompilerIdCXX\Debug\CompilerIdCXX.tlog\link.write.1.tlog
C:\CMakeFiles\3.13.1\x64\Debug
C:\CMakeFiles\3.13.1\x64\Debug\VCTargetsPath.tlog
C:\CMakeFiles\3.13.1\x64\Debug\VCTargetsPath.tlog\VCTargetsPath.lastbuildstate
C:\CMakeFiles\CMakeTmp\testCXXCompiler.cxx
Since it created a CompilerIdCXX.exe
it's plainly obvious that it can invoke visual studio 2015 to build something. Why it has to do this twice I have no idea.
Anyways, this is halting all progress on our task here and I need help ASAP with this.
Edited by Craig Scott