summaryrefslogtreecommitdiff
path: root/Source/CMakeLists.txt
diff options
context:
space:
mode:
authorAlex Turbov <i.zaufi@gmail.com>2022-08-21 05:49:38 +0400
committerBrad King <brad.king@kitware.com>2022-09-22 09:24:47 -0400
commitd5336ed71439ef09cfc8b0b519aafee6c9076466 (patch)
tree95d6e78cd0d4710914bea9409aea62abd5b7bf5f /Source/CMakeLists.txt
parentd6b708482ff88ff5a15f28b2c0e17ccf09c812b0 (diff)
downloadcmake-d5336ed71439ef09cfc8b0b519aafee6c9076466.tar.gz
Build: `include_directories()` → `target_include_directories()`
Diffstat (limited to 'Source/CMakeLists.txt')
-rw-r--r--Source/CMakeLists.txt58
1 files changed, 24 insertions, 34 deletions
diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt
index 579855f22c..821f618296 100644
--- a/Source/CMakeLists.txt
+++ b/Source/CMakeLists.txt
@@ -58,17 +58,6 @@ configure_file(
@ONLY
)
-# add the include path to find the .h
-include_directories(
- "${CMake_BINARY_DIR}/Source"
- "${CMake_SOURCE_DIR}/Source"
- "${CMake_SOURCE_DIR}/Source/LexerParser"
- ${CMAKE_ZLIB_INCLUDES}
- ${CMAKE_EXPAT_INCLUDES}
- ${CMAKE_TAR_INCLUDES}
- ${CMake_HAIKU_INCLUDE_DIRS}
- )
-
#
# create a library used by the command line and the GUI
add_library(
@@ -736,7 +725,18 @@ add_library(
bindexplib.cxx
)
-
+target_include_directories(
+ CMakeLib
+ PUBLIC
+ # add the include path to find the .h
+ "${CMake_BINARY_DIR}/Source"
+ "${CMake_SOURCE_DIR}/Source"
+ "${CMake_SOURCE_DIR}/Source/LexerParser"
+ ${CMAKE_ZLIB_INCLUDES}
+ ${CMAKE_EXPAT_INCLUDES}
+ ${CMAKE_TAR_INCLUDES}
+ ${CMake_HAIKU_INCLUDE_DIRS}
+ )
target_link_libraries(
CMakeLib
PUBLIC
@@ -938,14 +938,6 @@ endif()
target_compile_definitions(CMakeLib PUBLIC ${CLANG_TIDY_DEFINITIONS})
#
-# CTestLib
-#
-include_directories(
- "${CMake_SOURCE_DIR}/Source/CTest"
- ${CMAKE_CURL_INCLUDES}
- )
-
-#
# Build CTestLib
#
add_library(
@@ -1017,16 +1009,17 @@ add_library(
LexerParser/cmCTestResourceGroupsLexer.h
LexerParser/cmCTestResourceGroupsLexer.in.l
)
+target_include_directories(
+ CTestLib
+ PUBLIC
+ "${CMake_SOURCE_DIR}/Source/CTest"
+ ${CMAKE_CURL_INCLUDES}
+ )
target_link_libraries(CTestLib CMakeLib ${CMAKE_CURL_LIBRARIES})
#
-# CPack
-#
-include_directories(
- "${CMake_SOURCE_DIR}/Source/CPack"
- )
-
# Build CPackLib
+#
add_library(
CPackLib
CPack/cmCPackArchiveGenerator.cxx
@@ -1051,6 +1044,7 @@ add_library(
CPack/IFW/cmCPackIFWRepository.cxx
CPack/IFW/cmCPackIFWRepository.h
)
+target_include_directories(CPackLib PUBLIC "${CMake_SOURCE_DIR}/Source/CPack")
target_link_libraries(CPackLib CMakeLib)
if(CYGWIN)
@@ -1084,11 +1078,7 @@ if(UNIX)
pkg
DOC "FreeBSD pkg(8) library")
if(FREEBSD_PKG_LIBRARIES)
- target_sources(
- CPackLib
- PUBLIC
- CPack/cmCPackFreeBSDGenerator.cxx
- )
+ target_sources(CPackLib PUBLIC CPack/cmCPackFreeBSDGenerator.cxx)
endif()
endif()
@@ -1161,14 +1151,14 @@ if(APPLE)
endif()
endif()
if(CYGWIN AND LibUUID_FOUND)
+ target_include_directories(CPackLib PUBLIC ${LibUUID_INCLUDE_DIRS})
target_link_libraries(CPackLib ${LibUUID_LIBRARIES})
- include_directories(CPackLib ${LibUUID_INCLUDE_DIRS})
set_property(SOURCE CPack/cmCPackGeneratorFactory.cxx PROPERTY COMPILE_DEFINITIONS HAVE_LIBUUID)
endif()
if(CPACK_ENABLE_FREEBSD_PKG AND FREEBSD_PKG_INCLUDE_DIRS AND FREEBSD_PKG_LIBRARIES)
+ target_include_directories(CPackLib PUBLIC ${FREEBSD_PKG_INCLUDE_DIRS})
target_link_libraries(CPackLib ${FREEBSD_PKG_LIBRARIES})
- include_directories(${FREEBSD_PKG_INCLUDE_DIRS})
- add_definitions(-DHAVE_FREEBSD_PKG)
+ target_compile_definitions(CPackLib PUBLIC HAVE_FREEBSD_PKG)
endif()
# Build CMake executable