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,30 +27,12 @@ if(WIN32)
${EXECUTABLE_SOURCES} ${EXECUTABLE_SOURCES}
${WIN_EXEC_SOURCES} ${WIN_EXEC_SOURCES}
) )
else()
add_executable(ncmdump
${HEADERS}
${COMMON_SOURCES}
${EXECUTABLE_SOURCES}
)
endif()
add_library(libncmdump SHARED add_library(libncmdump SHARED
${HEADERS} ${HEADERS}
${COMMON_SOURCES} ${COMMON_SOURCES}
${LIBRARY_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_include_directories(libncmdump PRIVATE src/include)
target_link_libraries(libncmdump tag) target_link_libraries(libncmdump tag)
@ -59,11 +41,17 @@ target_include_directories(libncmdump PRIVATE taglib/taglib)
target_include_directories(libncmdump PRIVATE taglib/taglib/toolkit) target_include_directories(libncmdump PRIVATE taglib/taglib/toolkit)
target_include_directories(libncmdump PRIVATE taglib/taglib/mpeg/id3v2) target_include_directories(libncmdump PRIVATE taglib/taglib/mpeg/id3v2)
if(WIN32)
if(CMAKE_COMPILER_IS_GNUCXX) if(CMAKE_COMPILER_IS_GNUCXX)
# static link when using MinGW
target_link_options(ncmdump PRIVATE -static) target_link_options(ncmdump PRIVATE -static)
target_link_options(libncmdump PRIVATE -static) target_link_options(libncmdump PRIVATE -static)
endif() endif()
else()
add_executable(ncmdump
${HEADERS}
${COMMON_SOURCES}
${EXECUTABLE_SOURCES}
)
endif() endif()
include(GNUInstallDirs) include(GNUInstallDirs)