"Albrecht Schlosser" <albrechts.f...@online.de> 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