Browse Source

[cmake] build translations as library

Signed-off-by: R4SAS <r4sas@i2pmail.org>
pull/1677/head
R4SAS 4 years ago
parent
commit
9fb8e8a582
Signed by: r4sas
GPG Key ID: 66F6C87B98EBCFE2
  1. 2
      .gitignore
  2. 17
      build/CMakeLists.txt

2
.gitignore vendored

@ -7,8 +7,10 @@ netDb @@ -7,8 +7,10 @@ netDb
/i2pd
/libi2pd.a
/libi2pdclient.a
/libi2pdlang.a
/libi2pd.so
/libi2pdclient.so
/libi2pdlang.so
*.exe

17
build/CMakeLists.txt

@ -69,6 +69,16 @@ if(WITH_LIBRARY) @@ -69,6 +69,16 @@ if(WITH_LIBRARY)
endif()
FILE(GLOB LANG_SRC ${LANG_SRC_DIR}/*.cpp)
add_library(libi2pdlang ${LANG_SRC})
set_target_properties(libi2pdlang PROPERTIES PREFIX "")
if(WITH_LIBRARY)
install(TARGETS libi2pdlang
EXPORT libi2pdlang
ARCHIVE DESTINATION lib
LIBRARY DESTINATION lib
COMPONENT Libraries)
endif()
set(DAEMON_SRC
"${DAEMON_SRC_DIR}/Daemon.cpp"
@ -198,10 +208,11 @@ if(WITH_PCH) @@ -198,10 +208,11 @@ if(WITH_PCH)
)
target_compile_options(libi2pd PRIVATE -include libi2pd/stdafx.h)
target_compile_options(libi2pdclient PRIVATE -include libi2pd/stdafx.h)
target_compile_options(libi2pdlang PRIVATE -include libi2pd/stdafx.h)
target_link_libraries(libi2pd stdafx)
endif()
target_link_libraries(libi2pdclient libi2pd)
target_link_libraries(libi2pdclient libi2pd libi2pdlang)
find_package(Boost COMPONENTS system filesystem program_options date_time REQUIRED)
if(NOT DEFINED Boost_INCLUDE_DIRS)
@ -265,7 +276,7 @@ message(STATUS "---------------------------------------") @@ -265,7 +276,7 @@ message(STATUS "---------------------------------------")
include(GNUInstallDirs)
if(WITH_BINARY)
add_executable("${PROJECT_NAME}" ${LANG_SRC} ${DAEMON_SRC})
add_executable("${PROJECT_NAME}" ${DAEMON_SRC})
if(WITH_STATIC)
set_target_properties("${PROJECT_NAME}" PROPERTIES LINK_FLAGS "-static")
@ -295,7 +306,7 @@ if(WITH_BINARY) @@ -295,7 +306,7 @@ if(WITH_BINARY)
endif()
target_link_libraries(libi2pd ${Boost_LIBRARIES} ${ZLIB_LIBRARY})
target_link_libraries("${PROJECT_NAME}" libi2pd libi2pdclient ${DL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${UPNP_LIB} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MINGW_EXTRA} ${DL_LIB} ${CMAKE_REQUIRED_LIBRARIES})
target_link_libraries("${PROJECT_NAME}" libi2pd libi2pdclient libi2pdlang ${DL_LIB} ${Boost_LIBRARIES} ${OPENSSL_LIBRARIES} ${UPNP_LIB} ${ZLIB_LIBRARY} ${CMAKE_THREAD_LIBS_INIT} ${MINGW_EXTRA} ${DL_LIB} ${CMAKE_REQUIRED_LIBRARIES})
install(TARGETS "${PROJECT_NAME}" RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} COMPONENT Runtime)
set(APPS "\${CMAKE_INSTALL_PREFIX}/bin/${PROJECT_NAME}${CMAKE_EXECUTABLE_SUFFIX}")

Loading…
Cancel
Save