Skip to content

Commit 31459ef

Browse files
committed
Follow up to r1925933: Use symbols from the GNUInstallDirs module
everywhere, not just for serf-2.pc. * CMakeLists.txt: Replace all explicit mentions of "bin", "lib" and "include" paths with their GNUInstallDirs equivalents, for all platforms. (LIBDIR): Remove this option, it was a legacy from the SCons build and is no longer necessary now that CMake hopefully gives us the right paths. git-svn-id: https://svn.apache.org/repos/asf/serf/trunk@1925963 13f79535-47bb-0310-9956-ffa450edef68
1 parent 54d2c13 commit 31459ef

File tree

1 file changed

+11
-18
lines changed

1 file changed

+11
-18
lines changed

CMakeLists.txt

Lines changed: 11 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ option(GSSAPI_ROOT:PATH "Path to GSSAPI's install area" "")
6161
option(DEBUG "Enable debugging info and strict compile warnings" OFF)
6262
option(SKIP_SHARED "Disable building shared Serf libraries" OFF)
6363
option(SKIP_STATIC "Disable building static Serf libraries" OFF)
64-
option(LIBDIR "Install directory for architecture-dependent libraries" "")
6564
option(DISABLE_LOGGING "Disable the logging framework at compile time" OFF)
6665
option(SKIP_TESTS "Disable building the unit tests and utilities" OFF)
6766
option(ENABLE_SLOW_TESTS "Enable long-running unit tests" OFF)
@@ -90,6 +89,7 @@ if("${CMAKE_BUILD_TYPE}" STREQUAL "")
9089
endif()
9190
endif()
9291

92+
include(GNUInstallDirs)
9393
include(SerfPlatform)
9494
include(SerfWindowsToolkit)
9595

@@ -278,10 +278,6 @@ if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
278278
endif()
279279

280280
# Process other build options
281-
if(LIBDIR)
282-
message(WARNING "option LIBDIR is not implemented yet")
283-
endif()
284-
285281
if(DEBUG)
286282
add_definitions("-DDEBUG" "-D_DEBUG")
287283
endif()
@@ -328,8 +324,8 @@ else()
328324
add_definitions("/DWIN64")
329325
endif()
330326

331-
set(CMAKE_IMPORT_LIBRARY_PREFIX "lib")
332-
set(CMAKE_SHARED_LIBRARY_PREFIX "lib")
327+
set(CMAKE_IMPORT_LIBRARY_PREFIX "${CMAKE_INSTALL_LIBDIR}")
328+
set(CMAKE_SHARED_LIBRARY_PREFIX "${CMAKE_INSTALL_LIBDIR}")
333329
endif(NOT MSVC)
334330

335331
# Define all targets
@@ -346,14 +342,15 @@ if(NOT SKIP_SHARED)
346342
SOVERSION ${SERF_SOVERSION})
347343
if(SERF_DARWIN AND NOT RELATIVE_RPATH)
348344
set_target_properties(serf_shared PROPERTIES
349-
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/lib")
345+
INSTALL_NAME_DIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}")
350346
endif()
351347
set(SERF_TARGETS "serf_shared")
352348

353349
if(SERF_WINDOWS)
354350
string(TOLOWER "${CMAKE_BUILD_TYPE}" config)
355351
if(NOT "${config}" STREQUAL "release")
356-
install(FILES $<TARGET_PDB_FILE:serf_shared> DESTINATION "bin")
352+
install(FILES $<TARGET_PDB_FILE:serf_shared>
353+
DESTINATION "${CMAKE_INSTALL_BINDIR}")
357354
endif()
358355
endif()
359356
endif()
@@ -374,24 +371,21 @@ set_target_properties(${SERF_TARGETS}
374371
OUTPUT_NAME "serf-${SERF_MAJOR_VERSION}")
375372

376373
install(TARGETS ${SERF_TARGETS}
377-
ARCHIVE DESTINATION "lib"
378-
LIBRARY DESTINATION "lib"
379-
RUNTIME DESTINATION "bin")
374+
ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}"
375+
LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}"
376+
RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
380377

381378
if(NOT SERF_WINDOWS)
382379
set(SERF_INCLUDE_SUBDIR "serf-${SERF_MAJOR_VERSION}")
383380
endif()
384-
install(FILES ${HEADERS} DESTINATION "include/${SERF_INCLUDE_SUBDIR}")
385-
381+
install(FILES ${HEADERS}
382+
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/${SERF_INCLUDE_SUBDIR}")
386383

387384
# Generate the pkg-config module file.
388385
if(NOT SERF_WINDOWS)
389386
# Use a separate variable scope for the substitutions in serf.pc.in.
390387
function(make_pkgconfig)
391388
set(PREFIX ${CMAKE_INSTALL_PREFIX})
392-
if(NOT LIBDIR)
393-
set(LIBDIR "\${prefix}/lib")
394-
endif()
395389
set(INCLUDE_SUBDIR ${SERF_INCLUDE_SUBDIR})
396390
set(VERSION ${SERF_VERSION})
397391
set(MAJOR ${SERF_MAJOR_VERSION})
@@ -414,7 +408,6 @@ if(NOT SERF_WINDOWS)
414408
endfunction()
415409

416410
make_pkgconfig()
417-
include(GNUInstallDirs)
418411
install(FILES "${CMAKE_CURRENT_BINARY_DIR}/serf-${SERF_MAJOR_VERSION}.pc"
419412
DESTINATION "${CMAKE_INSTALL_LIBDIR}/pkgconfig")
420413
endif()

0 commit comments

Comments
 (0)