From 8f2e34c6a35193ee8840d6f0bd062021865c5d6f Mon Sep 17 00:00:00 2001 From: Tyler Veness Date: Fri, 21 Oct 2022 19:23:56 -0700 Subject: [PATCH] [build] Remove wpilib prefix from CMake flat install (#4492) For system installs, `DESTDIR=/usr cmake --install buildfolder` installs libraries to `/usr/lib` with the correct rpath. Example structure: ``` /usr/include/wpimath/frc/controller/LinearQuadraticRegulator.h /usr/lib/libwpimath.so ``` Users need to provide `-I/usr/include/wpimath` in their projects. This is an artifact of the install() commands being in the subdirectory CMake files. For other locations, `DESTDIR=/opt/wpilib cmake --install buildfolder` installs libraries to `/opt/wpilib/lib`. Example structure: ``` /opt/wpilib/include/wpimath/frc/controller/LinearQuadraticRegulator.h /opt/wpilib/lib/libwpimath.so ``` --- CMakeLists.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c65eaf376f..53d901f4cb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,16 +36,16 @@ SET(CMAKE_SKIP_BUILD_RPATH FALSE) # (but later on when installing) SET(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE) -SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/wpilib/lib") +SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/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}/wpilib/lib" isSystemDir) +LIST(FIND CMAKE_PLATFORM_IMPLICIT_LINK_DIRECTORIES "${CMAKE_INSTALL_PREFIX}/lib" isSystemDir) IF("${isSystemDir}" STREQUAL "-1") - SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/wpilib/lib") + SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") ENDIF("${isSystemDir}" STREQUAL "-1") # Options for building certain parts of the repo. Everything is built by default. @@ -153,11 +153,11 @@ FATAL: Cannot build wpilib without wpimath. ") endif() -set( wpilib_dest wpilib) -set( include_dest wpilib/include ) -set( main_lib_dest wpilib/lib ) -set( java_lib_dest wpilib/java ) -set( jni_lib_dest wpilib/jni ) +set( wpilib_dest "") +set( include_dest include ) +set( main_lib_dest lib ) +set( java_lib_dest java ) +set( jni_lib_dest jni ) if (WITH_FLAT_INSTALL) set (wpilib_config_dir ${wpilib_dest})