[CMake] [cmake-developers] CMake IR

Ruslan Baratov ruslan_baratov at yahoo.com
Fri Jul 31 12:33:48 EDT 2015


On 30-Jul-15 20:36, Bill Hoffman wrote:
> On 7/30/2015 11:56 AM, Dan Kegel wrote:
>> I believe the latter, but not the former.
>> I never use the GUI, and consider the cache an anti-feature there solely
>> to support GUI users.  It complicates my life, and I'd love to see it 
>> go.
> It is certainly not there just for the GUI.  Every try-compile, 
> find_library, find_program result is stored there as well.  If you did 
> this each time, it would be not only slow to re-run a build, but it 
> might come up with different answers each time.   If it went it would 
> complicate your life even more.
[...]
> In what way do you think it is causing you trouble?
>

Here is an example:

     # CMakeLists.txt
     cmake_minimum_required(VERSION 3.0)
     project(Foo)

     if(A)
       set(B "Hello A" CACHE STRING "Do we use A?")
     else()
       set(B "There is no A" CACHE STRING "Do we use A?")
     endif()

User thinks: okay, if I set A=ON I will have B equal to "Hello A".

What user really have:

     > rm -rf _builds
     > cmake -H. -B_builds
     > cmake -H. -B_builds -DA=ON
     > grep '\<B\>' _builds/CMakeCache.txt
     B:STRING=There is no A

I'm not saying cache is a bad idea, I'm just saying that when users hit 
such kind of situations that's one of the reason why they said CMake is 
not a good script language. Just like CMake before CMP0054: user see 
`if("a" STREQUAL "b")` and think "okay, 'a' is not equal to 'b' so this 
condition is always false"... nope!

Ruslo


More information about the CMake mailing list