Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix the static library might failed to link on Windows #251

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,16 +106,20 @@ if (LINK_STATIC AND BUILD_STATIC_LIB)
endwhile()
list(REMOVE_ITEM LIBLIST "debug")
list(REMOVE_ITEM LIBLIST "optimized")
string(REPLACE ";" " " TEMP_OUT "${LIBLIST}")
foreach (ITEM IN LISTS LIBLIST)
list(APPEND TEMP_OUT ${ITEM})
endforeach ()
set(${OUTLIST} ${TEMP_OUT} PARENT_SCOPE)
endfunction(remove_libtype)

add_library(pulsarStaticWithDeps STATIC ${PULSAR_SOURCES})
target_include_directories(pulsarStaticWithDeps PRIVATE ${dlfcn-win32_INCLUDE_DIRS})
remove_libtype("${COMMON_LIBS}" "optimized" DEBUG_STATIC_LIBS)
remove_libtype("${COMMON_LIBS}" "debug" STATIC_LIBS)
set_property(TARGET pulsarStaticWithDeps PROPERTY STATIC_LIBRARY_FLAGS_DEBUG ${DEBUG_STATIC_LIBS})
set_property(TARGET pulsarStaticWithDeps PROPERTY STATIC_LIBRARY_FLAGS_RELEASE ${STATIC_LIBS})
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
remove_libtype("${COMMON_LIBS}" "optimized" STATIC_LIBS)
else ()
remove_libtype("${COMMON_LIBS}" "debug" STATIC_LIBS)
endif ()
set_property(TARGET pulsarStaticWithDeps PROPERTY STATIC_LIBRARY_OPTIONS ${STATIC_LIBS})
set_property(TARGET pulsarStaticWithDeps PROPERTY OUTPUT_NAME ${LIB_NAME}WithDeps)
set_property(TARGET pulsarStaticWithDeps PROPERTY VERSION ${LIBRARY_VERSION})
install(TARGETS pulsarStaticWithDeps DESTINATION lib)
Expand Down