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...).
_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to