[CMake] Setting CMAKE_C_COMPILER CMAKE_CXX_COMPILER Deletes Cache?

David Cole david.cole at kitware.com
Mon May 23 17:45:26 EDT 2011


On Mon, May 23, 2011 at 5:37 PM, kent williams <nkwmailinglists at gmail.com>wrote:

> Ran into this with CMake 2.8.4 on Linux -- though apparently not on my
> OS X machine, go figure.
>
> I had a nightly build shell script that as a matter of course set
> CMAKE_C_COMPILER and CMAKE_CXX_COMPILER on the command line.  I was
> getting mysteriously unnamed builds in our Dashboard.
>
> What I traced it down to:
>
> When I ran cmake in a batch that sets the compiler variables, cmake
> decided that the compilers had been changed and deleted the cache  and
> reran itself.  Unfortunately it also forgot BUILDNAME -- which I also
> set on the command line, and the BUILDNAME reverted to its default
> value (set in my top level CMakelists.txt) of UNKNOWN-build.
>
> So is there any way not to descend into this hell of deleted cache
> variables?
> _______________________________________________
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake
>

If you start with a clean build tree, there shouldn't be a problem.

If you start with a non-clean build tree, be sure to use the same compiler
used last time.

Neither of those ways should descend into hell. If you prove me wrong, I
will bring you a cold beer in hell.

Also, I would recommend using the environment variables CC and CXX to set
the compiler. CMake only even looks at those env vars if the compiler is not
already cached in the first place. If you pass them in via -D args, then
those -D args override what's in the cache...


:-)
David
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20110523/32afa521/attachment-0001.htm>


More information about the CMake mailing list