[CMake] CMake skip unnecessary compiler checks

Saad Khattak saadrustam at gmail.com
Sat Dec 16 11:15:31 EST 2017


Hi,

We have about a hundred projects that use CMake to do the compilation. Each
night, we do a clean build and CMake performs unnecessary compiler checks
for every single project:

-- The C compiler identification is MSVC 17.0.61030.0
-- The CXX compiler identification is MSVC 17.0.61030.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
Studio 11.0/VC/bin/x86_amd64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual
Studio 11.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
Studio 11.0/VC/bin/x86_amd64/cl.exe
-- Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual
Studio 11.0/VC/bin/x86_amd64/cl.exe -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: xxxxx

Now I can understand if CMake needs to do it once, but when it does this
100 times, the build slows down a few seconds per project for no reason
especially when we know, after the first project generation, that things
are working.

Using the workaround "project(myProj NONE)" is not good because it has
other side effects. I would like CMake to cache the result of the above
checks somehow for subsequent projects.

Also, just as an FYI for anyone on Linux, CMake's compiler identification
and checking for a working compiler works almost instantaneously on Linux
(e.g. trying the same on Linux will start the generation process pretty
much instantaneously). On Windows this takes a while (about 8 seconds). Not
sure why there is a big discrepancy in the way the compilers are identified
and checked.

Thank you,
Saad
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://cmake.org/pipermail/cmake/attachments/20171216/a82a0e29/attachment.html>


More information about the CMake mailing list