mirror of
https://gitlab.freedesktop.org/uchardet/uchardet.git
synced 2025-12-06 16:56:40 +08:00
Merge pull request #24 from wiiaboo/ab-suite
Improving build with more options. Building only static possible, uchardet command line tool build can be disabled, bindir can be customized…
This commit is contained in:
commit
d255184609
@ -34,9 +34,11 @@ set (DIR_LIBRARY ${DIR_PREFIX}/${CMAKE_SHARED_LIBRARY_PREFIX})
|
||||
set (DIR_LIBRARY_STATIC ${DIR_PREFIX}/${CMAKE_STATIC_LIBRARY_PREFIX})
|
||||
set (DIR_INCLUDE ${DIR_PREFIX}/include)
|
||||
set (DIR_SHARE ${DIR_PREFIX}/share)
|
||||
set (DIR_BIN ${DIR_PREFIX}/bin)
|
||||
set (DIR_ETC ${DIR_PREFIX}/etc)
|
||||
|
||||
set (CMAKE_INSTALL_BINDIR bin
|
||||
CACHE STRING "Install location of executables")
|
||||
|
||||
if (DEFINED CMAKE_INSTALL_LIBDIR)
|
||||
set (DIR_LIBRARY ${CMAKE_INSTALL_LIBDIR})
|
||||
set (DIR_LIBRARY_STATIC ${CMAKE_INSTALL_LIBDIR})
|
||||
@ -59,7 +61,13 @@ set (DIR_SHARE_LOCALE ${DIR_SHARE}/locale)
|
||||
|
||||
######## Configuration
|
||||
|
||||
option(BUILD_STATIC "Build static library"
|
||||
option(BUILD_SHARED_LIBS "Build shared library and link executable against it"
|
||||
ON)
|
||||
if (BUILD_SHARED_LIBS)
|
||||
option(BUILD_STATIC "Build static library"
|
||||
ON)
|
||||
endif (BUILD_SHARED_LIBS)
|
||||
option(BUILD_BINARY "Build executable"
|
||||
ON)
|
||||
|
||||
configure_file(
|
||||
|
||||
@ -43,7 +43,9 @@ set(
|
||||
)
|
||||
|
||||
set (UCHARDET_TARGET libuchardet)
|
||||
if (BUILD_STATIC AND BUILD_SHARED_LIBS)
|
||||
set (UCHARDET_STATIC_TARGET libuchardet_static)
|
||||
endif ()
|
||||
|
||||
add_definitions(
|
||||
-DPKGDATADIR="${DIR_SHARE_OPENCC}"
|
||||
@ -55,17 +57,16 @@ add_definitions(
|
||||
|
||||
add_library(
|
||||
${UCHARDET_TARGET}
|
||||
SHARED
|
||||
${UCHARDET_SOURCES}
|
||||
)
|
||||
|
||||
if (BUILD_STATIC)
|
||||
if (UCHARDET_STATIC_TARGET)
|
||||
add_library(
|
||||
${UCHARDET_STATIC_TARGET}
|
||||
STATIC
|
||||
${UCHARDET_SOURCES}
|
||||
)
|
||||
endif (BUILD_STATIC)
|
||||
endif (UCHARDET_STATIC_TARGET)
|
||||
|
||||
set_target_properties(
|
||||
${UCHARDET_TARGET}
|
||||
@ -80,7 +81,7 @@ set_target_properties(
|
||||
0
|
||||
)
|
||||
|
||||
if (BUILD_STATIC)
|
||||
if (UCHARDET_STATIC_TARGET)
|
||||
set_target_properties(
|
||||
${UCHARDET_STATIC_TARGET}
|
||||
PROPERTIES
|
||||
@ -89,7 +90,7 @@ if (BUILD_STATIC)
|
||||
OUTPUT_NAME
|
||||
uchardet
|
||||
)
|
||||
endif (BUILD_STATIC)
|
||||
endif (UCHARDET_STATIC_TARGET)
|
||||
|
||||
if (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
add_definitions(
|
||||
@ -100,30 +101,32 @@ endif (CMAKE_BUILD_TYPE MATCHES Debug)
|
||||
|
||||
if (NOT WIN32)
|
||||
install(
|
||||
TARGETS
|
||||
${UCHARDET_TARGET}
|
||||
LIBRARY DESTINATION
|
||||
${DIR_LIBRARY}
|
||||
TARGETS
|
||||
${UCHARDET_TARGET}
|
||||
LIBRARY DESTINATION
|
||||
${DIR_LIBRARY}
|
||||
ARCHIVE DESTINATION
|
||||
${DIR_LIBRARY}
|
||||
)
|
||||
else (NOT WIN32)
|
||||
install(
|
||||
TARGETS
|
||||
${UCHARDET_TARGET}
|
||||
RUNTIME DESTINATION
|
||||
${DIR_BIN}
|
||||
ARCHIVE DESTINATION
|
||||
${DIR_LIBRARY}
|
||||
TARGETS
|
||||
${UCHARDET_TARGET}
|
||||
RUNTIME DESTINATION
|
||||
${CMAKE_INSTALL_BINDIR}
|
||||
ARCHIVE DESTINATION
|
||||
${DIR_LIBRARY}
|
||||
)
|
||||
endif (NOT WIN32)
|
||||
|
||||
if (BUILD_STATIC)
|
||||
if (UCHARDET_STATIC_TARGET)
|
||||
install(
|
||||
TARGETS
|
||||
${UCHARDET_STATIC_TARGET}
|
||||
ARCHIVE DESTINATION
|
||||
${DIR_LIBRARY_STATIC}
|
||||
)
|
||||
endif (BUILD_STATIC)
|
||||
endif (UCHARDET_STATIC_TARGET)
|
||||
|
||||
install(
|
||||
FILES
|
||||
@ -134,4 +137,6 @@ install(
|
||||
|
||||
include(symbols.cmake)
|
||||
|
||||
if (BUILD_BINARY)
|
||||
add_subdirectory(tools)
|
||||
endif (BUILD_BINARY)
|
||||
|
||||
@ -25,7 +25,7 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL GNU)
|
||||
set(_version_script "${CMAKE_CURRENT_BINARY_DIR}/version.script")
|
||||
file(WRITE ${_version_script} "${_symbols}\n")
|
||||
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -Wl,--version-script,'${_version_script}'")
|
||||
set(LINK_FLAGS "${LINK_FLAGS} -Wl,--version-script,${_version_script}")
|
||||
|
||||
endif (APPLE)
|
||||
|
||||
|
||||
@ -18,6 +18,6 @@ install(
|
||||
uchardet
|
||||
RUNTIME
|
||||
DESTINATION
|
||||
${DIR_BIN}
|
||||
${CMAKE_INSTALL_BINDIR}
|
||||
)
|
||||
|
||||
|
||||
@ -8,4 +8,5 @@ Description: An encoding detector library ported from Mozilla
|
||||
Version: @UCHARDET_VERSION@
|
||||
Requires:
|
||||
Libs: -L${libdir} -luchardet
|
||||
Libs.private: -lstdc++
|
||||
Cflags: -I${includedir}/uchardet
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user