]> source.dussan.org Git - tigervnc.git/commitdiff
Prefer target_include_directories()
authorPierre Ossman <ossman@cendio.se>
Thu, 30 Mar 2023 19:00:12 +0000 (21:00 +0200)
committerPierre Ossman <ossman@cendio.se>
Fri, 31 Mar 2023 09:03:10 +0000 (11:03 +0200)
It is more specific, and it properly sets up propagation when include
directories also need to be used further down a dependency chain.

15 files changed:
common/network/CMakeLists.txt
common/os/CMakeLists.txt
common/rdr/CMakeLists.txt
common/rfb/CMakeLists.txt
tests/perf/CMakeLists.txt
tests/unit/CMakeLists.txt
unix/common/CMakeLists.txt
unix/tx/CMakeLists.txt
unix/vncconfig/CMakeLists.txt
unix/vncpasswd/CMakeLists.txt
unix/x0vncserver/CMakeLists.txt
vncviewer/CMakeLists.txt
win/vncconfig/CMakeLists.txt
win/winvnc/CMakeLists.txt
win/wm_hooks/CMakeLists.txt

index b4cfb3c406008d6c435ddb3db9d1a8457d59e1df..f08eaa3149e73527c40c47604111c6a383646fbc 100644 (file)
@@ -1,5 +1,3 @@
-include_directories(${CMAKE_SOURCE_DIR}/common)
-
 add_library(network STATIC
   Socket.cxx
   TcpSocket.cxx)
@@ -8,6 +6,7 @@ if(NOT WIN32)
   target_sources(network PRIVATE UnixSocket.cxx)
 endif()
 
+target_include_directories(network PUBLIC ${CMAKE_SOURCE_DIR}/common)
 target_link_libraries(network os rdr rfb)
 
 if(WIN32)
index deaf2f968bc741aa3e1ea5eea8fa7d1b64a3919f..2573d088015c95bab849344cbeae7991f5625719 100644 (file)
@@ -1,10 +1,9 @@
-include_directories(${CMAKE_SOURCE_DIR}/common)
-
 add_library(os STATIC
   Mutex.cxx
   Thread.cxx
   os.cxx)
 
+target_include_directories(os PUBLIC ${CMAKE_SOURCE_DIR}/common)
 target_link_libraries(os rdr)
 
 if(UNIX)
