[CMake] Set default build type in CMakeLists.txt
James Bigler
jamesbigler at gmail.com
Tue Jun 23 22:51:04 EDT 2009
On Mon, Jun 22, 2009 at 10:05 AM, David Doria<daviddoria at gmail.com> wrote:
> You may also need to use FORCE:
>>
>> if(NOT CMAKE_BUILD_TYPE)
>> set(CMAKE_BUILD_TYPE "Release" CACHE STRING
>> "Choose the type of build, options are: Debug Release
>> RelWithDebInfo MinSizeRel."
>> FORCE)
>> endif(NOT CMAKE_BUILD_TYPE)
>>
>> James
>> _______________________________________________
>
> Great, that did it (it did require using FORCE). I don't understand why
> <docstring> is required? Why can you not leave that string alone and simply
> change the value of <variable>?
Because if you want to use FORCE you need to have a doc string. Note
the [] grouping. If you don't provide a doc string it will not get
the right number of arguments.
set(<variable> <value> [[CACHE <type> <docstring> [FORCE]] | PARENT_SCOPE])
I've wanted the ability to set cache variables and leave the doc
string alone for a while. I've just gotten used to the missing
feature. I asked once if we could have the ability to query a doc
string for a cache variable, so that I would only have to document the
variable once, but I never filed a bug request for it.
James
More information about the CMake
mailing list