Browse Source

CMake: Populate list of required include directories for library targets

PUBLIC items will populate the INTERFACE_INCLUDE_DIRECTORIES property of
<target>. This property is a list of public include directories
requirements for a library.

Targets may populate this property to publish the include directories
required to compile against the headers for the target.
master
Riyyi 2 years ago
parent
commit
9000d1d968
  1. 10
      CMakeLists.txt

10
CMakeLists.txt

@ -61,7 +61,7 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
file(GLOB_RECURSE LIBRARY_SOURCES "src/*.cpp") file(GLOB_RECURSE LIBRARY_SOURCES "src/*.cpp")
add_library(${PROJECT} ${LIBRARY_SOURCES}) add_library(${PROJECT} ${LIBRARY_SOURCES})
target_include_directories(${PROJECT} PRIVATE target_include_directories(${PROJECT} PUBLIC
"src") "src")
# ------------------------------------------ # ------------------------------------------
@ -71,7 +71,7 @@ target_include_directories(${PROJECT} PRIVATE
file(GLOB TEST_LIBRARY_SOURCES "test/*.cpp" "src/ruc/timer.cpp") file(GLOB TEST_LIBRARY_SOURCES "test/*.cpp" "src/ruc/timer.cpp")
add_library(${PROJECT}-test ${TEST_LIBRARY_SOURCES}) add_library(${PROJECT}-test ${TEST_LIBRARY_SOURCES})
target_include_directories(${PROJECT}-test PRIVATE target_include_directories(${PROJECT}-test PUBLIC
"src" "src"
"test") "test")
@ -83,9 +83,5 @@ if (RUC_BUILD_TESTS)
file(GLOB_RECURSE TEST_SOURCES "test/unit/*.cpp") file(GLOB_RECURSE TEST_SOURCES "test/unit/*.cpp")
add_executable(${PROJECT}-unit-test ${TEST_SOURCES}) add_executable(${PROJECT}-unit-test ${TEST_SOURCES})
target_include_directories(${PROJECT}-unit-test PRIVATE target_link_libraries(${PROJECT}-unit-test ruc ruc-test)
"src"
"test")
target_link_libraries(${PROJECT}-unit-test ruc)
target_link_libraries(${PROJECT}-unit-test ruc-test)
endif() endif()

Loading…
Cancel
Save