telepathy-qt: CMake: Get rid of global include_directories()

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jan 25 18:06:00 UTC 2020


Module: telepathy-qt
Branch: master
Commit: 379e06a91484f72bf37ff1fc5faa6d7a40bc0d28
URL:    http://cgit.freedesktop.org/telepathy/telepathy-qt/commit/?id=379e06a91484f72bf37ff1fc5faa6d7a40bc0d28

Author: Alexander Akulich <akulichalexander at gmail.com>
Date:   Wed Dec 11 22:02:28 2019 +0300

CMake: Get rid of global include_directories()

---

 CMakeLists.txt                |  3 ---
 TelepathyQt/CMakeLists.txt    | 14 +++++++++++++-
 tests/lib/glib/CMakeLists.txt |  1 +
 3 files changed, 14 insertions(+), 4 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 49ea8d39..ced71a7b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -104,9 +104,6 @@ endif ()
 # The doxygen macro requires Qt to have been looked up to enable crosslinking
 include(Doxygen)
 
-include_directories(${CMAKE_SOURCE_DIR}
-                    ${CMAKE_BINARY_DIR})
-
 add_definitions(-DQT_NO_CAST_FROM_ASCII)
 
 set(ENABLE_DEBUG_OUTPUT ON CACHE BOOL "If activated, compiles support for printing debug output to stderr")
diff --git a/TelepathyQt/CMakeLists.txt b/TelepathyQt/CMakeLists.txt
index d742d31e..d96d073f 100644
--- a/TelepathyQt/CMakeLists.txt
+++ b/TelepathyQt/CMakeLists.txt
@@ -755,6 +755,13 @@ target_compile_definitions(telepathy-qt${QT_VERSION_MAJOR} PRIVATE BUILDING_TP_Q
 
 # Library used by tests to test some unexported functionality
 add_library(telepathy-qt-test-backdoors STATIC ${telepathy_qt_test_backdoors_SRCS})
+target_include_directories(telepathy-qt-test-backdoors PUBLIC
+    $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}/>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..>
+)
+
 add_dependencies(telepathy-qt-test-backdoors stable-constants)
 add_dependencies(telepathy-qt-test-backdoors stable-typesgen)
 
@@ -783,7 +790,12 @@ target_link_libraries(telepathy-qt${QT_VERSION_MAJOR} PRIVATE
 target_link_libraries(telepathy-qt${QT_VERSION_MAJOR} PUBLIC
     ${TP_QT_LIBRARY_LINKER_FLAGS})
 
-target_include_directories(telepathy-qt${QT_VERSION_MAJOR} PUBLIC "$<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}/>")
+target_include_directories(telepathy-qt${QT_VERSION_MAJOR} PUBLIC
+    $<INSTALL_INTERFACE:${INCLUDE_INSTALL_DIR}/telepathy-qt${QT_VERSION_MAJOR}/>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/..>
+    $<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/..>
+)
 
 # Link - Library used by tests to test some unexported functionality
 target_link_libraries(telepathy-qt-test-backdoors PUBLIC
diff --git a/tests/lib/glib/CMakeLists.txt b/tests/lib/glib/CMakeLists.txt
index 73ff4000..96cb7b6a 100644
--- a/tests/lib/glib/CMakeLists.txt
+++ b/tests/lib/glib/CMakeLists.txt
@@ -1,5 +1,6 @@
 include_directories(
     ${CMAKE_CURRENT_BINARY_DIR}
+    ${CMAKE_BINARY_DIR}
     ${TELEPATHY_GLIB_INCLUDE_DIR}
     ${GLIB2_INCLUDE_DIR}
     ${GOBJECT_INCLUDE_DIR}



More information about the telepathy-commits mailing list