From 2677b3a22636ee8ab3b893dd8388a0472697282d Mon Sep 17 00:00:00 2001 From: James Turner Date: Sat, 23 Jan 2016 15:55:11 -0600 Subject: [PATCH] Use target_include_directories in some places. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit I didn’t know about this feature when doing the original CMake files, we can use this to target header-file includes more precisely. (Probably more cases exist that can be changed from global to target- specific includes) --- src/FDM/JSBSim/CMakeLists.txt | 5 +++-- src/GUI/CMakeLists.txt | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/FDM/JSBSim/CMakeLists.txt b/src/FDM/JSBSim/CMakeLists.txt index 9f6080f12..573ff819f 100644 --- a/src/FDM/JSBSim/CMakeLists.txt +++ b/src/FDM/JSBSim/CMakeLists.txt @@ -192,7 +192,8 @@ set(SOURCES models/propulsion/FGTurbine.cpp models/propulsion/FGTurboProp.cpp ) - -include_directories(${PROJECT_SOURCE_DIR}/src/FDM/JSBSim) + add_library(JSBSim STATIC ${SOURCES} ${HEADERS}) + +target_include_directories(JSBSim PRIVATE ${PROJECT_SOURCE_DIR}/src/FDM/JSBSim) diff --git a/src/GUI/CMakeLists.txt b/src/GUI/CMakeLists.txt index 26516756a..ae48f32e0 100644 --- a/src/GUI/CMakeLists.txt +++ b/src/GUI/CMakeLists.txt @@ -78,7 +78,6 @@ if (HAVE_QT) LocationWidget.ui) qt5_add_resources(qrc_sources resources.qrc) - include_directories(${PROJECT_BINARY_DIR}/src/GUI) add_library(fglauncher QtLauncher.cxx QtLauncher.hxx @@ -112,6 +111,7 @@ if (HAVE_QT) set_property(TARGET fglauncher PROPERTY AUTOMOC ON) target_link_libraries(fglauncher Qt5::Core Qt5::Widgets ) + target_include_directories(fglauncher PRIVATE ${PROJECT_BINARY_DIR}/src/GUI) endif() -- 2.39.5