From f154fa76d790ebf8e9d9335d899d500dc60411a2 Mon Sep 17 00:00:00 2001 From: tschw Date: Tue, 16 May 2017 20:47:53 +0200 Subject: [PATCH] Fix installed CMake targets when DLIB_ISO_CPP_ONLY (#595) (#597) --- dlib/CMakeLists.txt | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/dlib/CMakeLists.txt b/dlib/CMakeLists.txt index 44e9c559f..7c38e9565 100644 --- a/dlib/CMakeLists.txt +++ b/dlib/CMakeLists.txt @@ -673,11 +673,7 @@ if (NOT TARGET dlib) else() add_library(dlib STATIC ${source_files} ) endif() - target_include_directories(dlib - INTERFACE $ - INTERFACE $ - PUBLIC ${dlib_needed_includes} - ) + target_include_directories(dlib PUBLIC ${dlib_needed_includes}) target_link_libraries(dlib PRIVATE ${dlib_needed_libraries}) if (DLIB_IN_PROJECT_BUILD) target_compile_options(dlib PUBLIC ${active_preprocessor_switches}) @@ -692,17 +688,24 @@ if (NOT TARGET dlib) add_library(dlib_shared SHARED ${source_files} ) add_dependencies(dlib_shared dlib) endif() - target_include_directories(dlib_shared - INTERFACE $ - INTERFACE $ - PUBLIC ${dlib_needed_includes} - ) + target_include_directories(PUBLIC ${dlib_needed_includes}) target_link_libraries(dlib_shared PRIVATE ${dlib_needed_libraries}) target_compile_options(dlib_shared PRIVATE ${active_preprocessor_switches}) endif() endif () ##### end of if NOT DLIB_ISO_CPP_ONLY ########################################################## + # Add source or headers to include directory, for building or installation respectively + target_include_directories(dlib + INTERFACE $ + INTERFACE $ + ) + if (UNIX AND NOT DLIB_IN_PROJECT_BUILD) + target_include_directories(dlib_shared + INTERFACE $ + INTERFACE $ + ) + endif() # Allow the unit tests to ask us to compile the all/source.cpp file just to make sure it compiles. if (DLIB_TEST_COMPILE_ALL_SOURCE_CPP) ADD_LIBRARY(dlib_all_source_cpp STATIC all/source.cpp)