Hi,

I am trying to dynamically assemble a list of generator expressions and use 
them in add_executable. The background is that I have some macros to add 
targets, e.g.
add_my_library(TARGET liba SOURCES ...) # this class add_library(liba OBJECT 
...) internally
add_my_executable(TARGET a DEPENDS liba libb SOURCES ...)

In add_my_executable, I create a list of $<TARGET_OBEJCTS:${d}> strings for all 
d {liba, libb}. However, cmake complains that it cannot find the source file 
$<TARGET_OBJECTS:liba>.

A simplified example of what I want to do is this:
add_library(A OBJECT a.cpp)
set(alib $<TARGET_OBJECTS:A)
add_executable(a.exe ${alib})
add_executable(b.exe $<TARGET_OBJECTS:A> )

With cmake 3.2.2, the first add_executable fails, the second one works. Is 
there another way to do this?

Best wishes,
  Jens

--
Dr. Jens Auer | CGI | Software Engineer
CGI Deutschland Ltd. & Co. KG
Rheinstraße 95 | 64295 Darmstadt | Germany
T: +49 6151 36860 154
jens.a...@cgi.com<mailto:jens.a...@cgi.com>
Unsere Pflichtangaben gemäß § 35a GmbHG / §§ 161, 125a HGB finden Sie unter 
de.cgi.com/pflichtangaben<http://de.cgi.com/pflichtangaben>.

CONFIDENTIALITY NOTICE: Proprietary/Confidential information belonging to CGI 
Group Inc. and its affiliates may be contained in this message. If you are not 
a recipient indicated or intended in this message (or responsible for delivery 
of this message to such person), or you think for any reason that this message 
may have been addressed to you in error, you may not use or copy or deliver 
this message to anyone else. In such case, you should destroy this message and 
are asked to notify the sender by reply e-mail.

-- 

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