Hi,

I just made kconfigwidgets build also standalone[1].

It didn't work immediately, since it didn't have the correct include dirs set. 
As I understand it, they should come from the KWidgetsAddons and KConfig 
libraries it links against, but those do not yet set them.

Attached is what I committed to set the include directory properties for those 
libraries.
Is this the correct way to do it or is there a better way ?

It would be nice if cmake would handle relative directories for the INSTALL 
interface automatically as relative to CMAKE_INSTALL_PREFIX.


Alex

[1] This is only *possible* at all by using variables like 
${KWidgetAddons_LIBRARIES}. And as I noticed, there is more work to do to make 
this stuff build also standalone than simply renaming the targets. It has to 
be checked whether the include dirs are correct, etc.[2]

[2] that's what I meant when I mentioned some time ago that it would be good 
to have an easy to way to test install Config.cmake files, i.e. check whether 
the properties are set correctly etc.
commit d601995877d7f2444cef1912f81c077b6813ab39
Author: Alex Neundorf <neund...@kde.org>
Date:   Wed Jul 17 23:15:00 2013 +0200

    -set include directory target properties, so that include dirs are properly propagated
    
    This has the effect that when any target links again kwidgetsaddons or kconfig using
    target_link_libraries(), it automatically gets the correct include dirs from them.
    
    Alex

diff --git a/tier1/kconfig/src/core/CMakeLists.txt b/tier1/kconfig/src/core/CMakeLists.txt
index f7073bf..398a1d7 100644
--- a/tier1/kconfig/src/core/CMakeLists.txt
+++ b/tier1/kconfig/src/core/CMakeLists.txt
@@ -22,6 +22,12 @@ if(WIN32)
     target_link_libraries(KConfigCore ${KDEWIN_LIBRARIES})
 endif()
 
+if(IS_ABSOLUTE "${INCLUDE_INSTALL_DIR}")
+  target_include_directories(KConfigCore INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>" )
+else()
+  target_include_directories(KConfigCore INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}>" )
+endif()
+
 set_target_properties(KConfigCore PROPERTIES VERSION   ${KCONFIG_VERSION_STRING}
                                              SOVERSION ${KCONFIG_SOVERSION} )
 
diff --git a/tier1/kconfig/src/gui/CMakeLists.txt b/tier1/kconfig/src/gui/CMakeLists.txt
index 44a7d28..0913349 100644
--- a/tier1/kconfig/src/gui/CMakeLists.txt
+++ b/tier1/kconfig/src/gui/CMakeLists.txt
@@ -12,6 +12,13 @@ add_library(KConfigGui ${libkconfiggui_SRCS})
 generate_export_header(KConfigGui)
 
 target_link_libraries(KConfigGui Qt5::Widgets KConfigCore)
+
+if(IS_ABSOLUTE "${INCLUDE_INSTALL_DIR}")
+  target_include_directories(KConfigGui INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>" )
+else()
+  target_include_directories(KConfigGui INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}>" )
+endif()
+
 set_target_properties(KConfigGui PROPERTIES VERSION   ${KCONFIG_VERSION_STRING}
                                             SOVERSION ${KCONFIG_SOVERSION}
 )
diff --git a/tier1/kwidgetsaddons/src/CMakeLists.txt b/tier1/kwidgetsaddons/src/CMakeLists.txt
index 55148c9..01c2308 100644
--- a/tier1/kwidgetsaddons/src/CMakeLists.txt
+++ b/tier1/kwidgetsaddons/src/CMakeLists.txt
@@ -53,6 +53,12 @@ generate_export_header(KWidgetsAddons)
 
 target_link_libraries(KWidgetsAddons Qt5::Widgets)
 
+if(IS_ABSOLUTE "${INCLUDE_INSTALL_DIR}")
+  target_include_directories(KWidgetsAddons INTERFACE "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}>" )
+else()
+  target_include_directories(KWidgetsAddons INTERFACE "$<INSTALL_INTERFACE:${CMAKE_INSTALL_PREFIX}/${INCLUDE_INSTALL_DIR}>" )
+endif()
+
 set_target_properties(KWidgetsAddons PROPERTIES VERSION   ${KWIDGETSADDONS_VERSION_STRING}
                                                 SOVERSION ${KWIDGETSADDONS_SOVERSION}
 )
_______________________________________________
Kde-frameworks-devel mailing list
Kde-frameworks-devel@kde.org
https://mail.kde.org/mailman/listinfo/kde-frameworks-devel

Reply via email to