Skip to content

Commit 19c9bbb

Browse files
committed
refactor: use target-specific include dirs
1 parent 6c1e33c commit 19c9bbb

File tree

3 files changed

+20
-3
lines changed

3 files changed

+20
-3
lines changed

CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,9 +47,6 @@ include(cmake/gtest.cmake)
4747
############################## Headers ##############################
4848

4949
message( STATUS "PPC step: Setup headers" )
50-
include_directories(3rdparty)
51-
include_directories(modules)
52-
include_directories(tasks)
5350

5451
############################## Modules ##############################
5552

cmake/functions.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22
function(ppc_add_test test_name test_src USE_FLAG)
33
if(${USE_FLAG})
44
add_executable(${test_name} "${PROJECT_SOURCE_DIR}/${test_src}")
5+
target_include_directories(${test_name}
6+
PUBLIC
7+
${CMAKE_SOURCE_DIR}/modules
8+
${CMAKE_SOURCE_DIR}/tasks
9+
${CMAKE_SOURCE_DIR}/3rdparty
10+
)
511
enable_testing()
612
add_test(NAME ${test_name} COMMAND ${test_name})
713
install(TARGETS ${test_name} RUNTIME DESTINATION bin)
@@ -62,6 +68,11 @@ function(setup_implementation)
6268
else()
6369
add_library(${LIB_NAME} INTERFACE ${ALL_SOURCES})
6470
endif()
71+
target_include_directories(${LIB_NAME}
72+
PUBLIC
73+
${CMAKE_SOURCE_DIR}/modules
74+
${CMAKE_SOURCE_DIR}/tasks
75+
)
6576

6677
# link core module
6778
target_link_libraries(${LIB_NAME} PUBLIC core_module_lib)

modules/core/CMakeLists.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,10 @@ endforeach()
2222
project(${exec_func_lib})
2323
add_library(${exec_func_lib} STATIC ${LIB_SOURCE_FILES})
2424
set_target_properties(${exec_func_lib} PROPERTIES LINKER_LANGUAGE CXX)
25+
target_include_directories(${exec_func_lib}
26+
PUBLIC
27+
${CMAKE_SOURCE_DIR}/modules
28+
)
2529

2630
add_dependencies(${exec_func_lib} ppc_libenvpp)
2731
target_link_directories(${exec_func_lib} PUBLIC "${CMAKE_BINARY_DIR}/ppc_libenvpp/install/lib")
@@ -63,6 +67,11 @@ target_include_directories(stb_image PUBLIC ${CMAKE_SOURCE_DIR}/3rdparty/stb)
6367
target_link_libraries(${exec_func_lib} PUBLIC stb_image)
6468

6569
add_executable(${exec_func_tests} ${FUNC_TESTS_SOURCE_FILES})
70+
target_include_directories(${exec_func_tests}
71+
PUBLIC
72+
${CMAKE_SOURCE_DIR}/modules
73+
${CMAKE_SOURCE_DIR}/3rdparty
74+
)
6675

6776
target_link_libraries(${exec_func_tests} PUBLIC ${exec_func_lib})
6877

0 commit comments

Comments
 (0)