<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body text="#000000" bgcolor="#FFFFFF">
Good morning,<br>
given the following configuration:<br>
<br>
/CMakeLists.txt<br>
/include/<br>
/lib1/CMakeLists.txt<br>
/lib2/CMakeLists.txt<br>
...<br>
<br>
where each /lib.*/CMakeLists.txt creates its own archive:<br>
<br>
<tt>add_library(</tt><tt><span
style="color:#008000;font-weight:bold;">lib.* EXCLUDE_FROM_ALL<br>
</span></tt><tt><span style="color:#008000;font-weight:bold;">
foo.cpp<br>
</span></tt><tt><span style="color:#008000;font-weight:bold;">
bar.cpp<br>
</span></tt><tt>)</tt><tt><br>
</tt><tt>target_link_libraries(</tt><tt><span
style="color:#008000;font-weight:bold;">lib1 PUBLIC interface</span></tt><tt>)</tt><tt><br>
</tt><br>
and the final /CMakeLists.txt should wrap all libraries together::<br>
<span style="color:#808080;font-style:italic;"><br>
</span><tt>add_library(</tt><tt><span
style="color:#008000;font-weight:bold;">interface INTERFACE</span></tt><tt>)</tt><tt><br>
</tt><tt>target_include_directories(</tt><tt><span
style="color:#008000;font-weight:bold;">interface INTERFACE
include/</span></tt><tt>)</tt><tt><span
style="color:#808080;font-style:italic;"><br>
</span></tt><tt>add_subdirectory(</tt><tt><span
style="color:#008000;font-weight:bold;">lib1 lib2</span></tt><tt>
...)</tt><tt><br>
</tt><tt>add_library(</tt><tt><span
style="color:#008000;font-weight:bold;">libcommon INTERFACE</span></tt><tt>)</tt><tt><br>
</tt><tt>target_link_libraries(</tt><tt><span
style="color:#008000;font-weight:bold;">libcommon INTERFACE lib1
lib2</span></tt><tt> ...)</tt><tt><br>
</tt><br>
I wonder how to create an install target for the final library
`libcommon' ?<br>
This snippet doesn't seem effective with INTERFACE targets:<br>
<tt>install(</tt><tt><span style="color:#008000;font-weight:bold;">TARGETS
libcommon<br>
</span></tt><tt><span style="color:#008000;font-weight:bold;">
RUNTIME DESTINATION </span></tt><tt><span
style="color:#000080;font-weight:bold;">${</span></tt><tt><span
style="color:#008000;font-weight:bold;">CMAKE_INSTALL_BINDIR</span></tt><tt><span
style="color:#000080;font-weight:bold;">}<br>
</span></tt><tt><span style="color:#000080;font-weight:bold;"> </span></tt><tt><span
style="color:#008000;font-weight:bold;"> ARCHIVE DESTINATION
</span></tt><tt><span style="color:#000080;font-weight:bold;">${</span></tt><tt><span
style="color:#008000;font-weight:bold;">CMAKE_INSTALL_LIBDIR</span></tt><tt><span
style="color:#000080;font-weight:bold;">}<br>
</span></tt><tt><span style="color:#000080;font-weight:bold;"> </span></tt><tt><span
style="color:#008000;font-weight:bold;"> LIBRARY DESTINATION
</span></tt><tt><span style="color:#000080;font-weight:bold;">${</span></tt><tt><span
style="color:#008000;font-weight:bold;">CMAKE_INSTALL_LIBDIR</span></tt><tt><span
style="color:#000080;font-weight:bold;">}<br>
</span></tt><tt>)</tt><br>
<br>
Thanks,<br>
Quack<br>
</body>
</html>