From 4fe2827b3b4c0a4d3caeb1b92a592d3407388a81 Mon Sep 17 00:00:00 2001 From: Thad House <87844845+thhous-msft@users.noreply.github.com> Date: Tue, 23 Nov 2021 12:17:41 -0800 Subject: [PATCH] Clean up cmake install paths (#2175) * Clean up cmake install paths Removes /msquic from library install path, as it does make using raw gcc harder, and is non standard. Cmake install process is tested to still work * Fix rust build * Remove mutable var --- CMakeLists.txt | 39 ------------------------------------ scripts/build.rs | 3 +-- src/bin/CMakeLists.txt | 8 ++++---- src/generated/CMakeLists.txt | 2 +- 4 files changed, 6 insertions(+), 46 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b67f3d4ccd..c621fb7170 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -63,45 +63,6 @@ elseif (UNIX) endif() message(STATUS "QUIC Platform: ${CX_PLATFORM}") -if(WIN32) - # On Windows, we just need to set the destination variables - # This will allow the build to be picked up by other projects - set(msquic_dest ${CMAKE_INSTALL_PREFIX}) - set(main_lib_dest lib) - set(include_dest include) -else() - # On unix platforms, we need to do rpath manipulation for the shared library - # In addition, we install into a subfolder of install to not polute the global namespace - - # Setup for Install. We set this up in here rather then in the main library folder for future use. - # i.e. don't skip the full RPATH for the build tree - #set(CMAKE_SKIP_BUILD_RPATH FALSE) - - # When building, don't use the install RPATH already - # (but later on when installing) - #set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) - - # Azure is not liking this argument. I think its a bug in their configuration - # Once this is fixed, also fix the shim in build-config-user.yml - #set(CMAKE_BUILD_RPATH_USE_ORIGIN TRUE) - - #set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/msquic/lib") - - # Add the automatically determined parts of the RPATH - # which point to directories outside the build tree to the install RPATH - #set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) - - # The RPATH to be used when installing, but only if it's not a system directory - list(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/msquic/lib" isSystemDir) - if("${isSystemDir}" STREQUAL "-1") - #set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/msquic/lib") - endif("${isSystemDir}" STREQUAL "-1") - - set(msquic_dest msquic) - set(main_lib_dest msquic/lib) - set(include_dest msquic/include) -endif() - set(FILENAME_DEP_REPLACE "get_filename_component(SELF_DIR \"$\{CMAKE_CURRENT_LIST_FILE\}\" PATH)") set(SELF_DIR "$\{SELF_DIR\}") diff --git a/scripts/build.rs b/scripts/build.rs index 45cec67bd6..f8c266376b 100644 --- a/scripts/build.rs +++ b/scripts/build.rs @@ -5,10 +5,9 @@ use cmake::Config; use std::path::Path; fn main() { - let mut path_extra = "msquic/lib"; + let path_extra = "lib"; let mut logging_enabled = "off"; if cfg!(windows) { - path_extra = "lib"; logging_enabled = "on"; } diff --git a/src/bin/CMakeLists.txt b/src/bin/CMakeLists.txt index 6cb7386c47..da355d8057 100644 --- a/src/bin/CMakeLists.txt +++ b/src/bin/CMakeLists.txt @@ -254,15 +254,15 @@ set(PUBLIC_HEADERS ../inc/msquic_posix.h ../inc/quic_sal_stub.h) -install(TARGETS msquic EXPORT msquic DESTINATION "${main_lib_dest}") -install(FILES ${PUBLIC_HEADERS} DESTINATION "${include_dest}") +install(TARGETS msquic EXPORT msquic DESTINATION lib) +install(FILES ${PUBLIC_HEADERS} DESTINATION include) configure_file(msquic-config.cmake.in ${CMAKE_BINARY_DIR}/msquic-config.cmake) -install(FILES ${CMAKE_BINARY_DIR}/msquic-config.cmake DESTINATION ${msquic_dest}) +install(FILES ${CMAKE_BINARY_DIR}/msquic-config.cmake DESTINATION share/msquic) if(BUILD_SHARED_LIBS) - install(EXPORT msquic DESTINATION ${msquic_dest}) + install(EXPORT msquic DESTINATION share/msquic) endif() if (MSVC AND NOT QUIC_ENABLE_SANITIZERS AND BUILD_SHARED_LIBS) diff --git a/src/generated/CMakeLists.txt b/src/generated/CMakeLists.txt index ae7030764f..3f6164d6ee 100644 --- a/src/generated/CMakeLists.txt +++ b/src/generated/CMakeLists.txt @@ -22,7 +22,7 @@ if(QUIC_ENABLE_LOGGING) target_link_libraries(msquic.lttng PRIVATE logging_inc inc) target_link_libraries(msquic.lttng PRIVATE ${LTTNGUST_LIBRARIES}) - install(TARGETS msquic.lttng DESTINATION "${main_lib_dest}") + install(TARGETS msquic.lttng DESTINATION lib) endif() else() add_library(logging INTERFACE)