Parsodus/CMakeLists.txt

59 lines
1.9 KiB
CMake

cmake_minimum_required(VERSION 3.2.2)
project(Parsodus VERSION 1.0)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD_REQUIRED 14)
include(ExternalProject)
find_package(mstch QUIET)
if (NOT mstch_FOUND)
ExternalProject_Add(ext-mstch
GIT_REPOSITORY https://github.com/no1msd/mstch
GIT_TAG 1.0.2
#The following line is a dirty hack
#to prevent cmake from needlessly clone any submodule
#inspect `ext-mstch-prefix/tmp/ext-mstch-gitclone.cmake` for more info
GIT_SUBMODULES "NONE\ COMMAND\ true\ ERROR_QUIET"
CMAKE_ARGS -DWITH_UNIT_TESTS=NO
INSTALL_COMMAND ""
)
add_library(mstch::mstch IMPORTED STATIC GLOBAL)
add_dependencies(mstch::mstch ext-mstch)
ExternalProject_Get_Property(ext-mstch source_dir binary_dir)
set_target_properties(mstch::mstch PROPERTIES "IMPORTED_LOCATION" "${binary_dir}/src/${CMAKE_STATIC_LIBRARY_PREFIX}mstch${CMAKE_STATIC_LIBRARY_SUFFIX}")
include_directories(${source_dir}/include)
endif()
ExternalProject_Add(ext-optparse
GIT_REPOSITORY https://github.com/myint/optparse
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
INSTALL_COMMAND ""
)
ExternalProject_Get_Property(ext-optparse source_dir)
include_directories(${source_dir})
##########################################
find_package(Doxygen)
if(DOXYGEN_FOUND)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.in ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile @ONLY)
add_custom_target(doc ${DOXYGEN_EXECUTABLE} ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} COMMENT "Generating API documentation" VERBATIM)
endif(DOXYGEN_FOUND)
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}")
include_directories(include)
add_subdirectory(src)
add_dependencies(Parsodus ext-optparse)
install(DIRECTORY templates
DESTINATION share/Parsodus
)
# add_subdirectory(examples)