Skip to content

Commit 61c4af0

Browse files
committed
If CMake 2.8.5 or higher, use the "GNUInstallDirs" module to
find if to install libraries into "lib" or "lib64". Without this, the RPM build on SLES11 fails, see http://public.kitware.com/Bug/view.php?id=11964
1 parent 88438f3 commit 61c4af0

File tree

3 files changed

+14
-11
lines changed

3 files changed

+14
-11
lines changed

CMakeLists.txt

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,20 +25,23 @@
2525

2626
PROJECT(MYSQLCPPCONN)
2727

28-
IF(WIN32)
29-
# We need this for mysqlcppconn_EXPORTS needed for the static build
30-
cmake_minimum_required(VERSION 2.6.2)
31-
ELSE(WIN32)
32-
cmake_minimum_required(VERSION 2.6)
33-
ENDIF(WIN32)
28+
cmake_minimum_required(VERSION 2.6.2)
3429

3530
if(COMMAND cmake_policy AND POLICY CMP0015)
3631
cmake_policy(SET CMP0015 NEW)
3732
endif(COMMAND cmake_policy AND POLICY CMP0015)
3833

39-
4034
INCLUDE(VersionInfo.cmake)
4135

36+
OPTION(TAR_LAYOUT "Use directory layout for an unpacked TAR install")
37+
38+
IF(TAR_LAYOUT OR NOT CMAKE_VERSION OR CMAKE_VERSION VERSION_LESS "2.8.5")
39+
SET(INSTALL_LIBDIR lib)
40+
ELSE()
41+
INCLUDE(GNUInstallDirs)
42+
SET(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR})
43+
ENDIF()
44+
4245
SET(EDIT_WARNING_MESSAGE "Please do not edit this file - it is generated by cmake. Edit its source file instead.")
4346

4447
# Configuring header file with driver version info

driver/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,8 +309,8 @@ IF(WIN32)
309309
)
310310
ELSE(WIN32)
311311
INSTALL(TARGETS mysqlcppconn mysqlcppconn-static
312-
LIBRARY DESTINATION lib
313-
ARCHIVE DESTINATION lib
312+
LIBRARY DESTINATION ${INSTALL_LIBDIR}
313+
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
314314
)
315315
ENDIF(WIN32)
316316

thread/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ IF(WIN32)
7272
)
7373
ELSE(WIN32)
7474
INSTALL(TARGETS mysqlcppconn_thread mysqlcppconn_thread-static
75-
LIBRARY DESTINATION lib
76-
ARCHIVE DESTINATION lib
75+
LIBRARY DESTINATION ${INSTALL_LIBDIR}
76+
ARCHIVE DESTINATION ${INSTALL_LIBDIR}
7777
)
7878
ENDIF(WIN32)
7979

0 commit comments

Comments
 (0)