On Fri, Jun 27, 2014 at 15:48:34 +0200, Ådne Hovda wrote: > It would be handy when creating macros that wraps add_library where the > number of source files is unknown to be able to write: > > add_library( mylib ) > target_sources( mylib PRIVATE mylib.c mylib.h ) > > but this fails with the warning "You have called ADD_LIBRARY for library > testlib without any source files. This typically indicates a problem > with your CMakeLists.txt file"
Why not just defer the add_library until the end of the file? > I have tried to just remove that check in cmAddLibraryCommand and apart > from a warning about missing LINKER_LANGUAGE it works okay. > > https://github.com/aadnehovda/CMake/commit/d527b1db787c426517f7af357df0cd3ba9d9a12a > > I guess there are other implications I have not though of as well? Does the test suite run without complaint? Also, a test for this would be appreciated. --Ben -- 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: http://public.kitware.com/mailman/listinfo/cmake-developers