index 05d8c1957898f9a12ff2dd5f69cfa86debaa6e05..30c2403a90c60cada127a2a255b6dd73948cf0c6 100644 (file)
@@ -1,6 +1,3 @@
-include_directories(${CMAKE_SOURCE_DIR}/common)
-include_directories(SYSTEM ${ZLIB_INCLUDE_DIRS})
-
 add_library(rdr STATIC
   AESInStream.cxx
   AESOutStream.cxx
@@ -19,14 +16,16 @@ add_library(rdr STATIC
   ZlibInStream.cxx
   ZlibOutStream.cxx)
 
+target_include_directories(rdr PUBLIC ${CMAKE_SOURCE_DIR}/common)
+target_include_directories(rdr SYSTEM PUBLIC ${ZLIB_INCLUDE_DIRS})
 target_link_libraries(rdr ${ZLIB_LIBRARIES} os rfb)
 
 if(GNUTLS_FOUND)
-  include_directories(SYSTEM ${GNUTLS_INCLUDE_DIR})
+  target_include_directories(rdr SYSTEM PUBLIC ${GNUTLS_INCLUDE_DIR})
   target_link_libraries(rdr ${GNUTLS_LIBRARIES})
 endif()
 if (NETTLE_FOUND)
-  include_directories(SYSTEM ${NETTLE_INCLUDE_DIRS})
+  target_include_directories(rdr SYSTEM PUBLIC ${NETTLE_INCLUDE_DIRS})
   target_link_libraries(rdr ${NETTLE_LIBRARIES})
   target_link_directories(rdr PUBLIC ${NETTLE_LIBRARY_DIRS})
 endif()
index f8fbf45a2b5c3eb027ce9f8872b3af90514f9519..25c777a0c9e222bac4ca262ba38f376deedc90e3 100644 (file)
@@ -1,7 +1,3 @@
-include_directories(${CMAKE_SOURCE_DIR}/common)
-include_directories(SYSTEM ${JPEG_INCLUDE_DIR})
-include_directories(SYSTEM ${PIXMAN_INCLUDE_DIRS})
-
 add_library(rfb STATIC
   Blacklist.cxx
   Congestion.cxx
@@ -66,6 +62,9 @@ add_library(rfb STATIC
   obfuscate.cxx
   util.cxx)
 
+target_include_directories(rfb PUBLIC ${CMAKE_SOURCE_DIR}/common)
+target_include_directories(rfb SYSTEM PUBLIC ${JPEG_INCLUDE_DIR})
+target_include_directories(rfb SYSTEM PUBLIC ${PIXMAN_INCLUDE_DIRS})
 target_link_libraries(rfb os rdr network)
 target_link_libraries(rfb ${JPEG_LIBRARIES} ${PIXMAN_LIBRARIES})
 target_link_directories(rfb PUBLIC ${PIXMAN_LIBRARY_DIRS})
@@ -77,7 +76,7 @@ if(ENABLE_H264 AND NOT H264_LIBS STREQUAL "NONE")
   elseif(H264_LIBS STREQUAL "WIN")
     target_sources(rfb PRIVATE H264WinDecoderContext.cxx)
   endif()
-  include_directories(SYSTEM ${H264_INCLUDE_DIRS})
+  target_include_directories(rfb SYSTEM PUBLIC ${H264_INCLUDE_DIRS})
   target_link_libraries(rfb ${H264_LIBRARIES})
   target_link_directories(rfb PUBLIC ${H264_LIBRARY_DIRS})
 endif()
@@ -87,7 +86,7 @@ if(UNIX)
 endif()
 
 if(WIN32)
-  include_directories(${CMAKE_SOURCE_DIR}/win)
+  target_include_directories(rfb PUBLIC ${CMAKE_SOURCE_DIR}/win)
   target_sources(rfb PRIVATE WinPasswdValidator.cxx)
 endif(WIN32)
 
@@ -98,14 +97,15 @@ endif()
 
 if(GNUTLS_FOUND)
   target_sources(rfb PRIVATE CSecurityTLS.cxx SSecurityTLS.cxx)
-  include_directories(SYSTEM ${GNUTLS_INCLUDE_DIR})
+  target_include_directories(rfb SYSTEM PUBLIC ${GNUTLS_INCLUDE_DIR})
   target_link_libraries(rfb ${GNUTLS_LIBRARIES})
 endif()
 
 if (NETTLE_FOUND)
   target_sources(rfb PRIVATE CSecurityDH.cxx CSecurityMSLogonII.cxx
                  CSecurityRSAAES.cxx SSecurityRSAAES.cxx)
-  include_directories(SYSTEM ${NETTLE_INCLUDE_DIRS} ${GMP_INCLUDE_DIRS})
+  target_include_directories(rfb SYSTEM PUBLIC ${NETTLE_INCLUDE_DIRS}
+                             ${GMP_INCLUDE_DIRS})
   target_link_libraries(rfb ${HOGWEED_LIBRARIES}
                         ${NETTLE_LIBRARIES} ${GMP_LIBRARIES})
   target_link_directories(rfb PUBLIC ${HOGWEED_LIBRARY_DIRS}
index 562adfc0a9a538cf08ac3409ceb954404f10d994..13061b9b7c1efffd932302aa99269c0bbdb4c255 100644 (file)
@@ -1,5 +1,4 @@
 include_directories(${CMAKE_SOURCE_DIR}/common)
-include_directories(SYSTEM ${GETTEXT_INCLUDE_DIR})
 
 add_library(test_util STATIC util.cxx)
 
@@ -13,7 +12,6 @@ add_executable(encperf encperf.cxx)
 target_link_libraries(encperf test_util rfb)
 
 if (BUILD_VIEWER)
-  include_directories(SYSTEM ${FLTK_INCLUDE_DIR})
   add_executable(fbperf
     fbperf.cxx
     ${CMAKE_SOURCE_DIR}/vncviewer/PlatformPixelBuffer.cxx
@@ -28,6 +26,8 @@ if (BUILD_VIEWER)
   else()
     target_sources(fbperf PRIVATE ${CMAKE_SOURCE_DIR}/vncviewer/Surface_X11.cxx)
   endif()
+  target_include_directories(fbperf SYSTEM PUBLIC ${FLTK_INCLUDE_DIR})
+  target_include_directories(fbperf SYSTEM PUBLIC ${GETTEXT_INCLUDE_DIR})
   target_link_libraries(fbperf test_util rfb ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES})
   if(WIN32)
     target_link_libraries(fbperf msimg32)
index 00f38b76b1aea305b8f2fc36a005ea58dc0242e1..8e2230528506a1f868bc741104deabbc3ecf3450 100644 (file)
@@ -1,6 +1,5 @@
 include_directories(${CMAKE_SOURCE_DIR}/common)
 include_directories(${CMAKE_SOURCE_DIR}/vncviewer)
-include_directories(SYSTEM ${GETTEXT_INCLUDE_DIR})
 
 add_executable(conv conv.cxx)
 target_link_libraries(conv rfb)
@@ -21,4 +20,5 @@ add_executable(unicode unicode.cxx)
 target_link_libraries(unicode rfb)
 
 add_executable(emulatemb emulatemb.cxx ../../vncviewer/EmulateMB.cxx)
+target_include_directories(emulatemb SYSTEM PUBLIC ${GETTEXT_INCLUDE_DIR})
 target_link_libraries(emulatemb rfb  ${GETTEXT_LIBRARIES})
index 611e19563aa7f2d83eb7a540aeb618c5afdb3312..87e2ae7985ee85cb398b8499423732f51a08a956 100644 (file)
@@ -1,9 +1,9 @@
-include_directories(${CMAKE_SOURCE_DIR}/common)
-include_directories(${CMAKE_SOURCE_DIR}/unix/common)
-
 add_library(unixcommon STATIC
   randr.cxx)
 
+target_include_directories(unixcommon PUBLIC ${CMAKE_SOURCE_DIR}/common)
+target_include_directories(unixcommon PUBLIC ${CMAKE_SOURCE_DIR}/unix/common)
+
 if(UNIX)
   libtool_create_control_file(unixcommon)
 endif()
index e913de3c3e13dfbdbd57c79e2bd42cc2ab7a111c..e28621a605f241d74e80ebf6fbba482066c82a7a 100644 (file)
@@ -1,9 +1,9 @@
-include_directories(SYSTEM ${X11_INCLUDE_DIR})
-
-include_directories(${CMAKE_SOURCE_DIR}/common)
-include_directories(${CMAKE_SOURCE_DIR}/common/rfb)
-
 add_library(tx STATIC
   TXWindow.cxx)
 
+target_include_directories(tx SYSTEM PUBLIC ${X11_INCLUDE_DIR})
+
+target_include_directories(tx PUBLIC ${CMAKE_SOURCE_DIR}/common)
+target_include_directories(tx PUBLIC ${CMAKE_SOURCE_DIR}/common/rfb)
+
 target_link_libraries(tx ${X11_LIBRARIES})
index 8734ff63c8c1add9711bb4188531100f34dfc3ac..0589f161c32ee00aaf61c080aa5862c16bc2ba38 100644 (file)
@@ -1,14 +1,14 @@
-include_directories(SYSTEM ${X11_INCLUDE_DIR})
-
-include_directories(${CMAKE_SOURCE_DIR}/common)
-include_directories(${CMAKE_SOURCE_DIR}/unix/tx)
-
 add_executable(vncconfig 
   buildtime.c
   vncExt.c
   vncconfig.cxx
   QueryConnectDialog.cxx)
 
+target_include_directories(vncconfig SYSTEM PUBLIC ${X11_INCLUDE_DIR})
+
+target_include_directories(vncconfig PUBLIC ${CMAKE_SOURCE_DIR}/common)
+target_include_directories(vncconfig PUBLIC ${CMAKE_SOURCE_DIR}/unix/tx)
+
 target_link_libraries(vncconfig tx rfb network rdr ${X11_LIBRARIES})
 
 install(TARGETS vncconfig DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
index 9f716facaf3bdf98197b0861ecb1995bda290ce2..9b672041d7f6ef9c3343b59233703e6285053f38 100644 (file)
@@ -1,8 +1,7 @@
-include_directories(${CMAKE_SOURCE_DIR}/common)
-
 add_executable(vncpasswd 
   vncpasswd.cxx)
 
+target_include_directories(vncpasswd PUBLIC ${CMAKE_SOURCE_DIR}/common)
 target_link_libraries(vncpasswd tx rfb os)
 
 install(TARGETS vncpasswd DESTINATION ${CMAKE_INSTALL_FULL_BINDIR})
index 488a78fd53b4907b7ae68fdb73a6edcabf44964b..31da51183ab5641f460584638fa37a3b15bc0c9c 100644 (file)
@@ -1,9 +1,3 @@
-include_directories(SYSTEM ${X11_INCLUDE_DIR})
-include_directories(${CMAKE_SOURCE_DIR}/unix/common)
-include_directories(${CMAKE_SOURCE_DIR}/unix/tx)
-include_directories(${CMAKE_SOURCE_DIR}/unix)
-include_directories(${CMAKE_SOURCE_DIR}/common)
-
 add_executable(x0vncserver
   buildtime.c
   Geometry.cxx
@@ -20,6 +14,11 @@ add_executable(x0vncserver
   ../vncconfig/QueryConnectDialog.cxx
 )
 
+target_include_directories(x0vncserver SYSTEM PUBLIC ${X11_INCLUDE_DIR})
+target_include_directories(x0vncserver PUBLIC ${CMAKE_SOURCE_DIR}/unix/common)
+target_include_directories(x0vncserver PUBLIC ${CMAKE_SOURCE_DIR}/unix/tx)
+target_include_directories(x0vncserver PUBLIC ${CMAKE_SOURCE_DIR}/unix)
+target_include_directories(x0vncserver PUBLIC ${CMAKE_SOURCE_DIR}/common)
 target_link_libraries(x0vncserver tx rfb network rdr unixcommon)
 
 if(X11_FOUND AND X11_XTest_LIB)
index 01b3a89c9f6a8aedb6c81fcc23181be3dbc7ffde..c8df6a251704324adbe344adab3be72a5047bae3 100644 (file)
@@ -1,8 +1,3 @@
-include_directories(SYSTEM ${FLTK_INCLUDE_DIR})
-include_directories(SYSTEM ${GETTEXT_INCLUDE_DIR})
-
-include_directories(${CMAKE_SOURCE_DIR}/common)
-
 add_executable(vncviewer
   fltk/Fl_Monitor_Arrangement.cxx
   fltk/Fl_Navigation.cxx
@@ -31,7 +26,7 @@ endif()
 if(WIN32)
   # Since vncviewer.rc is generated, local includes will be looking
   # in the wrong directory. We need to help it out.
-  include_directories(${CMAKE_CURRENT_SOURCE_DIR})
+  target_include_directories(vncviewer PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
   configure_file(vncviewer.rc.in vncviewer.rc)
   target_sources(vncviewer PRIVATE ${CMAKE_CURRENT_BINARY_DIR}/vncviewer.rc)
 endif()
@@ -52,6 +47,9 @@ else()
   target_sources(vncviewer PRIVATE Surface_X11.cxx)
 endif()
 
+target_include_directories(vncviewer SYSTEM PUBLIC ${FLTK_INCLUDE_DIR})
+target_include_directories(vncviewer SYSTEM PUBLIC ${GETTEXT_INCLUDE_DIR})
+target_include_directories(vncviewer PUBLIC ${CMAKE_SOURCE_DIR}/common)
 target_link_libraries(vncviewer rfb network rdr os ${FLTK_LIBRARIES} ${GETTEXT_LIBRARIES})
 
 if(WIN32)
index 6b620e5335b343f483c82f04dc0f8f7e3c3f9880..157ee4c5efe9013c641a845fe45f8ee89c18515e 100644 (file)
@@ -1,11 +1,10 @@
-include_directories(${CMAKE_BINARY_DIR}/win)
-
 add_executable(vncconfig WIN32
   Legacy.cxx
   PasswordDialog.cxx
   vncconfig.cxx
   vncconfig.rc)
 
+target_include_directories(vncconfig PUBLIC ${CMAKE_BINARY_DIR}/win)
 target_link_libraries(vncconfig rfb_win32 rfb network rdr ws2_32.lib)
 
 install(TARGETS vncconfig
index 034211c5ec5d798a8581452693b55ceb3a5a0569..e7e1a4de0ea9d459fb551f3354bc31fbda5dbeb6 100644 (file)
@@ -1,5 +1,3 @@
-include_directories(${CMAKE_BINARY_DIR}/win ${CMAKE_CURRENT_SOURCE_DIR})
-
 add_executable(winvnc4 WIN32
   buildTime.cxx
   ControlPanel.cxx
@@ -11,6 +9,8 @@ add_executable(winvnc4 WIN32
   winvnc.cxx
   winvnc.rc)
 
+target_include_directories(winvnc4 PUBLIC ${CMAKE_BINARY_DIR}/win)
+target_include_directories(winvnc4 PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
 target_link_libraries(winvnc4 rfb rfb_win32 network rdr ws2_32.lib)
 
 install(TARGETS winvnc4
index c8888ab747e7305cf25595a782103e49fcea2b4f..441d9bf9cb5b34368a065130a1b5f91f0a2e17a7 100644 (file)
@@ -1,5 +1,3 @@
-include_directories(${CMAKE_BINARY_DIR}/win ${CMAKE_CURRENT_SOURCE_DIR})
-
 add_library(wm_hooks SHARED
   ../wm_hooks/wm_hooks.cxx
   ../wm_hooks/wm_hooks.rc)
@@ -7,6 +5,9 @@ add_library(wm_hooks SHARED
 # We want the DLL to be named wm_hooks.dll rather than libwm_hooks.dll
 set_target_properties(wm_hooks PROPERTIES PREFIX "")
 
+target_include_directories(wm_hooks PUBLIC ${CMAKE_BINARY_DIR}/win)
+target_include_directories(wm_hooks PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
+
 install(TARGETS wm_hooks
   RUNTIME DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
 )