From 00e4fff760ea4a0bdf3beb566b6ece9f6d8475df Mon Sep 17 00:00:00 2001 From: Sebastiaan van der Tol <tol@astron.nl> Date: Tue, 30 Jun 2020 22:24:42 +0200 Subject: [PATCH] Add target_include_directories for oskar target at build time Tests and demos in other directories of the project linking to oskar now have the oskar subdirectory added to their include directories. --- cpp/oskar/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cpp/oskar/CMakeLists.txt b/cpp/oskar/CMakeLists.txt index 4a166f99..3bfc5678 100644 --- a/cpp/oskar/CMakeLists.txt +++ b/cpp/oskar/CMakeLists.txt @@ -14,6 +14,12 @@ add_library(oskar SHARED string(TOLOWER ${CMAKE_PROJECT_NAME} projectname ) set_target_properties(oskar PROPERTIES LIBRARY_OUTPUT_NAME "${projectname}-oskar") +# Make sure that when other targets within this project link against the oskar target, +# they can find the include files. +target_include_directories(oskar PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}> +) + #------------------------------------------------------------------------------ # Link against HDF5 and OpenMP target_link_libraries(oskar ${HDF5_LIBRARIES} ${HDF5_CXX_LIBRARIES} ${OpenMP_CXX_FLAGS}) -- GitLab