Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: do not hardcode relative install directories #153

Merged
merged 1 commit into from
Jul 6, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 15 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ include (CMakePackageConfigHelpers)
include (CPack)
include (CTest)
include (DetermineGflagsNamespace)
include (GNUInstallDirs)

set (CMAKE_THREAD_PREFER_PTHREAD 1)

Expand Down Expand Up @@ -415,10 +416,15 @@ endif (WIN32)

set_target_properties (glog PROPERTIES PUBLIC_HEADER "${GLOG_PUBLIC_H}")

set (_glog_CMake_BINDIR ${CMAKE_INSTALL_BINDIR})
set (_glog_CMake_INCLUDE_DIR ${CMAKE_INSTALL_INCLUDEDIR})
set (_glog_CMake_LIBDIR ${CMAKE_INSTALL_LIBDIR})
set (_glog_CMake_INSTALLDIR ${_glog_CMake_LIBDIR}/cmake/glog)

target_include_directories (glog BEFORE PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>"
"$<INSTALL_INTERFACE:include>"
"$<INSTALL_INTERFACE:${_glog_CMake_INCLUDE_DIR}>"
PRIVATE ${CMAKE_CURRENT_BINARY_DIR}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)

Expand Down Expand Up @@ -555,18 +561,18 @@ endif (BUILD_TESTING)

install (TARGETS glog
EXPORT glog-targets
RUNTIME DESTINATION bin
PUBLIC_HEADER DESTINATION include/glog
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib)
RUNTIME DESTINATION ${_glog_CMake_BINDIR}
PUBLIC_HEADER DESTINATION ${_glog_CMake_INCLUDE_DIR}/glog
LIBRARY DESTINATION ${_glog_CMake_LIBDIR}
ARCHIVE DESTINATION ${_glog_CMake_LIBDIR})

if (gflags_FOUND)
set (gflags_DEPENDENCY "find_dependency (gflags ${gflags_VERSION})")
endif (gflags_FOUND)

configure_package_config_file (glog-config.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake
INSTALL_DESTINATION lib/cmake/glog
INSTALL_DESTINATION ${_glog_CMake_INSTALLDIR}
NO_CHECK_REQUIRED_COMPONENTS_MACRO)

write_basic_package_version_file (glog-config-version.cmake VERSION
Expand All @@ -578,6 +584,7 @@ export (PACKAGE glog)
install (FILES
${CMAKE_CURRENT_BINARY_DIR}/glog-config.cmake
${CMAKE_CURRENT_BINARY_DIR}/glog-config-version.cmake
DESTINATION lib/cmake/glog)
DESTINATION ${_glog_CMake_INSTALLDIR})

install (EXPORT glog-targets NAMESPACE glog:: DESTINATION lib/cmake/glog)
install (EXPORT glog-targets NAMESPACE glog:: DESTINATION
${_glog_CMake_INSTALLDIR})