From 3b479ee8109ed5ed80a57fdebe36b3d5ee98fc5b Mon Sep 17 00:00:00 2001 From: Mike Gilbert Date: Tue, 6 Dec 2011 00:02:07 -0500 Subject: [PATCH] cmake: Add a wrapper module for GNUInstallDirs. --- CMakeLists.txt | 14 +------------- cmake/GNUInstallDirsWrapper.cmake | 13 +++++++++++++ 2 files changed, 14 insertions(+), 13 deletions(-) create mode 100644 cmake/GNUInstallDirsWrapper.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index db580b9e9..cb6414c77 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,19 +27,6 @@ include(CheckLibraryExists) include(FindPkgConfig) include(TestBigEndian) -# GNUInstallDirs is a relatively new cmake module -include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GID_PATH) -if(GID_PATH EQUAL NOTFOUND) - # Set default libdir - if(NOT DEFINED CMAKE_INSTALL_LIBDIR) - set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "object code libraries (lib)") - endif() - # Set default bindir - if(NOT DEFINED CMAKE_INSTALL_BINDIR) - set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)") - endif() -endif() - # Include our extra modules set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/) @@ -47,6 +34,7 @@ include(AutoVersioning) include(ConfigOptions) include(FindOptionalPackage) include(CheckCCompilerFlag) +include(GNUInstallDirsWrapper) # Soname versioning - 0.0.0 since it is not being managed yet set(FREERDP_VERSION_MAJOR "1") diff --git a/cmake/GNUInstallDirsWrapper.cmake b/cmake/GNUInstallDirsWrapper.cmake new file mode 100644 index 000000000..5b0edc359 --- /dev/null +++ b/cmake/GNUInstallDirsWrapper.cmake @@ -0,0 +1,13 @@ +# GNUInstallDirs is a relatively new cmake module, so wrap it to avoid errors +include(GNUInstallDirs OPTIONAL RESULT_VARIABLE GID_PATH) +if(GID_PATH STREQUAL "NOTFOUND") + if(NOT DEFINED CMAKE_INSTALL_BINDIR) + set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)") + endif() + + if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(CMAKE_INSTALL_LIBDIR "lib" CACHE PATH "object code libraries (lib)") + endif() + + mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR) +endif()