diff --git a/CMakeLists.txt b/CMakeLists.txt index 04906eb..7e6ad0d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -36,8 +36,7 @@ set (DIR_INCLUDE ${DIR_PREFIX}/include) set (DIR_SHARE ${DIR_PREFIX}/share) set (DIR_ETC ${DIR_PREFIX}/etc) -set (CMAKE_INSTALL_BINDIR bin - CACHE STRING "Install location of executables") +set (CMAKE_INSTALL_BINDIR bin CACHE STRING "Install location of executables") if (DEFINED CMAKE_INSTALL_LIBDIR) set (DIR_LIBRARY ${CMAKE_INSTALL_LIBDIR}) @@ -62,13 +61,11 @@ set (DIR_SHARE_LOCALE ${DIR_SHARE}/locale) ######## Configuration option(BUILD_SHARED_LIBS "Build shared library and link executable against it" - ON) + ON) if (BUILD_SHARED_LIBS) - option(BUILD_STATIC "Build static library" - ON) + option(BUILD_STATIC "Build static library" ON) endif (BUILD_SHARED_LIBS) -option(BUILD_BINARY "Build executable" - ON) +option(BUILD_BINARY "Build executable" ON) configure_file( uchardet.pc.in diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index f81bf34..95148e4 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,4 +1,3 @@ - set( UCHARDET_HEADERS uchardet.h @@ -44,7 +43,7 @@ set( set (UCHARDET_TARGET libuchardet) if (BUILD_STATIC AND BUILD_SHARED_LIBS) -set (UCHARDET_STATIC_TARGET libuchardet_static) + set (UCHARDET_STATIC_TARGET libuchardet_static) endif () add_definitions( @@ -61,11 +60,11 @@ add_library( ) if (UCHARDET_STATIC_TARGET) - add_library( - ${UCHARDET_STATIC_TARGET} - STATIC - ${UCHARDET_SOURCES} - ) + add_library( + ${UCHARDET_STATIC_TARGET} + STATIC + ${UCHARDET_SOURCES} + ) endif (UCHARDET_STATIC_TARGET) set_target_properties( @@ -82,14 +81,14 @@ set_target_properties( ) if (UCHARDET_STATIC_TARGET) - set_target_properties( - ${UCHARDET_STATIC_TARGET} - PROPERTIES - LINKER_LANGUAGE - CXX - OUTPUT_NAME - uchardet - ) + set_target_properties( + ${UCHARDET_STATIC_TARGET} + PROPERTIES + LINKER_LANGUAGE + CXX + OUTPUT_NAME + uchardet + ) endif (UCHARDET_STATIC_TARGET) if (CMAKE_BUILD_TYPE MATCHES Debug) @@ -100,32 +99,32 @@ if (CMAKE_BUILD_TYPE MATCHES Debug) endif (CMAKE_BUILD_TYPE MATCHES Debug) if (NOT WIN32) -install( - TARGETS - ${UCHARDET_TARGET} - LIBRARY DESTINATION - ${DIR_LIBRARY} - ARCHIVE DESTINATION - ${DIR_LIBRARY} -) + install( + TARGETS + ${UCHARDET_TARGET} + LIBRARY DESTINATION + ${DIR_LIBRARY} + ARCHIVE DESTINATION + ${DIR_LIBRARY} + ) else (NOT WIN32) -install( - TARGETS - ${UCHARDET_TARGET} - RUNTIME DESTINATION - ${CMAKE_INSTALL_BINDIR} - ARCHIVE DESTINATION - ${DIR_LIBRARY} -) + install( + TARGETS + ${UCHARDET_TARGET} + RUNTIME DESTINATION + ${CMAKE_INSTALL_BINDIR} + ARCHIVE DESTINATION + ${DIR_LIBRARY} + ) endif (NOT WIN32) if (UCHARDET_STATIC_TARGET) - install( - TARGETS - ${UCHARDET_STATIC_TARGET} - ARCHIVE DESTINATION - ${DIR_LIBRARY_STATIC} - ) + install( + TARGETS + ${UCHARDET_STATIC_TARGET} + ARCHIVE DESTINATION + ${DIR_LIBRARY_STATIC} + ) endif (UCHARDET_STATIC_TARGET) install( @@ -138,5 +137,5 @@ install( include(symbols.cmake) if (BUILD_BINARY) -add_subdirectory(tools) + add_subdirectory(tools) endif (BUILD_BINARY) diff --git a/src/symbols.cmake b/src/symbols.cmake index 26897f6..4cd630d 100644 --- a/src/symbols.cmake +++ b/src/symbols.cmake @@ -11,14 +11,13 @@ set( set (LINK_FLAGS "") if (APPLE) - - # Create a symbols_list file for the darwin linker + # Create a symbols_list file for the darwin linker. string(REPLACE ";" "\n_" _symbols "${UCHARDET_SYMBOLS}") set(_symbols_list "${CMAKE_CURRENT_BINARY_DIR}/symbols.list") file(WRITE ${_symbols_list} "_${_symbols}\n") + set(LINK_FLAGS "${LINK_FLAGS} -Wl,-exported_symbols_list,'${_symbols_list}'") - elseif (CMAKE_CXX_COMPILER_ID STREQUAL GNU) # Create a version script for GNU ld. set(_symbols "{ global: ${UCHARDET_SYMBOLS}; local: *; };") @@ -26,7 +25,6 @@ elseif (CMAKE_CXX_COMPILER_ID STREQUAL GNU) file(WRITE ${_version_script} "${_symbols}\n") set(LINK_FLAGS "${LINK_FLAGS} -Wl,--version-script,\"${_version_script}\"") - endif (APPLE) set_target_properties( diff --git a/src/tools/CMakeLists.txt b/src/tools/CMakeLists.txt index a2ddf94..8e3ffa4 100644 --- a/src/tools/CMakeLists.txt +++ b/src/tools/CMakeLists.txt @@ -16,8 +16,6 @@ target_link_libraries( install( TARGETS uchardet - RUNTIME - DESTINATION + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} ) - diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0339263..c9663bd 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -25,25 +25,23 @@ set_target_properties( # Iterate through all langs. file(GLOB dirs "[a-z][a-z]") foreach(dir ${dirs}) - get_filename_component(lang ${dir} NAME) - file(GLOB files "${dir}/*") - # Iterate through all files. - foreach(file ${files}) - get_filename_component(charset ${file} NAME_WE) - # These are tests known to fail (not supported or not efficient - # enough). We will have to take a closer look and fix these, but - # there is no need to break the whole `make test` right now, - # which may make actual regressions harder to notice. - if ("${lang}:${charset}" STREQUAL "ja:utf-16le" OR - "${lang}:${charset}" STREQUAL "ja:utf-16be" OR - "${lang}:${charset}" STREQUAL "es:iso-8859-15" OR - "${lang}:${charset}" STREQUAL "da:iso-8859-1" OR - "${lang}:${charset}" STREQUAL "he:iso-8859-8") - message(STATUS "Skipping test ${lang}:${charset} (known broken)") - else() - add_test(NAME "${lang}:${charset}" - COMMAND uchardet-tests ${file}) - endif() - endforeach() + get_filename_component(lang ${dir} NAME) + file(GLOB files "${dir}/*") + # Iterate through all files. + foreach(file ${files}) + get_filename_component(charset ${file} NAME_WE) + # These are tests known to fail (not supported or not efficient + # enough). We will have to take a closer look and fix these, but + # there is no need to break the whole `make test` right now, + # which may make actual regressions harder to notice. + if ("${lang}:${charset}" STREQUAL "ja:utf-16le" OR + "${lang}:${charset}" STREQUAL "ja:utf-16be" OR + "${lang}:${charset}" STREQUAL "es:iso-8859-15" OR + "${lang}:${charset}" STREQUAL "da:iso-8859-1" OR + "${lang}:${charset}" STREQUAL "he:iso-8859-8") + message(STATUS "Skipping test ${lang}:${charset} (known broken)") + else() + add_test(NAME "${lang}:${charset}" COMMAND uchardet-tests ${file}) + endif() + endforeach() endforeach() -