cmake-plugin: 处理在 Windows 中的外部OpenCC构建问题

This commit is contained in:
zinface 2023-03-21 19:56:08 +08:00
parent e600007e75
commit 99e3db95ab
1 changed files with 9 additions and 2 deletions

View File

@ -107,7 +107,7 @@ ExternalProject_Add(${libopencc}
CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${libopencc_src} -B ${libopencc_build} ${libopencc_flags} CONFIGURE_COMMAND ${CMAKE_COMMAND} -S ${libopencc_src} -B ${libopencc_build} ${libopencc_flags}
# CMAKE_GENERATOR # CMAKE_GENERATOR
# BUILD_COMMAND ${CMAKE_COMMAND} --build ${libopencc_build} --config $<CONFIG> # BUILD_COMMAND ${CMAKE_COMMAND} --build ${libopencc_build} --config $<CONFIG>
INSTALL_COMMAND ${CMAKE_COMMAND} --install ${libopencc_build} --prefix ${libopencc_install} # INSTALL_COMMAND ${CMAKE_COMMAND} --install ${libopencc_build} --prefix ${libopencc_install}
# TEST_COMMAND # TEST_COMMAND
GIT_REMOTE_UPDATE_STRATEGY CHECKOUT GIT_REMOTE_UPDATE_STRATEGY CHECKOUT
EXCLUDE_FROM_ALL EXCLUDE_FROM_ALL
@ -125,3 +125,10 @@ set_target_properties(opencc
# opencc_git # opencc_git
add_dependencies(${LOCAL_PLUGIN_NAME} opencc_git) add_dependencies(${LOCAL_PLUGIN_NAME} opencc_git)
target_link_libraries(${LOCAL_PLUGIN_NAME} opencc) target_link_libraries(${LOCAL_PLUGIN_NAME} opencc)
if(WIN32)
target_include_directories(${LOCAL_PLUGIN_NAME} PUBLIC ${libopencc_install}/include)
target_compile_definitions(${LOCAL_PLUGIN_NAME}
PRIVATE
OPENCC_EXPORT=)
endif(WIN32)