Files
singlechat/CMakeLists.txt
Torsten Schulz e8655dc79b working version
2024-07-24 16:22:57 +02:00

73 lines
1.7 KiB
CMake

cmake_minimum_required(VERSION 3.5)
project(singlechat.wt LANGUAGES CXX)
add_compile_options(-Wno-deprecated-declarations)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_COMPILER "/usr/bin/g++-12")
# Set default build type if not specified
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# Set compiler flags based on build type
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_compile_options(-g)
else()
add_compile_options(-O2)
endif()
add_executable(${PROJECT_NAME}
src/main.cpp
src/broadcast.cpp
src/app.cpp
)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20)
find_package(Threads REQUIRED)
target_link_libraries(${PROJECT_NAME}
wt
wthttp
curl
xml2
${CMAKE_THREAD_LIBS_INIT}
)
find_package(Boost COMPONENTS system filesystem REQUIRED)
if(Boost_FOUND)
include_directories(${Boost_INCLUDE_DIRS})
target_link_libraries(${PROJECT_NAME} ${Boost_LIBRARIES} GraphicsMagick++ GraphicsMagick)
endif()
if(UNIX)
find_package(PkgConfig)
pkg_check_modules(XML2 libxml-2.0)
if(XML2_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${XML2_INCLUDE_DIRS})
endif()
endif()
if(UNIX)
find_package(PkgConfig)
pkg_check_modules(XML2 libxml-2.0)
if(XML2_FOUND)
target_include_directories(${PROJECT_NAME} PRIVATE ${XML2_INCLUDE_DIRS} /usr/include/GraphicsMagick)
endif()
endif()
include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION /opt/ypchat/bin
)
# Install docroot directory and handle logs setup
install(DIRECTORY docroot/
DESTINATION /opt/ypchat/docroot
)
install(CODE "file(MAKE_DIRECTORY /opt/ypchat/logs)")
install(CODE "execute_process(COMMAND chmod 777 /opt/ypchat/logs)")