From 0198711920206f7ff56bf0142a3732f55c185641 Mon Sep 17 00:00:00 2001 From: levlam Date: Fri, 24 Jan 2020 03:03:18 +0300 Subject: [PATCH] Allow to change CMAKE_INSTALL_BINDIR and CMAKE_INSTALL_INCLUDEDIR. GitOrigin-RevId: 5704095d127c7fcf2450133745ab2ac546a1177f --- CMakeLists.txt | 20 +++++++++++++------- sqlite/CMakeLists.txt | 6 ++++-- td/generate/CMakeLists.txt | 10 +++++++--- tdactor/CMakeLists.txt | 6 ++++-- tddb/CMakeLists.txt | 6 ++++-- tdnet/CMakeLists.txt | 6 ++++-- tdutils/CMakeLists.txt | 6 ++++-- 7 files changed, 40 insertions(+), 20 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b8a8f73f..58009ec1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,6 +5,12 @@ project(TDLib VERSION 1.5.5 LANGUAGES CXX C) if (NOT DEFINED CMAKE_INSTALL_LIBDIR) set(CMAKE_INSTALL_LIBDIR "lib") endif() +if (NOT DEFINED CMAKE_INSTALL_BINDIR) + set(CMAKE_INSTALL_BINDIR "bin") +endif() +if (NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) + set(CMAKE_INSTALL_INCLUDEDIR "include") +endif() if (POLICY CMP0054) # do not expand quoted arguments @@ -915,8 +921,8 @@ add_library(Td::TdJsonStatic ALIAS TdJsonStatic) install(TARGETS tdjson TdJson tdjson_static TdJsonStatic tdjson_private tdclient tdcore TdStatic EXPORT TdTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION bin - INCLUDES DESTINATION include + RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" ) install(EXPORT TdTargets @@ -925,12 +931,12 @@ install(EXPORT TdTargets DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/Td" ) -install(FILES ${TD_JSON_HEADERS} "${CMAKE_CURRENT_BINARY_DIR}/td/telegram/tdjson_export.h" DESTINATION include/td/telegram) -install(FILES td/telegram/Client.h td/telegram/Log.h DESTINATION include/td/telegram) -install(FILES td/tl/TlObject.h DESTINATION include/td/tl) -install(FILES "${TL_TD_AUTO_INCLUDES}/td/telegram/td_api.h" "${TL_TD_AUTO_INCLUDES}/td/telegram/td_api.hpp" DESTINATION include/td/telegram) +install(FILES ${TD_JSON_HEADERS} "${CMAKE_CURRENT_BINARY_DIR}/td/telegram/tdjson_export.h" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/td/telegram") +install(FILES td/telegram/Client.h td/telegram/Log.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/td/telegram") +install(FILES td/tl/TlObject.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/td/tl") +install(FILES "${TL_TD_AUTO_INCLUDES}/td/telegram/td_api.h" "${TL_TD_AUTO_INCLUDES}/td/telegram/td_api.hpp" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/td/telegram") if (TD_ENABLE_JNI) - install(FILES td/tl/tl_jni_object.h DESTINATION include/td/tl) + install(FILES td/tl/tl_jni_object.h DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/td/tl") endif() include(CMakePackageConfigHelpers) diff --git a/sqlite/CMakeLists.txt b/sqlite/CMakeLists.txt index 1ce924a9..c8968576 100644 --- a/sqlite/CMakeLists.txt +++ b/sqlite/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) +if (NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") +endif() + if (NOT OPENSSL_FOUND) find_package(OpenSSL REQUIRED) find_package(ZLIB REQUIRED) @@ -47,6 +51,4 @@ endif() install(TARGETS tdsqlite EXPORT TdTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION bin - INCLUDES DESTINATION include ) diff --git a/td/generate/CMakeLists.txt b/td/generate/CMakeLists.txt index 0b07d616..f4f7258d 100644 --- a/td/generate/CMakeLists.txt +++ b/td/generate/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) +if (NOT DEFINED CMAKE_INSTALL_BINDIR) + set(CMAKE_INSTALL_BINDIR "bin") +endif() + file(MAKE_DIRECTORY auto/td/telegram) file(MAKE_DIRECTORY auto/td/mtproto) @@ -129,9 +133,9 @@ if (NOT CMAKE_CROSSCOMPILING) ) if (TD_ENABLE_JNI) - install(TARGETS td_generate_java_api RUNTIME DESTINATION bin) - install(FILES JavadocTlDocumentationGenerator.php TlDocumentationGenerator.php DESTINATION bin/td/generate) - install(FILES scheme/td_api.tlo scheme/td_api.tl DESTINATION bin/td/generate/scheme) + install(TARGETS td_generate_java_api RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}") + install(FILES JavadocTlDocumentationGenerator.php TlDocumentationGenerator.php DESTINATION "${CMAKE_INSTALL_BINDIR}/td/generate") + install(FILES scheme/td_api.tlo scheme/td_api.tl DESTINATION "${CMAKE_INSTALL_BINDIR}/td/generate/scheme") endif() if (TD_ENABLE_DOTNET) diff --git a/tdactor/CMakeLists.txt b/tdactor/CMakeLists.txt index 44e029bf..58f0fb0a 100644 --- a/tdactor/CMakeLists.txt +++ b/tdactor/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) +if (NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") +endif() + #SOURCE SETS set(TDACTOR_SOURCE td/actor/impl/ConcurrentScheduler.cpp @@ -52,6 +56,4 @@ endif() install(TARGETS tdactor EXPORT TdTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION bin - INCLUDES DESTINATION include ) diff --git a/tddb/CMakeLists.txt b/tddb/CMakeLists.txt index 7090cb9b..9a80b6cf 100644 --- a/tddb/CMakeLists.txt +++ b/tddb/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) +if (NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") +endif() + #SOURCE SETS set(TDDB_SOURCE td/db/binlog/Binlog.cpp @@ -52,6 +56,4 @@ endif() install(TARGETS tddb EXPORT TdTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION bin - INCLUDES DESTINATION include ) diff --git a/tdnet/CMakeLists.txt b/tdnet/CMakeLists.txt index 2b293cb9..ca7e33bf 100644 --- a/tdnet/CMakeLists.txt +++ b/tdnet/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) +if (NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") +endif() + if (NOT OPENSSL_FOUND) find_package(OpenSSL REQUIRED) find_package(ZLIB REQUIRED) @@ -61,6 +65,4 @@ endif() install(TARGETS tdnet EXPORT TdTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION bin - INCLUDES DESTINATION include ) diff --git a/tdutils/CMakeLists.txt b/tdutils/CMakeLists.txt index 17282360..d57d93c8 100644 --- a/tdutils/CMakeLists.txt +++ b/tdutils/CMakeLists.txt @@ -1,5 +1,9 @@ cmake_minimum_required(VERSION 3.0.2 FATAL_ERROR) +if (NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib") +endif() + if (WIN32) if (WINGETOPT_FOUND) set(TD_HAVE_GETOPT 1) @@ -328,6 +332,4 @@ endif() install(TARGETS tdutils EXPORT TdTargets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - RUNTIME DESTINATION bin - INCLUDES DESTINATION include )