diff options
author | Gennadiy Civil <gennadiycivil@users.noreply.github.com> | 2017-08-11 13:14:49 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-08-11 13:14:49 (GMT) |
commit | e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d (patch) | |
tree | a92ea44a339192eef0f794411397736fc3fcc402 | |
parent | c81be0f6fc06190b6b02a336ac85db77602b16e9 (diff) | |
parent | 0e8e0e07d6c4bc8c9cd6df5407452c12752ab45c (diff) | |
download | googletest-e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d.zip googletest-e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d.tar.gz googletest-e3bd4cbeaeef3cee65a68a8bd3c535cb779e9b6d.tar.bz2 |
Merge pull request #1160 from mwoehlke-kitware/honor-lib_suffix
Fix library install destinations
-rw-r--r-- | CMakeLists.txt | 12 | ||||
-rw-r--r-- | googlemock/CMakeLists.txt | 12 | ||||
-rw-r--r-- | googletest/CMakeLists.txt | 12 |
3 files changed, 28 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 3048630..96cdade 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,10 +8,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 ) diff --git a/googlemock/CMakeLists.txt b/googlemock/CMakeLists.txt index 9fb96a4..c3c8aae 100644 --- a/googlemock/CMakeLists.txt +++ b/googlemock/CMakeLists.txt @@ -103,10 +103,14 @@ endif() ######################################################################## # # Install rules -install(TARGETS gmock gmock_main - DESTINATION lib) -install(DIRECTORY ${gmock_SOURCE_DIR}/include/gmock - DESTINATION include) +if(INSTALL_GMOCK) + install(TARGETS gmock gmock_main + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(DIRECTORY ${gmock_SOURCE_DIR}/include/gmock + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +endif() ######################################################################## # diff --git a/googletest/CMakeLists.txt b/googletest/CMakeLists.txt index 36d0a9e..a570e27 100644 --- a/googletest/CMakeLists.txt +++ b/googletest/CMakeLists.txt @@ -102,10 +102,14 @@ endif() ######################################################################## # # Install rules -install(TARGETS gtest gtest_main - DESTINATION lib) -install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest - DESTINATION include) +if(INSTALL_GTEST) + install(TARGETS gtest gtest_main + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}) + install(DIRECTORY ${gtest_SOURCE_DIR}/include/gtest + DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}) +endif() ######################################################################## # |