summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorMatthew Woehlke <matthew.woehlke@kitware.com>2017-08-09 15:29:36 -0400
committerMatthew Woehlke <matthew.woehlke@kitware.com>2017-08-09 15:29:36 -0400
commit0e8e0e07d6c4bc8c9cd6df5407452c12752ab45c (patch)
tree61e45e5185d01b464546a18b72490eda7751a73a /CMakeLists.txt
parentec44c6c1675c25b9827aacd08c02433cccde7780 (diff)
downloadgoogletest-git-0e8e0e07d6c4bc8c9cd6df5407452c12752ab45c.tar.gz
Fix library install destinations
Modify library install destinations to install .dll's to the correct location (`bin`, not `lib`), and to install other artifacts to the correct platform-dependent location by using GNUInstallDirs. This is required for some distributions (e.g. Fedora) and will fix an issue that otherwise requires those distributions to patch the upstream sources. Also, add options to suppress installation, which may be useful for projects that embed Google Test. Since Google Test is trying to support archaic versions of CMake, a brain-dead fallback (which requires that the user set either LIB_SUFFIX or CMAKE_INSTALL_LIBDIR themselves) is included for versions that predate GNUInstallDirs. Fixes #1161. Co-Authored-By: d3x0r <d3x0r@users.noreply.github.com>
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt12
1 files changed, 12 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8d2b552e..7a86b742 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -4,10 +4,22 @@ project( googletest-distribution )
enable_testing()
+include(CMakeDependentOption)
+if (CMAKE_VERSION VERSION_LESS 2.8.5)
+ set(CMAKE_INSTALL_BINDIR "bin" CACHE STRING "User executables (bin)")
+ set(CMAKE_INSTALL_LIBDIR "lib${LIB_SUFFIX}" CACHE STRING "Object code libraries (lib)")
+ set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE STRING "C header files (include)")
+ mark_as_advanced(CMAKE_INSTALL_BINDIR CMAKE_INSTALL_LIBDIR CMAKE_INSTALL_INCLUDEDIR)
+else()
+ include(GNUInstallDirs)
+endif()
+
option(BUILD_GTEST "Builds the googletest subproject" OFF)
+cmake_dependent_option(INSTALL_GTEST "Enable installation of googletest. (Projects embedding googletest may want to turn this OFF.)" ON "BUILD_GTEST OR BUILD_GMOCK" OFF)
#Note that googlemock target already builds googletest
option(BUILD_GMOCK "Builds the googlemock subproject" ON)
+cmake_dependent_option(INSTALL_GMOCK "Enable installation of googlemock. (Projects embedding googlemock may want to turn this OFF.)" ON "BUILD_GMOCK" OFF)
if(BUILD_GMOCK)
add_subdirectory( googlemock )