chore: only build lib on Windows

This commit is contained in:
TaurusXin 2024-03-24 17:44:51 +08:00
parent 602c6ed43a
commit d47d29426e
Signed by: taurusxin
GPG Key ID: C334DCA04AC2D2CC
1 changed files with 19 additions and 31 deletions

View File

@ -27,6 +27,25 @@ if(WIN32)
${EXECUTABLE_SOURCES}
${WIN_EXEC_SOURCES}
)
add_library(libncmdump SHARED
${HEADERS}
${COMMON_SOURCES}
${LIBRARY_SOURCES}
)
target_include_directories(libncmdump PRIVATE src/include)
target_link_libraries(libncmdump tag)
target_include_directories(libncmdump PRIVATE taglib)
target_include_directories(libncmdump PRIVATE taglib/taglib)
target_include_directories(libncmdump PRIVATE taglib/taglib/toolkit)
target_include_directories(libncmdump PRIVATE taglib/taglib/mpeg/id3v2)
if(CMAKE_COMPILER_IS_GNUCXX)
# static link when using MinGW
target_link_options(ncmdump PRIVATE -static)
target_link_options(libncmdump PRIVATE -static)
endif()
else()
add_executable(ncmdump
${HEADERS}
@ -35,37 +54,6 @@ else()
)
endif()
add_library(libncmdump SHARED
${HEADERS}
${COMMON_SOURCES}
${LIBRARY_SOURCES}
)
# executable target
target_include_directories(ncmdump PRIVATE src/include)
target_link_libraries(ncmdump tag)
target_include_directories(ncmdump PRIVATE taglib)
target_include_directories(ncmdump PRIVATE taglib/taglib)
target_include_directories(ncmdump PRIVATE taglib/taglib/toolkit)
target_include_directories(ncmdump PRIVATE taglib/taglib/mpeg/id3v2)
# library target
target_include_directories(libncmdump PRIVATE src/include)
target_link_libraries(libncmdump tag)
target_include_directories(libncmdump PRIVATE taglib)
target_include_directories(libncmdump PRIVATE taglib/taglib)
target_include_directories(libncmdump PRIVATE taglib/taglib/toolkit)
target_include_directories(libncmdump PRIVATE taglib/taglib/mpeg/id3v2)
if(WIN32)
if(CMAKE_COMPILER_IS_GNUCXX)
target_link_options(ncmdump PRIVATE -static)
target_link_options(libncmdump PRIVATE -static)
endif()
endif()
include(GNUInstallDirs)
install(TARGETS ncmdump
BUNDLE DESTINATION .