On Sat, 2 Nov 2013 15:09:25 +0100
Petr Kmoch <[email protected]> wrote:

> 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.

Thanks, it was not really clear even after your explanation. I had to
try a couple of times to get it right.

To sum it up for posterity:

# main CMakeLists.txt
project(projectname C ASM)
include_directories(...)
add_subdirectories(/somedir/MODULEA)
add_subdirectories(/somedir/MODULEB)
...
add_executable(projectname main.c
  $<TARGET_OBJECTS:modulea>
  $<TARGET_OBJECTS:moduleb>
)
set_target_proprieties(projectname PROPRIETIES ENABLE_EXPORTS ON)

# CMakeLists.txt for each module directory
add_library(modulea OBJECT modulea.c)

Thanks again

I need to cleanup a bit my python code, then I should have a working
program to convert projects from Eclipse/AVR32 Studio to CMake.

BTW compiling time went from 16sec to 4sec (I think mainly because
there is something impeding to successfully launch parallel build, but
even running a serial build with cmake/make shaves a bit more than a
couple of seconds)

-- 
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

Reply via email to