Use GNUInstallDirs for install destinations

This has the advantage that the user may override e.g. the include
location, and the correct libdir (lib, lib64, lib/something) is
automatically determined.

Closes #1367.
This commit is contained in:
Rolf Eike Beer
2018-10-30 13:30:44 +01:00
committed by Camilla Löwy
parent df7f36a316
commit f9923e9095
4 changed files with 12 additions and 16 deletions
+5 -5
View File
@@ -100,7 +100,7 @@ set_target_properties(glfw PROPERTIES
target_compile_definitions(glfw PRIVATE _GLFW_USE_CONFIG_H)
target_include_directories(glfw PUBLIC
"$<BUILD_INTERFACE:${GLFW_SOURCE_DIR}/include>"
"$<INSTALL_INTERFACE:$<INSTALL_PREFIX>/include>")
"$<INSTALL_INTERFACE:${CMAKE_INSTALL_FULL_INCLUDEDIR}>")
target_include_directories(glfw PRIVATE
"${GLFW_SOURCE_DIR}/src"
"${GLFW_BINARY_DIR}/src"
@@ -121,7 +121,7 @@ target_compile_options(glfw PRIVATE
if (BUILD_SHARED_LIBS)
if (WIN32)
if (MINGW)
# Remove the lib prefix on the DLL (but not the import library
# Remove the lib prefix on the DLL (but not the import library)
set_target_properties(glfw PROPERTIES PREFIX "")
# Add a suffix to the import library to avoid naming conflicts
@@ -135,7 +135,7 @@ if (BUILD_SHARED_LIBS)
target_compile_options(glfw PRIVATE "-fno-common")
set_target_properties(glfw PROPERTIES
INSTALL_NAME_DIR "lib${LIB_SUFFIX}")
INSTALL_NAME_DIR "${CMAKE_INSTALL_LIBDIR}")
elseif (UNIX)
# Hide symbols not explicitly tagged for export from the shared library
target_compile_options(glfw PRIVATE "-fvisibility=hidden")
@@ -155,7 +155,7 @@ if (GLFW_INSTALL)
install(TARGETS glfw
EXPORT glfwTargets
RUNTIME DESTINATION "bin"
ARCHIVE DESTINATION "lib${LIB_SUFFIX}"
LIBRARY DESTINATION "lib${LIB_SUFFIX}")
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}")
endif()
+2 -2
View File
@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
includedir=${prefix}/include
libdir=${exec_prefix}/lib@LIB_SUFFIX@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@
libdir=@CMAKE_INSTALL_FULL_LIBDIR@
Name: GLFW
Description: A multi-platform library for OpenGL, window and input