Hi,

I am trying to merge together two "OBJECT" libraries.
I am following the tutorial at: 
https://cmake.org/Wiki/CMake/Tutorials/Object_Library

However, in my case I have more level of folder nesting, and at the parent 
level I would like to merge two "OBJECT" libraries and only at the top I want 
to create the actual library.

I tried with:

add_library(common OBJECT "$<TARGET_OBJECTS:A> $<TARGET_OBJECTS:B> 
$<TARGET_OBJECTS:C>")

But I get the following error:

-----------------------------------------------------------------------------------------------------
CMake Error at lib/common/CMakeLists.txt:31 (add_library):
  OBJECT library "common" contains:

    file1.cpp.o
    file2.cpp.o
    file3.cpp.o
    ...

  but may contain only sources that compile, header files, and other files
  that would not affect linking of a normal library.

CMake Error at lib/common/CMakeLists.txt:31 (add_library):
  Only executables and non-OBJECT libraries may reference target objects.

What's the correct way to do this?

Thanks.
Simone


-----------------------------------------------------------------------------------
This email message is for the sole use of the intended recipient(s) and may 
contain
confidential information.  Any unauthorized review, use, disclosure or 
distribution
is prohibited.  If you are not the intended recipient, please contact the 
sender by
reply email and destroy all copies of the original message.
-----------------------------------------------------------------------------------
-- 

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

Reply via email to