<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Thanks <span>Sebastián </span>for providing those links!</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I've followed the second link that you've provided but somehow I'm still running into issue.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">I've changed the directory structure to this:</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><span style="font-family: Consolas, Courier, monospace;">- kImageAnnotator</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - cmake</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - </span><span style="font-family: Consolas, Courier, monospace;">kImageAnnotator</span><span style="font-family: Consolas, Courier, monospace;">-config.cmake.in
</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - example</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - main.cpp
</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - CMakeLists.txt</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - include</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - </span><span style="font-family: Consolas, Courier, monospace;">kImageAnnotator</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - </span><span style="font-family: Consolas, Courier, monospace;">KImageAnnotator</span><span style="font-family: Consolas, Courier, monospace;">.h // the main api header</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - src</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - </span><span style="font-family: Consolas, Courier, monospace;">KImageAnnotator</span><span style="font-family: Consolas, Courier, monospace;">.cpp
</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - "And all other .cpp and .h files"</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - CMakeLists.txt</span><br>
<span style="font-family: Consolas, Courier, monospace;"> - CMakeLists.txt</span></div>
<div><br>
</div>
<div>src/CMakeList.txt looks like this:</div>
<div>
<div><span style="font-family: Consolas, Courier, monospace;">add_library(kImageAnnotator ${kimageannotator_SRCS} ${CMAKE_SOURCE_DIR}/include/kImageAnnotator/KImageAnnotator.h)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">add_library(kImageAnnotator::kImageAnnotator ALIAS kImageAnnotator)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">option(BUILD_SHARED_LIBS "Build shared library" ON)</span><br>
<span style="font-family: Consolas, Courier, monospace;">include(GenerateExportHeader)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">generate_export_header(kImageAnnotator</span><br>
<span style="font-family: Consolas, Courier, monospace;"> EXPORT_MACRO_NAME KIMAGEANNOTATOR_API</span><br>
<span style="font-family: Consolas, Courier, monospace;"> EXPORT_FILE_NAME ${CMAKE_BINARY_DIR}/include/KImageAnnotator.h</span><br>
<span style="font-family: Consolas, Courier, monospace;"> )</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">target_include_directories(kImageAnnotator</span><br>
<span style="font-family: Consolas, Courier, monospace;"> PUBLIC</span><br>
<span style="font-family: Consolas, Courier, monospace;"> $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include></span><br>
<span style="font-family: Consolas, Courier, monospace;"> $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include></span><br>
<span style="font-family: Consolas, Courier, monospace;"> $<INSTALL_INTERFACE:include></span><br>
<span style="font-family: Consolas, Courier, monospace;"> PRIVATE</span><br>
<span style="font-family: Consolas, Courier, monospace;"> ${CMAKE_CURRENT_SOURCE_DIR}</span><br>
<span style="font-family: Consolas, Courier, monospace;"> )</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">set_target_properties(kImageAnnotator PROPERTIES</span><br>
<span style="font-family: Consolas, Courier, monospace;"> ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib</span><br>
<span style="font-family: Consolas, Courier, monospace;"> LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib</span><br>
<span style="font-family: Consolas, Courier, monospace;"> RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin</span><br>
<span style="font-family: Consolas, Courier, monospace;"> )</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">find_package(Qt5 ${QT_MIN_VERSION} REQUIRED Widgets)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons I18n WidgetsAddons)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">target_link_libraries(kImageAnnotator Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::WidgetsAddons)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">include(GNUInstallDirs)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">install(TARGETS kImageAnnotator</span><br>
<span style="font-family: Consolas, Courier, monospace;"> EXPORT kImageAnnotator-targets</span><br>
<span style="font-family: Consolas, Courier, monospace;"> ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}</span><br>
<span style="font-family: Consolas, Courier, monospace;"> LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}</span><br>
<span style="font-family: Consolas, Courier, monospace;"> RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}</span><br>
<span style="font-family: Consolas, Courier, monospace;"> INCLUDES DESTINATION ${LIBLEGACY_INCLUDE_DIRS}</span><br>
<span style="font-family: Consolas, Courier, monospace;">)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">install(DIRECTORY ${CMAKE_SOURCE_DIR}/include/kImageAnnotator</span><br>
<span style="font-family: Consolas, Courier, monospace;"> DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}</span><br>
<span style="font-family: Consolas, Courier, monospace;">)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">install(EXPORT kImageAnnotator-targets</span><br>
<span style="font-family: Consolas, Courier, monospace;"> FILE kImageAnnotator-targets.cmake</span><br>
<span style="font-family: Consolas, Courier, monospace;"> NAMESPACE kImageAnnotator::</span><br>
<span style="font-family: Consolas, Courier, monospace;"> DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kImageAnnotator</span><br>
<span style="font-family: Consolas, Courier, monospace;">)</span><br>
<br>
<br>
<span style="font-family: Consolas, Courier, monospace;">include(CMakePackageConfigHelpers)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">configure_package_config_file(</span><br>
<span style="font-family: Consolas, Courier, monospace;"> ${CMAKE_SOURCE_DIR}/cmake/kImageAnnotator-config.cmake.in</span><br>
<span style="font-family: Consolas, Courier, monospace;"> ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config.cmake</span><br>
<span style="font-family: Consolas, Courier, monospace;"> INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kImageAnnotator</span><br>
<span style="font-family: Consolas, Courier, monospace;">)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">write_basic_package_version_file(</span><br>
<span style="font-family: Consolas, Courier, monospace;"> ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config-version.cmake</span><br>
<span style="font-family: Consolas, Courier, monospace;"> VERSION ${PROJECT_VERSION}</span><br>
<span style="font-family: Consolas, Courier, monospace;"> COMPATIBILITY AnyNewerVersion</span><br>
<span style="font-family: Consolas, Courier, monospace;">)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">install(FILES</span><br>
<span style="font-family: Consolas, Courier, monospace;"> ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config.cmake</span><br>
<span style="font-family: Consolas, Courier, monospace;"> ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-config-version.cmake</span><br>
<span style="font-family: Consolas, Courier, monospace;"> DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/kImageAnnotator</span><br>
<span style="font-family: Consolas, Courier, monospace;">)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">export(EXPORT kImageAnnotator-targets</span><br>
<span style="font-family: Consolas, Courier, monospace;"> FILE ${CMAKE_BINARY_DIR}/cmake/kImageAnnotator-targets.cmake</span><br>
<span style="font-family: Consolas, Courier, monospace;"> NAMESPACE kImageAnnotator::</span><br>
<span style="font-family: Consolas, Courier, monospace;">)</span></div>
<br>
</div>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">kImageAnnotator-config.cmake.in looks like this:</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><span style="font-family: Consolas, Courier, monospace;">include(CMakeFindDependencyMacro)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">@PACKAGE_INIT@</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;"># find_dependency(Threads)</span><br>
<span style="font-family: Consolas, Courier, monospace;">find_package(Qt5 ${QT_MIN_VERSION} REQUIRED Widgets)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons I18n WidgetsAddons)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">if(NOT TARGET kImageAnnotator::kImageAnnotator)</span><br>
<span style="font-family: Consolas, Courier, monospace;"> include("${CMAKE_CURRENT_LIST_DIR}/kImageAnnotator-targets.cmake")</span><br>
<span style="font-family: Consolas, Courier, monospace;">endif()</span></div>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><span style="font-family: Calibri, Helvetica, sans-serif;">example/CMakeLists.txt looks like this:</span></p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><span style="font-family: Consolas, Courier, monospace;">add_executable(kImageAnnotator-example ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp)</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">target_link_libraries(kImageAnnotator-example PRIVATE kImageAnnotator::kImageAnnotator)</span></div>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">And example/main.cpp looks like this:</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><span style="font-family: Consolas, Courier, monospace;">#include <QApplication></span><br>
<span style="font-family: Consolas, Courier, monospace;">#include <kImageAnnotator/KImageAnnotator.h></span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;">int main(int argc, char **argv)</span><br>
<span style="font-family: Consolas, Courier, monospace;">{</span><br>
<span style="font-family: Consolas, Courier, monospace;"> QApplication app(argc, argv);</span><br>
<span style="font-family: Consolas, Courier, monospace;"> QPixmap pixmap(QSize(500, 500));</span><br>
<span style="font-family: Consolas, Courier, monospace;"> pixmap.fill(QColor(Qt::darkGreen));</span><br>
<span style="font-family: Consolas, Courier, monospace;"> auto kImageAnnotator = new KImageAnnotator(pixmap);</span><br>
<span style="font-family: Consolas, Courier, monospace;"> kImageAnnotator->show();</span><br>
<br>
<span style="font-family: Consolas, Courier, monospace;"> return app.exec();</span><br>
<span style="font-family: Consolas, Courier, monospace;">}</span></div>
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Still I'm getting following error when trying to build kImageAnnotator-example:</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div><span style="font-family: Consolas, Courier, monospace;">Scanning dependencies of target kImageAnnotator-example</span><br>
<span style="font-family: Consolas, Courier, monospace;">[ 98%] Building CXX object example/CMakeFiles/kImageAnnotator-example.dir/main.cpp.o</span><br>
<span style="font-family: Consolas, Courier, monospace;">[ 98%] Building CXX object example/CMakeFiles/kImageAnnotator-example.dir/kImageAnnotator-example_autogen/mocs_compilation.cpp.o</span><br>
<span style="font-family: Consolas, Courier, monospace;">[100%] Linking CXX executable kImageAnnotator-example</span><br>
<span style="font-family: Consolas, Courier, monospace;">CMakeFiles/kImageAnnotator-example.dir/main.cpp.o: In function `main':</span><br>
<span style="font-family: Consolas, Courier, monospace;">/home/dporobic/projects/kImageAnnotator/example/main.cpp:29: undefined reference to `KImageAnnotator::KImageAnnotator(QPixmap const&)'</span><br>
<span style="font-family: Consolas, Courier, monospace;">collect2: error: ld returned 1 exit status</span><br>
<span style="font-family: Consolas, Courier, monospace;">example/CMakeFiles/kImageAnnotator-example.dir/build.make:98: recipe for target 'example/kImageAnnotator-example' failed</span><br>
<br>
</div>
Any idea what I'm doing wrong? It looks like the same issue that I was having earlier.
<p></p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<div style="color: rgb(49, 54, 59);">
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font style="font-size:11pt" face="Calibri, sans-serif" color="#000000"><b>From:</b> Sebastián Mancilla <smancill@jlab.org><br>
<b>Sent:</b> Wednesday, August 15, 2018 21:48<br>
<b>To:</b> damir_porobic@live.com<br>
<b>Cc:</b> cmake@cmake.org<br>
<b>Subject:</b> Re: [CMake] Problem with creating shared library</font>
<div> </div>
</div>
<meta content="text/html; charset=utf-8">
<div>
<div dir="ltr">You are mixing the config file and the targets file.
<div><br>
</div>
<div>The config file is a template that you normally put in cmake/<a href="http://FooConfig.cmake.in" id="LPlnk673869" class="OWAAutoLink" previewremoved="true">FooConfig.cmake.in</a></div>
<div><br>
</div>
<div>You copy the template into the binary dir:</div>
<div><br>
</div>
<div>
<div> include(CMakePackageConfigHelpers)</div>
<br class="x_gmail-Apple-interchange-newline">
</div>
<div>
<div> set(INSTALL_CONFIGDIR lib/cmake/Foo)</div>
<br class="x_gmail-Apple-interchange-newline">
</div>
<div>
<div> configure_package_config_file(</div>
<div> "${CMAKE_CURRENT_LIST_DIR}/cmake/<a href="http://FooConfig.cmake.in" id="LPlnk907765" class="OWAAutoLink" previewremoved="true">FooConfig.cmake.in</a>"</div>
<div> "${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake"</div>
<div> INSTALL_DESTINATION ${INSTALL_CONFIGDIR}</div>
<div> )</div>
<div><br>
</div>
<div>It is a good idea to create a version file:</div>
<div>
<div> </div>
<div> write_basic_package_version_file(</div>
<div> "${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake"</div>
<div> VERSION ${PROJECT_VERSION}</div>
<div> COMPATIBILITY SameMajorVersion</div>
<div> )</div>
</div>
<div><br>
</div>
<div>And then install both:</div>
<div><br>
</div>
<div>
<div> install(FILES</div>
<div> "${CMAKE_CURRENT_BINARY_DIR}/FooConfig.cmake"</div>
<div> "${CMAKE_CURRENT_BINARY_DIR}/FooConfigVersion.cmake"</div>
<div> DESTINATION ${INSTALL_CONFIGDIR}</div>
<div> COMPONENT Devel</div>
<div> )</div>
</div>
<div><br>
</div>
<div>For the targets is a different file. When you install the library you should use</div>
<div><br>
</div>
<div> install(TARGETS Foo EXPORT FooTargets ...)</div>
<div><br>
</div>
<div>And then export and install the targets:<br>
</div>
</div>
<div><br>
</div>
<div> # Into the build tree</div>
<div>
<div> export(EXPORT FooTargets</div>
<div> FILE "${CMAKE_CURRENT_BINARY_DIR}/FooTargets.cmake"</div>
<div> NAMESPACE Foo::</div>
<div> )</div>
<div> </div>
<div> # Into PREFIX</div>
<div> install(EXPORT FooTargets</div>
<div> FILE FooTargets.cmake</div>
<div> NAMESPACE Foo::</div>
<div> DESTINATION ${INSTALL_CONFIGDIR}</div>
<div> COMPONENT Devel</div>
<div> )</div>
</div>
<div><br>
</div>
<div>Finally, your template <a href="http://FooConfig.cmake.in" id="LPlnk751441" class="OWAAutoLink" previewremoved="true">
FooConfig.cmake.in</a> should look like this:</div>
<div><br>
</div>
<div>
<div> include(CMakeFindDependencyMacro)</div>
<div><br>
</div>
<div> @PACKAGE_INIT@</div>
<div> </div>
<div> # list your required dependencies here</div>
<div> find_dependency(Threads)</div>
<div><br>
</div>
<div> if(NOT TARGET Foo::Foo)</div>
<div> include("${CMAKE_CURRENT_LIST_DIR}/FooTargets.cmake")</div>
<div> endif()</div>
</div>
<div><br>
</div>
<div>All this is pretty much the same for any project. Here are the best links explaining it:</div>
<div><br>
</div>
<div><a href="https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/" id="LPlnk260695" class="OWAAutoLink" previewremoved="true">https://pabloariasal.github.io/2018/02/19/its-time-to-do-cmake-right/</a><br>
</div>
<div><a href="http://unclejimbo.github.io/2018/06/08/Modern-CMake-for-Library-Developers/" id="LPlnk655655" class="OWAAutoLink" previewremoved="true">http://unclejimbo.github.io/2018/06/08/Modern-CMake-for-Library-Developers/</a><br>
</div>
<div><br>
</div>
<div><br>
</div>
<div><br>
</div>
</div>
<br>
<div class="x_gmail_quote">
<div dir="ltr">El mié., 15 de ago. de 2018 a la(s) 05:32, Damir Porobic (<a href="mailto:damir_porobic@live.com" id="LPlnk449498" class="OWAAutoLink" previewremoved="true">damir_porobic@live.com</a>) escribió:<br>
</div>
<blockquote class="x_gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div id="x_m_-5021389302390682568divtagdefaultwrapper" dir="ltr" style="font-size:12pt; color:rgb(0,0,0); font-family:Calibri,Helvetica,sans-serif,"EmojiFont","Apple Color Emoji","Segoe UI Emoji",NotoColorEmoji,"Segoe UI Symbol","Android Emoji",EmojiSymbols">
<p style="margin-top:0; margin-bottom:0">Hi Folks,</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0">I'm trying to write a shared library and run into an issue where I can't find any clues to where the problem is.
<br>
<br>
I have a project with following structure:</p>
<p style="margin-top:0; margin-bottom:0"><br>
</p>
<p style="margin-top:0; margin-bottom:0"><span style="font-family:Consolas,Courier,monospace">src/</span></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<p style="margin-top:0; margin-bottom:0"><span style="font-family:Consolas,Courier,monospace"> dir1/</span></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<p style="margin-top:0; margin-bottom:0"><span style="font-family:Consolas,Courier,monospace"> file1.h</span><br>
<span style="font-family:Consolas,Courier,monospace"></span></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<p style="margin-top:0; margin-bottom:0"><span style="font-family:Consolas,Courier,monospace"> file1.cpp</span></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<p style="margin-top:0; margin-bottom:0"><span></span></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<p style="margin-top:0; margin-bottom:0"><span style="font-family:Consolas,Courier,monospace"> dir2/</span></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<p style="margin-top:0; margin-bottom:0"><span style="font-family:Consolas,Courier,monospace"> file2.h</span><br>
<span style="font-family:Consolas,Courier,monospace"></span></p>
<span style="font-family:Consolas,Courier,monospace"></span><span style="font-family:Consolas,Courier,monospace"> file2.cpp</span>
<p></p>
<p style="margin-top:0; margin-bottom:0"><span><span><br>
</span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span><br>
</span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span>Now I have this CMakeList:</span></span></p>
<p style="margin-top:0; margin-bottom:0"><span><span></span></span></p>
<div><span style="font-family:Consolas,Courier,monospace">cmake_minimum_required(VERSION 3.5)</span><br>
<span style="font-family:Consolas,Courier,monospace"></span><br>
<span style="font-family:Consolas,Courier,monospace">project(kImageAnnotator VERSION 0.0.1 LANGUAGES CXX)</span></div>
<span style="font-family:Consolas,Courier,monospace"></span><br>
<span style="font-family:Consolas,Courier,monospace"></span>
<p></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<p style="margin-top:0; margin-bottom:0"><span><span><span style="font-family:Consolas,Courier,monospace">...</span><br>
<span style="font-family:Consolas,Courier,monospace"></span></span></span></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<p style="margin-top:0; margin-bottom:0"><span><span style="font-family:Consolas,Courier,monospace"><br>
</span></span></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<p style="margin-top:0; margin-bottom:0"><span><span></span></span></p>
<span style="font-family:Consolas,Courier,monospace"></span>
<div><span style="font-family:Consolas,Courier,monospace">add_library(${PROJECT_NAME} SHARED ${kimageannotator_SRCS})</span><br>
<span style="font-family:Consolas,Courier,monospace">target_link_libraries(${PROJECT_NAME} Qt5::Widgets KF5::CoreAddons KF5::I18n KF5::WidgetsAddons)</span><br>
<span style="font-family:Consolas,Courier,monospace"></span><br>
<span style="font-family:Consolas,Courier,monospace">target_include_directories(${PROJECT_NAME} PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> $<INSTALL_INTERFACE:include>)</span><br>
<span style="font-family:Consolas,Courier,monospace"></span><br>
<span style="font-family:Consolas,Courier,monospace">set_target_properties(${PROJECT_NAME} PROPERTIES VERSION ${PROJECT_VERSION} SOVERSION 1)</span><br>
<span style="font-family:Consolas,Courier,monospace"></span><br>
<span style="font-family:Consolas,Courier,monospace">set(kimageannotator_CONFIG ${PROJECT_NAME}Config)</span><br>
<span style="font-family:Consolas,Courier,monospace"></span><br>
<span style="font-family:Consolas,Courier,monospace">install(TARGETS ${PROJECT_NAME} EXPORT ${kimageannotator_CONFIG}</span><br>
<span style="font-family:Consolas,Courier,monospace"> ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}</span><br>
<span style="font-family:Consolas,Courier,monospace"> LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}</span><br>
<span style="font-family:Consolas,Courier,monospace"> RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})</span><br>
<span style="font-family:Consolas,Courier,monospace">install(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME})</span><br>
<span style="font-family:Consolas,Courier,monospace"></span><br>
<span style="font-family:Consolas,Courier,monospace">install(EXPORT ${kimageannotator_CONFIG} DESTINATION share/${kimageannotator_CONFIG}/cmake)</span><br>
<span style="font-family:Consolas,Courier,monospace"></span><br>
<span style="font-family:Consolas,Courier,monospace">export(TARGETS ${PROJECT_NAME} FILE ${kimageannotator_CONFIG}.cmake)</span></div>
<div><span><span><br>
</span></span></div>
<div><span><span><br>
</span></span></div>
<div><span><span>In another test project, I add the library like this:</span></span></div>
<div><span><span><span style="font-family:Consolas,Courier,monospace">...</span><br>
<span style="font-family:Consolas,Courier,monospace"></span></span></span></div>
<span style="font-family:Consolas,Courier,monospace"></span>
<div><span><span><span style="font-family:Consolas,Courier,monospace"></span>
<div><span style="font-family:Consolas,Courier,monospace">find_package(kImageAnnotator REQUIRED)</span><br>
<span style="font-family:Consolas,Courier,monospace"></span><br>
<span style="font-family:Consolas,Courier,monospace">add_executable(testApp main.cpp)</span><br>
<span style="font-family:Consolas,Courier,monospace">target_link_libraries(testApp Qt5::Widgets kImageAnnotator)</span></div>
<div><span><span></span></span><br>
</div>
</span></span></div>
<div><br>
</div>
<div>Now when I try to build my test project, I get this:</div>
<div><br>
</div>
<div>
<div><span style="font-family:Consolas,Courier,monospace">dporobic@linux ~/projects/testApp/build</span><br>
<span style="font-family:Consolas,Courier,monospace">$ cmake .. && make</span><br>
<span style="font-family:Consolas,Courier,monospace">-- Could not set up the appstream test. appstreamcli is missing.</span><br>
<span style="font-family:Consolas,Courier,monospace">-- Configuring done</span><br>
<span style="font-family:Consolas,Courier,monospace">-- Generating done</span><br>
<span style="font-family:Consolas,Courier,monospace">-- Build files have been written to: /home/dporobic/projects/testApp/build</span><br>
<span style="font-family:Consolas,Courier,monospace">[ 25%] Automatic moc for target testApp</span><br>
<span style="font-family:Consolas,Courier,monospace">[ 25%] Built target testApp_automoc</span><br>
<span style="font-family:Consolas,Courier,monospace">Scanning dependencies of target testApp</span><br>
<span style="font-family:Consolas,Courier,monospace">[ 50%] Building CXX object CMakeFiles/testApp.dir/main.cpp.o</span><br>
<span style="font-family:Consolas,Courier,monospace">[ 75%] Building CXX object CMakeFiles/testApp.dir/testApp_automoc.cpp.o</span><br>
<span style="font-family:Consolas,Courier,monospace">[100%] Linking CXX executable testApp</span><br>
<span style="font-family:Consolas,Courier,monospace">CMakeFiles/testApp.dir/main.cpp.o: In function `main':</span><br>
<span style="font-family:Consolas,Courier,monospace">main.cpp:(.text+0x8e): undefined reference to `KImageAnnotator::KImageAnnotator(QPixmap const&)'</span><br>
<span style="font-family:Consolas,Courier,monospace">collect2: error: ld returned 1 exit status</span><br>
<span style="font-family:Consolas,Courier,monospace">CMakeFiles/testApp.dir/build.make:120: recipe for target 'testApp' failed</span><br>
<span style="font-family:Consolas,Courier,monospace">make[2]: *** [testApp] Error 1</span><br>
<span style="font-family:Consolas,Courier,monospace">CMakeFiles/Makefile2:67: recipe for target 'CMakeFiles/testApp.dir/all' failed</span><br>
<span style="font-family:Consolas,Courier,monospace">make[1]: *** [CMakeFiles/testApp.dir/all] Error 2</span><br>
<span style="font-family:Consolas,Courier,monospace">Makefile:94: recipe for target 'all' failed</span><br>
<span style="font-family:Consolas,Courier,monospace">make: *** [all] Error 2</span><br>
<br>
</div>
Any idea how I could/should troubleshoot such issue? <br>
</div>
<div><br>
</div>
<div>Thanks in advance!</div>
<div><br>
</div>
<div>Regards,</div>
<div>Damir<br>
</div>
<div><br>
</div>
<br>
<p></p>
</div>
</div>
-- <br>
<br>
Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank" id="LPlnk93362" class="OWAAutoLink" previewremoved="true">
www.kitware.com</a><br>
<br>
Please keep messages on-topic and check the CMake FAQ at: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cmake.org_Wiki_CMake-5FFAQ&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=JJ5RqPyjdlGGc3fT-5nQQM-JcJzwjBZU6ciOQlmEJVs&e=" rel="noreferrer" target="_blank" id="LPlnk853742" class="OWAAutoLink" previewremoved="true">
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.cmake.org_Wiki_CMake-5FFAQ&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=JJ5RqPyjdlGGc3fT-5nQQM-JcJzwjBZU6ciOQlmEJVs&e=</a>
<br>
<br>
Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
<br>
CMake Support: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.org_cmake_help_support.html&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=vUHQvc_7Ovi_5BDjy3JYFOIvTmihTSFOQNndNSpMOnA&e=" rel="noreferrer" target="_blank" id="LPlnk770419" class="OWAAutoLink" previewremoved="true">
https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.org_cmake_help_support.html&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=vUHQvc_7Ovi_5BDjy3JYFOIvTmihTSFOQNndNSpMOnA&e=</a>
<br>
CMake Consulting: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.org_cmake_help_consulting.html&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=91AJA3BxTfHAvsi0mAzkszAyUUmE2xfwbLgN_fYvFO4&e=" rel="noreferrer" target="_blank" id="LPlnk363810" class="OWAAutoLink" previewremoved="true">
https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.org_cmake_help_consulting.html&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=91AJA3BxTfHAvsi0mAzkszAyUUmE2xfwbLgN_fYvFO4&e=</a>
<br>
CMake Training Courses: <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.org_cmake_help_training.html&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=isQW6paMIqhUFaejOZ4qfUiSVwNiR1yxoQn4J91yb8o&e=" rel="noreferrer" target="_blank" id="LPlnk335132" class="OWAAutoLink" previewremoved="true">
https://urldefense.proofpoint.com/v2/url?u=http-3A__cmake.org_cmake_help_training.html&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=isQW6paMIqhUFaejOZ4qfUiSVwNiR1yxoQn4J91yb8o&e=</a>
<br>
<br>
Visit other Kitware open-source projects at <a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=ose8YVW10s6tWkujUCq162vyyipCdlw-MW93qUlqdGk&e=" rel="noreferrer" target="_blank" id="LPlnk318229" class="OWAAutoLink" previewremoved="true">
https://urldefense.proofpoint.com/v2/url?u=http-3A__www.kitware.com_opensource_opensource.html&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=ose8YVW10s6tWkujUCq162vyyipCdlw-MW93qUlqdGk&e=</a>
<br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="https://urldefense.proofpoint.com/v2/url?u=https-3A__cmake.org_mailman_listinfo_cmake&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=KftR51q4EGgNERicS2QyHvzlrNaqb11IUwwbz1YTjVU&e=" rel="noreferrer" target="_blank" id="LPlnk257744" class="OWAAutoLink" previewremoved="true">https://urldefense.proofpoint.com/v2/url?u=https-3A__cmake.org_mailman_listinfo_cmake&d=DwICAg&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=8hmSv9ww5s9qu3iT8h5WMi8-YcKXaJvelxT3fMih7S4&m=1H4kXxGuNG-DAo1qM-u8bdF6AKKHkJoiCuqwZ4QLvtY&s=KftR51q4EGgNERicS2QyHvzlrNaqb11IUwwbz1YTjVU&e=</a>
<br>
</blockquote>
</div>
<br clear="all">
<div><br>
</div>
-- <br>
<div dir="ltr" class="x_gmail_signature">
<div dir="ltr">
<div style="font-size:small; font-family:arial">Sebastian Mancilla Matta</div>
<div style="font-size:small; font-family:arial">CCTVal, UTFSM</div>
<div style="font-size:small; font-family:arial">Valparaíso, Chile</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>