Change to not use library prefix on MSVC

This commit is contained in:
erw7 2018-05-23 20:22:05 +09:00
parent 655e3167ee
commit d337965e09
2 changed files with 7 additions and 17 deletions

View File

@ -31,11 +31,7 @@ if(LIBUV_USE_STATIC)
"${CMAKE_STATIC_LIBRARY_PREFIX}uv${CMAKE_STATIC_LIBRARY_SUFFIX}") "${CMAKE_STATIC_LIBRARY_PREFIX}uv${CMAKE_STATIC_LIBRARY_SUFFIX}")
endif(LIBUV_USE_STATIC) endif(LIBUV_USE_STATIC)
if(MSVC) list(APPEND LIBUV_NAMES uv)
list(APPEND LIBUV_NAMES libuv)
else()
list(APPEND LIBUV_NAMES uv)
endif()
find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES} find_library(LIBUV_LIBRARY NAMES ${LIBUV_NAMES}
HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS} HINTS ${PC_LIBUV_LIBDIR} ${PC_LIBUV_LIBRARY_DIRS}

View File

@ -4,18 +4,12 @@ project(libuv LANGUAGES C)
file(GLOB UV_SOURCES_COMMON src/*.c) file(GLOB UV_SOURCES_COMMON src/*.c)
file(GLOB UV_SOURCES_WIN src/win/*.c) file(GLOB UV_SOURCES_WIN src/win/*.c)
if(MSVC) add_library(uv ${UV_SOURCES_COMMON} ${UV_SOURCES_WIN})
set(LIBUV libuv) target_compile_definitions(uv PRIVATE WIN32_LEAN_AND_MEAN "_WIN32_WINNT=0x0600")
else() target_link_libraries(uv iphlpapi psapi shell32 userenv ws2_32)
set(LIBUV uv) target_include_directories(uv PUBLIC ./include PRIVATE ./src)
endif()
add_library(${LIBUV} ${UV_SOURCES_COMMON} ${UV_SOURCES_WIN})
target_compile_definitions(${LIBUV} PRIVATE WIN32_LEAN_AND_MEAN "_WIN32_WINNT=0x0600")
target_link_libraries(${LIBUV} iphlpapi psapi shell32 userenv ws2_32)
target_include_directories(${LIBUV} PUBLIC ./include PRIVATE ./src)
if(BUILD_SHARED_LIBS) if(BUILD_SHARED_LIBS)
set_target_properties(${LIBUV} PROPERTIES DEFINE_SYMBOL BUILDING_UV_SHARED) set_target_properties(uv PROPERTIES DEFINE_SYMBOL BUILDING_UV_SHARED)
endif() endif()
install(FILES install(FILES
@ -28,7 +22,7 @@ install(FILES
DESTINATION include) DESTINATION include)
include(GNUInstallDirs) include(GNUInstallDirs)
install(TARGETS ${LIBUV} install(TARGETS uv
PUBLIC_HEADER PUBLIC_HEADER
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}