Bug #1693

ProvideGoogleMock macro doesn't allow changing gmock source from inside cmake

Added by Anonymous over 10 years ago. Updated over 10 years ago.

Status:ResolvedStart date:12/19/2013
Priority:UrgentDue date:
Assignee:J. Wienke% Done:

100%

Category:cmake
Target version:Robotics Service Bus - rsb-0.11

Description

The cmake macro ProvideGoogleMock doesn't allow setting an alternative gmock source path from within the calling cmake script. Calling cmake with the command line option -DGMOCK_SOURCE=... works to change the download url, however

set(GMOCK_SOURCE "http://googlemock.googlecode.com/files/gmock-1.6.0.zip" FORCE)
include(ProvideGoogleMock)

in the calling cmake file doesn't change anything. Probably an issue with the friggin' cmake caching.


Related issues

Blocks Robot Control Interface - Bug #1692: rci doesn't build with rsc>=0.10 Resolved 12/19/2013

History

#1 Updated by J. Wienke over 10 years ago

It does, but as this is a cache variable, you probably need to define it as such to override the default value.

SET(GMOCK_SOURCE "bla" CACHE STRING "dummy description")

#2 Updated by J. Wienke over 10 years ago

Oh and if you previously defined it with the command line in the same configuration you might even need the force ;)

#3 Updated by Anonymous over 10 years ago

I need to provide a description for the GMOCK_SOURCE variable in my downstream project just to overwrite the variable of the upstream project?

#4 Updated by Anonymous over 10 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 90

set(GMOCK_SOURCE "http://googlemock.googlecode.com/files/gmock-1.6.0.zip" CACHE STRING "cmake cache sucks" FORCE) works, but this feels wrong and is not intuitive. Do we really need to use this sh** cmake caching?

#5 Updated by J. Wienke over 10 years ago

  • Status changed from Resolved to New
  • % Done changed from 90 to 0

I can't change cmake :/ The problem is that the cache is mainly intended to change variable from a user perspective, which means the command line or ccmake. In this case you are actually defining the cache variable before the "first" definition in the google mock cmake file. Moreover, FORCE can only be used with the CACHE syntax.

#6 Updated by J. Wienke over 10 years ago

Without caching the user would not have a persistent possibility to override the default location from the command line.

#7 Updated by J. Wienke over 10 years ago

May I close this?

#8 Updated by Anonymous over 10 years ago

You just re-opened it.

#9 Updated by J. Wienke over 10 years ago

No?

#10 Updated by J. Wienke over 10 years ago

  • Status changed from New to Resolved
  • % Done changed from 0 to 100

No idea how this happend

Also available in: Atom PDF