[CMake] Multiple calls to find_package(Boost) with different components
Hi all, I have a use case where find_package(Boost COMPONENTS xxx) is called more than once, and each time with a different set of components, as in the following example: cmake_minimum_required(VERSION 2.6) project(MyBoost) find_package(Boost REQUIRED COMPONENTS date_time) message(STATUS 1st call: Boost_LIBRARIES=${Boost_LIBRARIES}) find_package(Boost REQUIRED COMPONENTS regex) message(STATUS 2nd call: Boost_LIBRARIES=${Boost_LIBRARIES}) Upon configuring the project for the first time, everything works as expected, and the relevant output I get is: -- 1st call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so -- 2nd call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so;/opt/boost/lib/libboost_regex-mt.so Now if I clear all non-internal Boost_* cache variables, such as by removing the Boost group in cmake-gui and reconfigure my project, I get -- 1st call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so -- 2nd call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so Which is unexpected. Should the above example work for the two described scenarios, or am I entering some state that yields undefined behavior? Thanks in advance, Adolfo -- Adolfo Rodríguez Tsouroukdissian, Ph. D. Robotics engineer PAL ROBOTICS S.L http://www.pal-robotics.com Tel. +34.93.414.53.47 Fax.+34.93.209.11.09 AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden contener información privilegiada y/o confidencial que está dirigida exclusivamente a su destinatario. Si usted recibe este mensaje y no es el destinatario indicado, o el empleado encargado de su entrega a dicha persona, por favor, notifíquelo inmediatamente y remita el mensaje original a la dirección de correo electrónico indicada. Cualquier copia, uso o distribución no autorizados de esta comunicación queda estrictamente prohibida. CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may contain confidential information which is privileged and intended only for the individual or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of this e-mail and/or accompanying document(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender at the above e-mail address. ___ 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
Re: [CMake] Multiple calls to find_package(Boost) with different components
Hi Adolfo, I think you already answered your question yourself, though maybe you didn't realize it. Fortunately you wrote the key phrase ... Now if I clear all non-internal Boost_* cache variables ... The thing is, FindBoost keeps track of the components it has already found in internal variables named Boost_component_FOUND. So, if you don't remove these variables from the cache, you're entering the realm of undefined behaviour. I don't know if the author(s) of FindBoost are to blame, e.g., for possible abuse of internal variables; or that you should never do what you did. I'm more of a command-line person, so I have no experience with groups in the cmake-gui. Best regards, Marcel Loose. On Mon, 2009-12-21 at 10:37 +0100, Adolfo Rodríguez Tsouroukdissian wrote: Hi all, I have a use case where find_package(Boost COMPONENTS xxx) is called more than once, and each time with a different set of components, as in the following example: cmake_minimum_required(VERSION 2.6) project(MyBoost) find_package(Boost REQUIRED COMPONENTS date_time) message(STATUS 1st call: Boost_LIBRARIES=${Boost_LIBRARIES}) find_package(Boost REQUIRED COMPONENTS regex) message(STATUS 2nd call: Boost_LIBRARIES=${Boost_LIBRARIES}) Upon configuring the project for the first time, everything works as expected, and the relevant output I get is: -- 1st call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so -- 2nd call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so;/opt/boost/lib/libboost_regex-mt.so Now if I clear all non-internal Boost_* cache variables, such as by removing the Boost group in cmake-gui and reconfigure my project, I get -- 1st call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so -- 2nd call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so Which is unexpected. Should the above example work for the two described scenarios, or am I entering some state that yields undefined behavior? Thanks in advance, Adolfo -- Adolfo Rodríguez Tsouroukdissian, Ph. D. Robotics engineer PAL ROBOTICS S.L http://www.pal-robotics.com Tel. +34.93.414.53.47 Fax.+34.93.209.11.09 AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden contener información privilegiada y/o confidencial que está dirigida exclusivamente a su destinatario. Si usted recibe este mensaje y no es el destinatario indicado, o el empleado encargado de su entrega a dicha persona, por favor, notifíquelo inmediatamente y remita el mensaje original a la dirección de correo electrónico indicada. Cualquier copia, uso o distribución no autorizados de esta comunicación queda estrictamente prohibida. CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may contain confidential information which is privileged and intended only for the individual or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of this e-mail and/or accompanying document(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender at the above e-mail address. ___ 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 ___ 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
Re: [CMake] Multiple calls to find_package(Boost) with different components
On Mon, Dec 21, 2009 at 12:09 PM, Marcel Loose lo...@astron.nl wrote: Hi Adolfo, I think you already answered your question yourself, though maybe you didn't realize it. Fortunately you wrote the key phrase ... Now if I clear all non-internal Boost_* cache variables ... The thing is, FindBoost keeps track of the components it has already found in internal variables named Boost_component_FOUND. So, if you don't remove these variables from the cache, you're entering the realm of undefined behaviour. Ack. I don't know if the author(s) of FindBoost are to blame, e.g., for possible abuse of internal variables; or that you should never do what you did. I'm more of a command-line person, so I have no experience with groups in the cmake-gui. For now, I guess it'll be the latter, to avoid causing undefined behavior. Thanks for confirming what's going on. Adolfo. Best regards, Marcel Loose. On Mon, 2009-12-21 at 10:37 +0100, Adolfo Rodríguez Tsouroukdissian wrote: Hi all, I have a use case where find_package(Boost COMPONENTS xxx) is called more than once, and each time with a different set of components, as in the following example: cmake_minimum_required(VERSION 2.6) project(MyBoost) find_package(Boost REQUIRED COMPONENTS date_time) message(STATUS 1st call: Boost_LIBRARIES=${Boost_LIBRARIES}) find_package(Boost REQUIRED COMPONENTS regex) message(STATUS 2nd call: Boost_LIBRARIES=${Boost_LIBRARIES}) Upon configuring the project for the first time, everything works as expected, and the relevant output I get is: -- 1st call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so -- 2nd call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so;/opt/boost/lib/libboost_regex-mt.so Now if I clear all non-internal Boost_* cache variables, such as by removing the Boost group in cmake-gui and reconfigure my project, I get -- 1st call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so -- 2nd call: Boost_LIBRARIES=/opt/boost/lib/libboost_date_time-mt.so Which is unexpected. Should the above example work for the two described scenarios, or am I entering some state that yields undefined behavior? Thanks in advance, Adolfo -- Adolfo Rodríguez Tsouroukdissian, Ph. D. Robotics engineer PAL ROBOTICS S.L http://www.pal-robotics.com Tel. +34.93.414.53.47 Fax.+34.93.209.11.09 AVISO DE CONFIDENCIALIDAD: Este mensaje y sus documentos adjuntos, pueden contener información privilegiada y/o confidencial que está dirigida exclusivamente a su destinatario. Si usted recibe este mensaje y no es el destinatario indicado, o el empleado encargado de su entrega a dicha persona, por favor, notifíquelo inmediatamente y remita el mensaje original a la dirección de correo electrónico indicada. Cualquier copia, uso o distribución no autorizados de esta comunicación queda estrictamente prohibida. CONFIDENTIALITY NOTICE: This e-mail and the accompanying document(s) may contain confidential information which is privileged and intended only for the individual or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or use of this e-mail and/or accompanying document(s) is strictly prohibited. If you have received this e-mail in error, please immediately notify the sender at the above e-mail address. ___ 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 ___ 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