[CMake] String option recognized as boolean

Андрей Парамонов cmr.pent at gmail.com
Fri May 30 03:37:08 EDT 2014


I have replaced

option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO
SVN TGZ)" "NO")

with

set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External Library
Building (NO SVN TGZ)")
SET_PROPERTY(CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN TGZ)

however cmake-gui still mistakenly recognizes HDF5_ALLOW_EXTERNAL_SUPPORT as
boolean.

If I specify -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=SVN from command-line, it
is processed properly, but with a warning in CMakeCache.txt:

//No help, variable specified on the command line.
HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN"

I expect it to be

// Allow External Library Building (NO SVN TGZ)
HDF5_ALLOW_EXTERNAL_SUPPORT:STRING="SVN"

Best wishes,
Andrey Paramonov



2014-05-30 11:11 GMT+04:00 Nils Gladitz <nilsgladitz at gmail.com>:

> On 05/30/2014 08:27 AM, Андрей Парамонов wrote:
>
>  Is it a problem in cmake or in HDF5 sources? If the latter, how could it
>> be fixed?
>> I'm a first-time cmake user, so please forgive my ignorance ;-)
>>
>> Best wishes,
>> Andrey Paramonov
>>
>
> I haven't tried configuring the project but looking at the sources ...
>
> CMakeFilters.cmake (included by CMakeLists.txt) defines it as a boolean
> option:
>
>   option (HDF5_ALLOW_EXTERNAL_SUPPORT "Allow External Library Building (NO
> SVN TGZ)" "NO")
>
> option() is always boolean. To create cache variables with a different
> type use set(); this seems to be done by your project's
> config/cmake/cacheinit.cmake (which I assume isn't directly included):
>
>   set (HDF5_ALLOW_EXTERNAL_SUPPORT "NO" CACHE STRING "Allow External
> Library Building (NO SVN TGZ)" FORCE)
>   SET_PROPERTY(CACHE HDF5_ALLOW_EXTERNAL_SUPPORT PROPERTY STRINGS NO SVN
> TGZ)
>
> If you were to replace the existing option() with that snippet remove the
> "FORCE" keyword first.
>
> Nils
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20140530/f714bcf9/attachment.html>


More information about the CMake mailing list