From 824ace49accd8a535f10b1e72f359935175cc63e Mon Sep 17 00:00:00 2001 From: Kyle Evans Date: Wed, 2 May 2018 10:32:26 -0500 Subject: [PATCH] Add SetFreeRDPCMakeInstallDir function to abstract away platform differences Different platforms/systems may install CMake modules into different places. For instance, FreeBSD will install modules into ${PREFIX}/share/cmake/Modules while Linux distributions might install into ${PREFIX}/lib/cmake. This leaves us with a useful abstraction- consumers only need to care about the name of their subdirectory, and only one place needs to be patched to change where this subdirectory lands. --- CMakeLists.txt | 1 + cmake/SetFreeRDPCMakeInstallDir.cmake | 7 +++++++ 2 files changed, 8 insertions(+) create mode 100644 cmake/SetFreeRDPCMakeInstallDir.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index b2947afce..76b97f9d1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,7 @@ include(GNUInstallDirsWrapper) include(CMakePackageConfigHelpers) include(InstallFreeRDPMan) include(GetGitRevisionDescription) +include(SetFreeRDPCMakeInstallDir) # Soname versioning set(BUILD_NUMBER 0) diff --git a/cmake/SetFreeRDPCMakeInstallDir.cmake b/cmake/SetFreeRDPCMakeInstallDir.cmake new file mode 100644 index 000000000..125e2f42d --- /dev/null +++ b/cmake/SetFreeRDPCMakeInstallDir.cmake @@ -0,0 +1,7 @@ +function(SetFreeRDPCMakeInstallDir SETVAR subdir) + if(FREEBSD) + set(${SETVAR} "${CMAKE_INSTALL_DATAROOTDIR}/cmake/Modules/${subdir}" PARENT_SCOPE) + else() + set(${SETVAR} "${CMAKE_INSTALL_LIBDIR}/cmake/${subdir}" PARENT_SCOPE) + endif() +endfunction()