From d5336ed71439ef09cfc8b0b519aafee6c9076466 Mon Sep 17 00:00:00 2001 From: Alex Turbov Date: Sun, 21 Aug 2022 05:49:38 +0400 Subject: =?UTF-8?q?Build:=20`include=5Fdirectories()`=20=E2=86=92=20`targe?= =?UTF-8?q?t=5Finclude=5Fdirectories()`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Source/CMakeLists.txt | 58 +++++++++++++++++++++------------------------------ 1 file changed, 24 insertions(+), 34 deletions(-) diff --git a/Source/CMakeLists.txt b/Source/CMakeLists.txt index 579855f..821f618 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 -- cgit v0.12