From ba08b0ec0266f505bfe06e49e993091157e19c93 Mon Sep 17 00:00:00 2001 From: Bastien Brunnenstein Date: Thu, 30 Nov 2017 17:45:58 +0100 Subject: [PATCH] Add include directory to CMake install targets (#4510) --- CMakeLists.txt | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 5599fda27..c3974b3d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -260,10 +260,18 @@ if(FLATBUFFERS_INSTALL) ) if(FLATBUFFERS_BUILD_FLATLIB) - install( - TARGETS flatbuffers EXPORT FlatbuffersTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) + if(CMAKE_VERSION VERSION_LESS 3.0) + install( + TARGETS flatbuffers EXPORT FlatbuffersTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + else() + install( + TARGETS flatbuffers EXPORT FlatbuffersTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) + endif() install(EXPORT FlatbuffersTargets FILE FlatbuffersTargets.cmake @@ -289,12 +297,22 @@ if(FLATBUFFERS_INSTALL) endif() if(FLATBUFFERS_BUILD_SHAREDLIB) - install( - TARGETS flatbuffers_shared EXPORT FlatbuffersSharedTargets - ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} - LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) + if(CMAKE_VERSION VERSION_LESS 3.0) + install( + TARGETS flatbuffers_shared EXPORT FlatbuffersSharedTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ) + else() + install( + TARGETS flatbuffers_shared EXPORT FlatbuffersSharedTargets + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + RUNTIME DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR} + ) + endif() install( EXPORT FlatbuffersSharedTargets