CMake: Handier way to find Iconv
This commit is contained in:
parent
a3d8927c2b
commit
0dfe23504c
@ -22,6 +22,9 @@ if(WITH_OGG)
|
||||
find_package(OGG REQUIRED)
|
||||
endif()
|
||||
|
||||
find_package(Iconv)
|
||||
set(HAVE_ICONV ${Iconv_FOUND})
|
||||
|
||||
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -Waggregate-return -Wcast-align -Wnested-externs -Wshadow -Wundef -Wmissing-declarations -Winline")
|
||||
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -O3 -funroll-loops")
|
||||
|
@ -1,8 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.11)
|
||||
|
||||
option(ENABLE_64_BIT_WORDS "Set FLAC__BYTES_PER_WORD to 8 (4 is the default)" OFF)
|
||||
option(WITH_XMMS "Build XMMS plugin" OFF)
|
||||
|
||||
check_include_file("iconv.h" HAVE_ICONV)
|
||||
|
||||
add_subdirectory("libFLAC")
|
||||
if(BUILD_CXXLIBS)
|
||||
add_subdirectory("libFLAC++")
|
||||
|
@ -26,9 +26,7 @@ target_compile_definitions(FLAC++
|
||||
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLACPP_API_EXPORTS>
|
||||
PUBLIC $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:FLAC__NO_DLL>)
|
||||
if(NOT WIN32)
|
||||
target_compile_definitions(FLAC++
|
||||
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLAC__USE_VISIBILITY_ATTR>
|
||||
)
|
||||
target_compile_definitions(FLAC++ PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLAC__USE_VISIBILITY_ATTR>)
|
||||
endif()
|
||||
target_include_directories(FLAC++ INTERFACE
|
||||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||
@ -38,11 +36,9 @@ if(BUILD_SHARED_LIBS)
|
||||
set_target_properties(FLAC++ PROPERTIES
|
||||
VERSION 6.3.0
|
||||
SOVERSION 6)
|
||||
if(NOT WIN32)
|
||||
set_target_properties(FLAC++ PROPERTIES
|
||||
CXX_VISIBILITY_PRESET hidden
|
||||
)
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
set_target_properties(FLAC++ PROPERTIES CXX_VISIBILITY_PRESET hidden)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
install(TARGETS FLAC++ EXPORT targets
|
||||
|
@ -97,9 +97,7 @@ target_compile_definitions(FLAC
|
||||
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLAC_API_EXPORTS>
|
||||
PUBLIC $<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:FLAC__NO_DLL>)
|
||||
if(NOT WIN32)
|
||||
target_compile_definitions(FLAC
|
||||
PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLAC__USE_VISIBILITY_ATTR>
|
||||
)
|
||||
target_compile_definitions(FLAC PRIVATE $<$<BOOL:${BUILD_SHARED_LIBS}>:FLAC__USE_VISIBILITY_ATTR>)
|
||||
endif()
|
||||
target_include_directories(FLAC INTERFACE
|
||||
"$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>"
|
||||
@ -112,11 +110,9 @@ if(BUILD_SHARED_LIBS)
|
||||
set_target_properties(FLAC PROPERTIES
|
||||
VERSION 8.3.0
|
||||
SOVERSION 8)
|
||||
if(NOT WIN32)
|
||||
set_target_properties(FLAC PROPERTIES
|
||||
C_VISIBILITY_PRESET hidden
|
||||
)
|
||||
endif()
|
||||
if(NOT WIN32)
|
||||
set_target_properties(FLAC PROPERTIES C_VISIBILITY_PRESET hidden)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
||||
|
@ -1,5 +1,8 @@
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
add_library(plugin_common STATIC
|
||||
charset.c
|
||||
dither.c
|
||||
replaygain.c
|
||||
tags.c)
|
||||
target_link_libraries(plugin_common PUBLIC $<TARGET_NAME_IF_EXISTS:Iconv::Iconv>)
|
||||
|
@ -1,9 +1,8 @@
|
||||
set(CMAKE_REQUIRED_LIBRARIES iconv)
|
||||
check_symbol_exists(iconv "iconv.h" HAVE_ICONV_LIB)
|
||||
cmake_minimum_required(VERSION 3.12)
|
||||
|
||||
add_library(utf8 STATIC
|
||||
charset.c
|
||||
iconvert.c
|
||||
utf8.c)
|
||||
|
||||
target_link_libraries(utf8 PUBLIC grabbag $<$<BOOL:${HAVE_ICONV_LIB}>:iconv>)
|
||||
target_link_libraries(utf8 PUBLIC grabbag $<TARGET_NAME_IF_EXISTS:Iconv::Iconv>)
|
||||
|
Loading…
Reference in New Issue
Block a user