Erik Sjölund
2015-07-22 12:25:26 UTC
Hi,
I think this warning could be removed: "You have called ADD_LIBRARY
for library foobar without any source files. This typically indicates
a problem with your CMakeLists.txt file "
If you have a function that populates sources to a target, let us say
something like this:
function(activate_feature target_name)
target_sources(${target_name} PRIVATE feature.cc)
endfunction()
you would like to be able to do
add_library(foobar SHARED)
activate_feature(foobar)
without any CMake warning.
I've started using that design scheme more and more. That is, to have
a function setting up a target where the target name is given as an
input parameter. The nice thing about it is that I can pass both an
executable target and a shared library target as input to such a
function.
cheers,
Erik Sjölund
--
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-devel
I think this warning could be removed: "You have called ADD_LIBRARY
for library foobar without any source files. This typically indicates
a problem with your CMakeLists.txt file "
If you have a function that populates sources to a target, let us say
something like this:
function(activate_feature target_name)
target_sources(${target_name} PRIVATE feature.cc)
endfunction()
you would like to be able to do
add_library(foobar SHARED)
activate_feature(foobar)
without any CMake warning.
I've started using that design scheme more and more. That is, to have
a function setting up a target where the target name is given as an
input parameter. The nice thing about it is that I can pass both an
executable target and a shared library target as input to such a
function.
cheers,
Erik Sjölund
--
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-devel