Hi Ivan. The correct use of OBJECT libraries is not to link against them, but to list them as sources (using a special syntax), like this:
add_executable(project main.c $<TARGET_OBJECTS:serial>) (Assuming 'serial' is the name of the object library). This is outlined in the documentation for OBJECT libraries. Petr On Sat, Nov 2, 2013 at 7:50 AM, Ivan Sergio Borgonovo <[email protected]>wrote: > I'm trying to convert an embedded eclipse project to CMake with a > python script. > > I reached a point where everything compile as I want, everything get > listed in the linking step but libraries are in the wrong order and > linking fail. > > Just reordering the libraries list and running the linking process by > hand produce the right executable. > > I want to convert the project in a completely automatic way and I don't > want my python code to get too complicated to understand > inter-libraries dependencies to write smarter CMakeLists.txt files or > to order properly the libraries unless there is a very simple way to do > so. This would be sweet but I don't think there is a simple way. > > Eclipse was compiling everything as objects so order of linking was not > important. > > I've tried to follow > http://www.cmake.org/Wiki/CMake/Tutorials/Object_Library > I get > > CMake Error at cmakedirs.cmake:118 (target_link_libraries): > Target "serial" of type OBJECT_LIBRARY may not be linked into another > target. One may link only to STATIC or SHARED libraries, or to > executables with the ENABLE_EXPORTS property set. > Call Stack (most recent call first): > CMakeLists.txt:89 (include) > > for all libraries > > But I can't get rid of the same error even when I add: > add_executable(project main.c) > set_target_properties(project PROPERTIES ENABLE_EXPORTS ON) #<-- > > > -- > Ivan Sergio Borgonovo > http://www.webthatworks.it > > -- > > 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://www.cmake.org/mailman/listinfo/cmake >
-- 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://www.cmake.org/mailman/listinfo/cmake
