Hi

I have say mod1.cc and mod2.cc that are C++ files
plus mod3.c and mod4.c that are C files
and I need to link them with a specific linker and link
command.
I want to compile them and after that link them
with specific linker command.
I do not want to use the toolchain linker.

I thought the following would work

add_library(Cxxcode OBJECT mod1.cc mod2.cc)
add_library(Ccode OBJECT mod3.c mod4.c)
add_custom_target(prog
COMMAND "${MY_LINKER} $<TARGET_OBJECTS:Ccode> <TARGET_OBJECTS:Cxxcode> ${MY_LINK_OPTIONS} -o prog"
 COMMENT "Linking mix C++ and C"
 )

But I get error
The evaluation of the TARGET_OBJECTS generator expression is only suitable for consumption by CMake.

So how can I do this ?


--

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

Reply via email to