[Cmake] Set project defaults that are still accessible from the ccmake GUI?

Zachary Pincus zpincus at stanford.edu
Wed, 28 Apr 2004 13:48:39 -0700


Hello,

I'm trying to set up a few default settings for a project that both 
appear in the ccmake GUI and can be overridden by the users. This 
doesn't seem like it should be too hard, but I can't get it working.

For example,
SET(CMAKE_BUILD_TYPE RelWithDebInfo)
doesn't work -- RelWithDebInfo doesn't show up in the GUI under 
CMAKE_BUILD_TYPE, and the GUI's value is always overridden.

So I try
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "...")
but that doesn't work either. "RelWithDebInfo" doesn't show up in the 
ccmake GUI. When I build, the build type is *not* RelWithDebInfo. On 
the plus side, values set by the user in the GUI are respected.

So I try
SET(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "..." FORCE)
but that still doesn't work. "RelWithDebInfo" now shows up in the 
ccmake GUI, but values set by the user in the GUI are overwritten.

Is there any simple way to provide a default value for a cmake-standard 
variable?

Zach Pincus

Department of Biochemistry and Program in Biomedical Informatics
Stanford University School of Medicine