CMake skip unnecessary compiler checks

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

CMake skip unnecessary compiler checks

Saad Khattak
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

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake