Some fixes for CMake on Windows.
Tested successfully with NMake.
This commit is contained in:
parent
37e78eada1
commit
ab9dda1c61
|
@ -16,6 +16,7 @@ set (PROJECT_SOURCE_DIR "src")
|
||||||
option(RELEASE "Release build, debug build if disabled" ON)
|
option(RELEASE "Release build, debug build if disabled" ON)
|
||||||
option(LINK_SUPPORT "Allow hub linking" OFF)
|
option(LINK_SUPPORT "Allow hub linking" OFF)
|
||||||
option(SSL_SUPPORT "Enable SSL support" ON)
|
option(SSL_SUPPORT "Enable SSL support" ON)
|
||||||
|
option(SQLITE_SUPPORT "Enable SQLite support" ON)
|
||||||
|
|
||||||
find_package(Git)
|
find_package(Git)
|
||||||
|
|
||||||
|
@ -23,6 +24,10 @@ if (SSL_SUPPORT)
|
||||||
find_package(OpenSSL REQUIRED)
|
find_package(OpenSSL REQUIRED)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
if (MSVC)
|
||||||
|
add_definitions(-D_CRT_SECURE_NO_WARNINGS)
|
||||||
|
endif()
|
||||||
|
|
||||||
include_directories("${PROJECT_SOURCE_DIR}")
|
include_directories("${PROJECT_SOURCE_DIR}")
|
||||||
|
|
||||||
set (network_SOURCES
|
set (network_SOURCES
|
||||||
|
@ -67,6 +72,7 @@ set (utils_SOURCES
|
||||||
${PROJECT_SOURCE_DIR}/util/config_token.c
|
${PROJECT_SOURCE_DIR}/util/config_token.c
|
||||||
${PROJECT_SOURCE_DIR}/util/credentials.c
|
${PROJECT_SOURCE_DIR}/util/credentials.c
|
||||||
${PROJECT_SOURCE_DIR}/util/floodctl.c
|
${PROJECT_SOURCE_DIR}/util/floodctl.c
|
||||||
|
${PROJECT_SOURCE_DIR}/util/getopt.c
|
||||||
${PROJECT_SOURCE_DIR}/util/list.c
|
${PROJECT_SOURCE_DIR}/util/list.c
|
||||||
${PROJECT_SOURCE_DIR}/util/log.c
|
${PROJECT_SOURCE_DIR}/util/log.c
|
||||||
${PROJECT_SOURCE_DIR}/util/memory.c
|
${PROJECT_SOURCE_DIR}/util/memory.c
|
||||||
|
@ -82,14 +88,12 @@ set (adcclient_SOURCES
|
||||||
add_library(adc STATIC ${adc_SOURCES})
|
add_library(adc STATIC ${adc_SOURCES})
|
||||||
add_library(network STATIC ${network_SOURCES})
|
add_library(network STATIC ${network_SOURCES})
|
||||||
add_library(utils STATIC ${utils_SOURCES})
|
add_library(utils STATIC ${utils_SOURCES})
|
||||||
add_library(adcclient STATIC ${adcclient_SOURCES})
|
|
||||||
|
|
||||||
add_dependencies(adc utils)
|
add_dependencies(adc utils)
|
||||||
add_dependencies(network utils)
|
add_dependencies(network utils)
|
||||||
|
|
||||||
add_executable(uhub ${PROJECT_SOURCE_DIR}/core/main.c ${uhub_SOURCES} )
|
add_executable(uhub ${PROJECT_SOURCE_DIR}/core/main.c ${uhub_SOURCES} )
|
||||||
add_executable(uhub-passwd ${PROJECT_SOURCE_DIR}/tools/uhub-passwd.c ${PROJECT_SOURCE_DIR}/util/misc.c ${PROJECT_SOURCE_DIR}/util/memory.c ${PROJECT_SOURCE_DIR}/util/log.c ${PROJECT_SOURCE_DIR}/util/list.c)
|
|
||||||
add_executable(uhub-admin ${PROJECT_SOURCE_DIR}/tools/admin.c ${adcclient_SOURCES})
|
|
||||||
|
|
||||||
add_library(mod_example MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_example.c ${utils_SOURCES})
|
add_library(mod_example MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_example.c ${utils_SOURCES})
|
||||||
add_library(mod_welcome MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_welcome.c ${utils_SOURCES} ${network_SOURCES})
|
add_library(mod_welcome MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_welcome.c ${utils_SOURCES} ${network_SOURCES})
|
||||||
|
@ -98,10 +102,21 @@ add_library(mod_auth_simple MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_simple
|
||||||
add_library(mod_chat_history MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_history.c ${utils_SOURCES})
|
add_library(mod_chat_history MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_history.c ${utils_SOURCES})
|
||||||
add_library(mod_chat_only MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_only.c ${utils_SOURCES})
|
add_library(mod_chat_only MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_chat_only.c ${utils_SOURCES})
|
||||||
add_library(mod_topic MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_topic.c ${utils_SOURCES})
|
add_library(mod_topic MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_topic.c ${utils_SOURCES})
|
||||||
add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c ${utils_SOURCES})
|
|
||||||
|
|
||||||
target_link_libraries(mod_auth_sqlite sqlite3)
|
if (SQLITE_SUPPORT)
|
||||||
|
add_library(mod_auth_sqlite MODULE ${PROJECT_SOURCE_DIR}/plugins/mod_auth_sqlite.c ${utils_SOURCES})
|
||||||
|
add_executable(uhub-passwd ${PROJECT_SOURCE_DIR}/tools/uhub-passwd.c ${PROJECT_SOURCE_DIR}/util/misc.c ${PROJECT_SOURCE_DIR}/util/memory.c ${PROJECT_SOURCE_DIR}/util/log.c ${PROJECT_SOURCE_DIR}/util/list.c)
|
||||||
|
|
||||||
|
target_link_libraries(mod_auth_sqlite sqlite3)
|
||||||
|
target_link_libraries(uhub-passwd sqlite3)
|
||||||
|
set_target_properties(mod_auth_sqlite PROPERTIES PREFIX "")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
target_link_libraries(uhub ws2_32)
|
||||||
|
target_link_libraries(mod_logging ws2_32)
|
||||||
|
target_link_libraries(mod_welcome ws2_32)
|
||||||
|
endif()
|
||||||
|
|
||||||
set_target_properties(
|
set_target_properties(
|
||||||
mod_example
|
mod_example
|
||||||
|
@ -111,13 +126,15 @@ set_target_properties(
|
||||||
mod_chat_history
|
mod_chat_history
|
||||||
mod_chat_only
|
mod_chat_only
|
||||||
mod_topic
|
mod_topic
|
||||||
mod_auth_sqlite
|
|
||||||
PROPERTIES PREFIX "")
|
PROPERTIES PREFIX "")
|
||||||
|
|
||||||
target_link_libraries(uhub ${CMAKE_DL_LIBS} adc network utils)
|
target_link_libraries(uhub ${CMAKE_DL_LIBS} adc network utils)
|
||||||
target_link_libraries(uhub-passwd sqlite3)
|
|
||||||
|
|
||||||
target_link_libraries(uhub-admin adcclient adc network utils)
|
if(UNIX)
|
||||||
|
add_library(adcclient STATIC ${adcclient_SOURCES})
|
||||||
|
add_executable(uhub-admin ${PROJECT_SOURCE_DIR}/tools/admin.c ${adcclient_SOURCES})
|
||||||
|
target_link_libraries(uhub-admin adcclient adc network utils)
|
||||||
|
endif()
|
||||||
|
|
||||||
if(GIT_FOUND)
|
if(GIT_FOUND)
|
||||||
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION)
|
execute_process(COMMAND ${GIT_EXECUTABLE} show -s --pretty=format:%h OUTPUT_VARIABLE UHUB_REVISION)
|
||||||
|
@ -129,7 +146,9 @@ if(OPENSSL_FOUND)
|
||||||
add_definitions(-DSSL_SUPPORT=1)
|
add_definitions(-DSSL_SUPPORT=1)
|
||||||
include_directories(${OPENSSL_INCLUDE_DIR})
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
||||||
target_link_libraries(uhub ${OPENSSL_LIBRARIES})
|
target_link_libraries(uhub ${OPENSSL_LIBRARIES})
|
||||||
target_link_libraries(uhub-admin ${OPENSSL_LIBRARIES})
|
if(UNIX)
|
||||||
|
target_link_libraries(uhub-admin ${OPENSSL_LIBRARIES})
|
||||||
|
endif()
|
||||||
target_link_libraries(mod_welcome ${OPENSSL_LIBRARIES})
|
target_link_libraries(mod_welcome ${OPENSSL_LIBRARIES})
|
||||||
target_link_libraries(mod_logging ${OPENSSL_LIBRARIES})
|
target_link_libraries(mod_logging ${OPENSSL_LIBRARIES})
|
||||||
endif()
|
endif()
|
||||||
|
|
Loading…
Reference in New Issue