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.
This commit is contained in:
Kyle Evans 2018-05-02 10:32:26 -05:00
parent fbb21e3499
commit 824ace49ac
2 changed files with 8 additions and 0 deletions

View File

@ -68,6 +68,7 @@ include(GNUInstallDirsWrapper)
include(CMakePackageConfigHelpers)
include(InstallFreeRDPMan)
include(GetGitRevisionDescription)
include(SetFreeRDPCMakeInstallDir)
# Soname versioning
set(BUILD_NUMBER 0)

View File

@ -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()