[CMake] option bug ?

Gaspard Bucher gaspard at teti.ch
Fri Jul 2 17:52:15 EDT 2010


I have two projects: A and B. A depends on B but should set some settings
for the proper compilation of B when included in A.

==== CMakeLists.txt ==== (project A)

set(PROJB_OPENCV_LINK NO)

add_subdirectory(vendor/projb)

==== vendor/projb/CMakeLists.txt === (project B)

option (PROJB_OPENCV_LINK "Set this to NO to link opencv alloc later." YES)

========

The local value "PROJB_OPENCV_LINK" is overwritten by the option on the
first run. If you run cmake a second time, the cached value is seen and
takes over so the option does not overwrite.

I do not see any reason why an "option" setting should overwrite a defined
variable.

build > cmake .. ==> fail

build > cmake .. || cmake .. ==> works. This is absurd.

Gaspard


PS: I know there is a workaround by using IF(DEFINED...).
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100702/c9933336/attachment.htm>


More information about the CMake mailing list