CMakeLists.txt
browsing at commit = 4fe276c400f51581a3858e55f7b9a48a1f90f419
cmake_minimum_required(VERSION 3.16)
project(git_frontend CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
# --- Dependencies ---------------------------------------------------------
find_package(PkgConfig REQUIRED)
pkg_check_modules(GIT2 REQUIRED libgit2)
# cppcms / booster ship no pkg-config or CMake package, so locate them directly.
find_path(CPPCMS_INCLUDE_DIR cppcms/application.h
PATHS /usr/local/include /usr/include)
find_library(CPPCMS_LIBRARY NAMES cppcms
PATHS /usr/local/lib /usr/lib)
find_library(BOOSTER_LIBRARY NAMES booster
PATHS /usr/local/lib /usr/lib)
if(NOT CPPCMS_INCLUDE_DIR OR NOT CPPCMS_LIBRARY OR NOT BOOSTER_LIBRARY)
message(FATAL_ERROR "cppcms/booster not found. Install cppcms first.")
endif()
find_program(CPPCMS_TMPL_CC NAMES cppcms_tmpl_cc REQUIRED)
# --- Generate cppcms views from the template skin -------------------------
set(SKIN ${CMAKE_CURRENT_SOURCE_DIR}/templates/skin.tmpl)
set(VIEWS_CPP ${CMAKE_CURRENT_BINARY_DIR}/views.cpp)
add_custom_command(
OUTPUT ${VIEWS_CPP}
COMMAND ${CPPCMS_TMPL_CC} ${SKIN} -o ${VIEWS_CPP}
DEPENDS ${SKIN}
COMMENT "Generating cppcms views from skin.tmpl"
VERBATIM)
# --- Application ----------------------------------------------------------
add_executable(git_frontend
src/main.cpp
src/application.cpp
src/git_repo.cpp
src/repo_scanner.cpp
src/util.cpp
${VIEWS_CPP})
target_include_directories(git_frontend PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/src
${CPPCMS_INCLUDE_DIR}
${GIT2_INCLUDE_DIRS})
target_link_libraries(git_frontend PRIVATE
${CPPCMS_LIBRARY}
${BOOSTER_LIBRARY}
${GIT2_LIBRARIES}
pthread)
target_compile_options(git_frontend PRIVATE ${GIT2_CFLAGS_OTHER})