For me, this sounds more like foo is an independent thing and not a subdirectory.
In this case, I think about two solutions: 1) Use a macro/function "check_yada", which sets a variable "yada_usable". If you extract this logic in an extra .cmake file, you can reuse it in your yada CMakelists.txt 2) Use foo as an external project. But thats looks like a major change in the project structure. Am 27.03.19 um 20:05 schrieb Steve Keller:
"Albrecht Schlosser" <[email protected]> wrote:If you want yadda to be optional then don't use REQUIRED. find_package(yadda) if (yadda_FOUND) message(STATUS "found yadda, building bar ...") # add your code to build bar here endif () This should do what you want - unless I misunderstood your question.This will roughly do what I want, but I think it does not correctly express things. For the sub-project, yadda is not optional, and if I call cmake in that sub-project's directory, it should fail. What I think would be appropriate would be a command add_subdirectory_optional(...) or add_subdirectory_and_ignore_errors(...) or something similar. Steve
-- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: https://cmake.org/mailman/listinfo/cmake
