|
@@ -1,41 +1,41 @@
|
|
# The C API library
|
|
# The C API library
|
|
-add_library(c-library civetweb.c)
|
|
|
|
-set_target_properties(c-library PROPERTIES
|
|
|
|
|
|
+add_library(civetweb-c-library civetweb.c)
|
|
|
|
+set_target_properties(civetweb-c-library PROPERTIES
|
|
OUTPUT_NAME "civetweb"
|
|
OUTPUT_NAME "civetweb"
|
|
VERSION ${CIVETWEB_VERSION}
|
|
VERSION ${CIVETWEB_VERSION}
|
|
SOVERSION ${CIVETWEB_VERSION}
|
|
SOVERSION ${CIVETWEB_VERSION}
|
|
)
|
|
)
|
|
if (BUILD_SHARED_LIBS)
|
|
if (BUILD_SHARED_LIBS)
|
|
- target_compile_definitions(c-library PRIVATE CIVETWEB_DLL_EXPORTS)
|
|
|
|
|
|
+ target_compile_definitions(civetweb-c-library PRIVATE CIVETWEB_DLL_EXPORTS)
|
|
endif()
|
|
endif()
|
|
target_include_directories(
|
|
target_include_directories(
|
|
- c-library PUBLIC
|
|
|
|
|
|
+ civetweb-c-library PUBLIC
|
|
${PROJECT_SOURCE_DIR}/include)
|
|
${PROJECT_SOURCE_DIR}/include)
|
|
install(
|
|
install(
|
|
- TARGETS c-library
|
|
|
|
|
|
+ TARGETS civetweb-c-library
|
|
ARCHIVE DESTINATION lib
|
|
ARCHIVE DESTINATION lib
|
|
LIBRARY DESTINATION lib
|
|
LIBRARY DESTINATION lib
|
|
RUNTIME DESTINATION bin
|
|
RUNTIME DESTINATION bin
|
|
- COMPONENT c-library)
|
|
|
|
|
|
+ COMPONENT civetweb-c-library)
|
|
install(FILES
|
|
install(FILES
|
|
${PROJECT_SOURCE_DIR}/include/civetweb.h
|
|
${PROJECT_SOURCE_DIR}/include/civetweb.h
|
|
DESTINATION include
|
|
DESTINATION include
|
|
- COMPONENT c-library)
|
|
|
|
|
|
+ COMPONENT civetweb-c-library)
|
|
|
|
|
|
# Need Windows sockets if available
|
|
# Need Windows sockets if available
|
|
find_package(WinSock)
|
|
find_package(WinSock)
|
|
if (WINSOCK_FOUND)
|
|
if (WINSOCK_FOUND)
|
|
- target_link_libraries(c-library WINSOCK::WINSOCK)
|
|
|
|
|
|
+ target_link_libraries(civetweb-c-library WINSOCK::WINSOCK)
|
|
endif()
|
|
endif()
|
|
|
|
|
|
# We need threading
|
|
# We need threading
|
|
find_package(Threads)
|
|
find_package(Threads)
|
|
-target_link_libraries(c-library ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
|
+target_link_libraries(civetweb-c-library ${CMAKE_THREAD_LIBS_INIT})
|
|
|
|
|
|
# Need the realtime library if we're using timers
|
|
# Need the realtime library if we're using timers
|
|
find_package(LibRt)
|
|
find_package(LibRt)
|
|
if (CIVETWEB_ENABLE_WEBSOCKETS AND CIVETWEB_ENABLE_LUA AND LIBRT_FOUND)
|
|
if (CIVETWEB_ENABLE_WEBSOCKETS AND CIVETWEB_ENABLE_LUA AND LIBRT_FOUND)
|
|
- target_link_libraries(c-library LIBRT::LIBRT)
|
|
|
|
|
|
+ target_link_libraries(civetweb-c-library LIBRT::LIBRT)
|
|
endif()
|
|
endif()
|
|
|
|
|
|
# We need to link OpenSSL if not dynamically loading
|
|
# We need to link OpenSSL if not dynamically loading
|
|
@@ -43,13 +43,13 @@ if (CIVETWEB_ENABLE_SSL)
|
|
if (CIVETWEB_ENABLE_SSL_DYNAMIC_LOADING)
|
|
if (CIVETWEB_ENABLE_SSL_DYNAMIC_LOADING)
|
|
find_package(LibDl)
|
|
find_package(LibDl)
|
|
if (LIBDL_FOUND)
|
|
if (LIBDL_FOUND)
|
|
- target_link_libraries(c-library -ldl)
|
|
|
|
|
|
+ target_link_libraries(civetweb-c-library -ldl)
|
|
endif()
|
|
endif()
|
|
else()
|
|
else()
|
|
find_package(OpenSSL)
|
|
find_package(OpenSSL)
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
include_directories(${OPENSSL_INCLUDE_DIR})
|
|
message(STATUS "OpenSSL include directory: ${OPENSSL_INCLUDE_DIR}")
|
|
message(STATUS "OpenSSL include directory: ${OPENSSL_INCLUDE_DIR}")
|
|
- target_link_libraries(c-library ${OPENSSL_LIBRARIES})
|
|
|
|
|
|
+ target_link_libraries(civetweb-c-library ${OPENSSL_LIBRARIES})
|
|
endif()
|
|
endif()
|
|
endif()
|
|
endif()
|
|
|
|
|
|
@@ -103,7 +103,7 @@ if (CIVETWEB_ENABLE_LUA)
|
|
link_directories("${LUA_INSTALL_DIR}/lib")
|
|
link_directories("${LUA_INSTALL_DIR}/lib")
|
|
include_directories("${LUA_INSTALL_DIR}/include")
|
|
include_directories("${LUA_INSTALL_DIR}/include")
|
|
set(LUA_LIBRARIES "${LUA_INSTALL_DIR}/lib/liblua.a")
|
|
set(LUA_LIBRARIES "${LUA_INSTALL_DIR}/lib/liblua.a")
|
|
- add_dependencies(c-library lua)
|
|
|
|
|
|
+ add_dependencies(civetweb-c-library lua)
|
|
else()
|
|
else()
|
|
find_package(Lua)
|
|
find_package(Lua)
|
|
endif()
|
|
endif()
|
|
@@ -131,7 +131,7 @@ if (CIVETWEB_ENABLE_LUA)
|
|
link_directories("${LUA_FILESYSTEM_INSTALL_DIR}/lib")
|
|
link_directories("${LUA_FILESYSTEM_INSTALL_DIR}/lib")
|
|
include_directories("${LUA_FILESYSTEM_INSTALL_DIR}/include")
|
|
include_directories("${LUA_FILESYSTEM_INSTALL_DIR}/include")
|
|
set(LUA_LIBRARIES "${LUA_LIBRARIES};${LUA_FILESYSTEM_INSTALL_DIR}/lib/libluafilesystem.a")
|
|
set(LUA_LIBRARIES "${LUA_LIBRARIES};${LUA_FILESYSTEM_INSTALL_DIR}/lib/libluafilesystem.a")
|
|
- add_dependencies(c-library luafilesystem)
|
|
|
|
|
|
+ add_dependencies(civetweb-c-library luafilesystem)
|
|
|
|
|
|
# Lua SQLite Support
|
|
# Lua SQLite Support
|
|
if (${CIVETWEB_LUA_SQLITE_VERSION} VERSION_EQUAL "0.9.3")
|
|
if (${CIVETWEB_LUA_SQLITE_VERSION} VERSION_EQUAL "0.9.3")
|
|
@@ -163,7 +163,7 @@ if (CIVETWEB_ENABLE_LUA)
|
|
unset(INSTALL_DIR)
|
|
unset(INSTALL_DIR)
|
|
link_directories("${LUA_SQLITE_INSTALL_DIR}/lib")
|
|
link_directories("${LUA_SQLITE_INSTALL_DIR}/lib")
|
|
set(LUA_LIBRARIES "${LUA_LIBRARIES};${LUA_SQLITE_INSTALL_DIR}/lib/libluasqlite.a")
|
|
set(LUA_LIBRARIES "${LUA_LIBRARIES};${LUA_SQLITE_INSTALL_DIR}/lib/libluasqlite.a")
|
|
- add_dependencies(c-library luasqlite)
|
|
|
|
|
|
+ add_dependencies(civetweb-c-library luasqlite)
|
|
|
|
|
|
# Lua XML Support
|
|
# Lua XML Support
|
|
if (${CIVETWEB_LUA_XML_VERSION} VERSION_EQUAL "1.8.0")
|
|
if (${CIVETWEB_LUA_XML_VERSION} VERSION_EQUAL "1.8.0")
|
|
@@ -204,7 +204,7 @@ if (CIVETWEB_ENABLE_LUA)
|
|
unset(INSTALL_DIR)
|
|
unset(INSTALL_DIR)
|
|
link_directories("${LUA_XML_INSTALL_DIR}/lib")
|
|
link_directories("${LUA_XML_INSTALL_DIR}/lib")
|
|
set(LUA_LIBRARIES "${LUA_LIBRARIES};${LUA_XML_INSTALL_DIR}/lib/libluaxml.a")
|
|
set(LUA_LIBRARIES "${LUA_LIBRARIES};${LUA_XML_INSTALL_DIR}/lib/libluaxml.a")
|
|
- add_dependencies(c-library luaxml)
|
|
|
|
|
|
+ add_dependencies(civetweb-c-library luaxml)
|
|
|
|
|
|
# SQLite Support
|
|
# SQLite Support
|
|
string (REGEX MATCHALL "[0-9]+" SQLITE_VERSION_MATCHES ${CIVETWEB_SQLITE_VERSION})
|
|
string (REGEX MATCHALL "[0-9]+" SQLITE_VERSION_MATCHES ${CIVETWEB_SQLITE_VERSION})
|
|
@@ -233,34 +233,36 @@ if (CIVETWEB_ENABLE_LUA)
|
|
link_directories("${SQLITE_INSTALL_DIR}/lib")
|
|
link_directories("${SQLITE_INSTALL_DIR}/lib")
|
|
include_directories("${SQLITE_INSTALL_DIR}/include")
|
|
include_directories("${SQLITE_INSTALL_DIR}/include")
|
|
set(LUA_LIBRARIES "${LUA_LIBRARIES};${SQLITE_INSTALL_DIR}/lib/libsqlite.a")
|
|
set(LUA_LIBRARIES "${LUA_LIBRARIES};${SQLITE_INSTALL_DIR}/lib/libsqlite.a")
|
|
- add_dependencies(c-library sqlite)
|
|
|
|
|
|
+ add_dependencies(civetweb-c-library sqlite)
|
|
|
|
|
|
# Link all the Lua libraries
|
|
# Link all the Lua libraries
|
|
- target_link_libraries(c-library ${LUA_LIBRARIES})
|
|
|
|
|
|
+ target_link_libraries(civetweb-c-library ${LUA_LIBRARIES})
|
|
endif()
|
|
endif()
|
|
|
|
|
|
# The web server executable
|
|
# The web server executable
|
|
-add_executable(c-executable main.c)
|
|
|
|
-set_target_properties(c-executable PROPERTIES
|
|
|
|
- OUTPUT_NAME "civetweb"
|
|
|
|
-)
|
|
|
|
-if (CIVETWEB_INSTALL_EXECUTABLE)
|
|
|
|
- install(
|
|
|
|
- TARGETS c-executable
|
|
|
|
- ARCHIVE DESTINATION lib
|
|
|
|
- LIBRARY DESTINATION lib
|
|
|
|
- RUNTIME DESTINATION bin
|
|
|
|
- COMPONENT server)
|
|
|
|
-endif()
|
|
|
|
-if (BUILD_SHARED_LIBS)
|
|
|
|
- target_compile_definitions(c-executable PRIVATE CIVETWEB_DLL_IMPORTS)
|
|
|
|
-endif()
|
|
|
|
-target_include_directories(
|
|
|
|
- c-executable PUBLIC
|
|
|
|
- ${PROJECT_SOURCE_DIR}/include)
|
|
|
|
-target_link_libraries(c-executable c-library)
|
|
|
|
-if (LIBRT_FOUND)
|
|
|
|
- target_link_libraries(c-executable LIBRT::LIBRT)
|
|
|
|
|
|
+if (CIVETWEB_ENABLE_SERVER_EXECUTABLE)
|
|
|
|
+ add_executable(civetweb-c-executable main.c)
|
|
|
|
+ set_target_properties(civetweb-c-executable PROPERTIES
|
|
|
|
+ OUTPUT_NAME "civetweb"
|
|
|
|
+ )
|
|
|
|
+ if (CIVETWEB_INSTALL_EXECUTABLE)
|
|
|
|
+ install(
|
|
|
|
+ TARGETS civetweb-c-executable
|
|
|
|
+ ARCHIVE DESTINATION lib
|
|
|
|
+ LIBRARY DESTINATION lib
|
|
|
|
+ RUNTIME DESTINATION bin
|
|
|
|
+ COMPONENT server)
|
|
|
|
+ endif()
|
|
|
|
+ if (BUILD_SHARED_LIBS)
|
|
|
|
+ target_compile_definitions(civetweb-c-executable PRIVATE CIVETWEB_DLL_IMPORTS)
|
|
|
|
+ endif()
|
|
|
|
+ target_include_directories(
|
|
|
|
+ civetweb-c-executable PUBLIC
|
|
|
|
+ ${PROJECT_SOURCE_DIR}/include)
|
|
|
|
+ target_link_libraries(civetweb-c-executable civetweb-c-library)
|
|
|
|
+ if (LIBRT_FOUND)
|
|
|
|
+ target_link_libraries(civetweb-c-executable LIBRT::LIBRT)
|
|
|
|
+ endif()
|
|
endif()
|
|
endif()
|
|
|
|
|
|
if (CIVETWEB_ENABLE_LUA)
|
|
if (CIVETWEB_ENABLE_LUA)
|