Add private dependency include directories to test targets.

Change-Id: Ic8ea67f8b6327700e723346b22f64750864b8d6f
This commit is contained in:
Alex Stewart
2018-07-05 13:35:42 +01:00
parent e86f5a4d46
commit fba8ee2d62
+10 -4
View File
@@ -373,9 +373,13 @@ if (BUILD_TESTING AND GFLAGS)
add_executable(${NAME}_test ${NAME}_test.cc) add_executable(${NAME}_test ${NAME}_test.cc)
# Pull in local headers from the generated test directories when ceres_test() # Pull in local headers from the generated test directories when ceres_test()
# is invoked there, as well as the private headers in this directory which # is invoked there, as well as the private headers in this directory which
# may be referenced without the 'ceres' path prefix. # may be referenced without the 'ceres' path prefix and all private
target_include_directories(${NAME}_test PUBLIC ${CMAKE_CURRENT_LIST_DIR}) # dependencies that may be directly referenced.
target_include_directories(${NAME}_test PUBLIC ${Ceres_SOURCE_DIR}/internal/ceres) target_include_directories(${NAME}_test
PUBLIC ${CMAKE_CURRENT_LIST_DIR}
${Ceres_SOURCE_DIR}/internal/ceres
${CERES_LIBRARY_PRIVATE_DEPENDENCIES_INCLUDE_DIRS})
target_link_libraries(${NAME}_test test_util ceres gtest) target_link_libraries(${NAME}_test test_util ceres gtest)
if (BUILD_SHARED_LIBS) if (BUILD_SHARED_LIBS)
# Define gtest-specific shared library flags for linking. # Define gtest-specific shared library flags for linking.
@@ -479,7 +483,9 @@ endif (BUILD_TESTING AND GFLAGS)
macro(add_dependencies_to_benchmark BENCHMARK_TARGET) macro(add_dependencies_to_benchmark BENCHMARK_TARGET)
target_link_libraries(${BENCHMARK_TARGET} ceres benchmark::benchmark) target_link_libraries(${BENCHMARK_TARGET} ceres benchmark::benchmark)
target_include_directories(${BENCHMARK_TARGET} PUBLIC ${Ceres_SOURCE_DIR}/internal) target_include_directories(${BENCHMARK_TARGET} PUBLIC
${Ceres_SOURCE_DIR}/internal
${CERES_LIBRARY_PRIVATE_DEPENDENCIES_INCLUDE_DIRS})
endmacro() endmacro()
if (BUILD_BENCHMARKS) if (BUILD_BENCHMARKS)