From f2bbb6b303d1fe96495f5862f22efb6a4cdd22b6 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Wed, 24 Aug 2022 13:35:20 +0200 Subject: [PATCH] Move include_directories() to proper places We should scope these as narrowely as possible to avoid side effects. --- CMakeLists.txt | 4 ---- common/rdr/CMakeLists.txt | 4 +++- common/rfb/CMakeLists.txt | 6 +++++- tests/perf/CMakeLists.txt | 3 +-- tests/unit/CMakeLists.txt | 3 ++- 5 files changed, 11 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index d88b177f..24336402 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -231,8 +231,6 @@ if(NOT FOUND_LIBJPEG_TURBO) message(STATUS "WARNING: You are not using libjpeg-turbo. Performance will suffer.") endif() -include_directories(${JPEG_INCLUDE_DIR}) - option(BUILD_JAVA "Build Java version of the TigerVNC Viewer" FALSE) if(BUILD_JAVA) add_subdirectory(java) @@ -273,9 +271,7 @@ option(ENABLE_GNUTLS "Enable protocol encryption and advanced authentication" ON if(ENABLE_GNUTLS) find_package(GnuTLS) if (GNUTLS_FOUND) - include_directories(${GNUTLS_INCLUDE_DIR}) add_definitions("-DHAVE_GNUTLS") - add_definitions(${GNUTLS_DEFINITIONS}) endif() endif() diff --git a/common/rdr/CMakeLists.txt b/common/rdr/CMakeLists.txt index 46b36cd5..08c93d8b 100644 --- a/common/rdr/CMakeLists.txt +++ b/common/rdr/CMakeLists.txt @@ -1,4 +1,5 @@ -include_directories(${CMAKE_SOURCE_DIR}/common ${ZLIB_INCLUDE_DIRS}) +include_directories(${CMAKE_SOURCE_DIR}/common) +include_directories(${ZLIB_INCLUDE_DIRS}) add_library(rdr STATIC BufferedInStream.cxx @@ -19,6 +20,7 @@ add_library(rdr STATIC target_link_libraries(rdr ${ZLIB_LIBRARIES} os) if(GNUTLS_FOUND) + include_directories(${GNUTLS_INCLUDE_DIR}) target_link_libraries(rdr ${GNUTLS_LIBRARIES}) endif() if(WIN32) diff --git a/common/rfb/CMakeLists.txt b/common/rfb/CMakeLists.txt index 994f1196..06966410 100644 --- a/common/rfb/CMakeLists.txt +++ b/common/rfb/CMakeLists.txt @@ -1,4 +1,6 @@ -include_directories(${CMAKE_SOURCE_DIR}/common ${JPEG_INCLUDE_DIR} ${PIXMAN_INCLUDE_DIRS} ${H264_INCLUDE_DIRS}) +include_directories(${CMAKE_SOURCE_DIR}/common) +include_directories(${JPEG_INCLUDE_DIR}) +include_directories(${PIXMAN_INCLUDE_DIRS}) add_library(rfb STATIC Blacklist.cxx @@ -75,6 +77,7 @@ if(ENABLE_H264 AND NOT H264_LIBS STREQUAL "NONE") elseif(H264_LIBS STREQUAL "WIN") target_sources(rfb PRIVATE H264WinDecoderContext.cxx) endif() + include_directories(${H264_INCLUDE_DIRS}) target_link_libraries(rfb ${H264_LIBRARIES}) target_link_directories(rfb PUBLIC ${H264_LIBRARY_DIRS}) endif() @@ -95,6 +98,7 @@ endif() if(GNUTLS_FOUND) target_sources(rfb PRIVATE CSecurityTLS.cxx SSecurityTLS.cxx) + include_directories(${GNUTLS_INCLUDE_DIR}) target_link_libraries(rfb ${GNUTLS_LIBRARIES}) endif() diff --git a/tests/perf/CMakeLists.txt b/tests/perf/CMakeLists.txt index 1b5e9f77..70ffe777 100644 --- a/tests/perf/CMakeLists.txt +++ b/tests/perf/CMakeLists.txt @@ -1,6 +1,5 @@ -include_directories(${GETTEXT_INCLUDE_DIR}) - include_directories(${CMAKE_SOURCE_DIR}/common) +include_directories(${GETTEXT_INCLUDE_DIR}) add_library(test_util STATIC util.cxx) diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index d2c132b5..6daecba5 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -1,5 +1,6 @@ include_directories(${CMAKE_SOURCE_DIR}/common) include_directories(${CMAKE_SOURCE_DIR}/vncviewer) +include_directories(${GETTEXT_INCLUDE_DIR}) add_executable(conv conv.cxx) target_link_libraries(conv rfb) @@ -20,4 +21,4 @@ add_executable(unicode unicode.cxx) target_link_libraries(unicode rfb) add_executable(emulatemb emulatemb.cxx ../../vncviewer/EmulateMB.cxx) -target_link_libraries(emulatemb rfb ${GETTEXT_LIBRARIES}) \ No newline at end of file +target_link_libraries(emulatemb rfb ${GETTEXT_LIBRARIES}) -- 2.39.5