Lexesis/CMakeLists.txt

85 lines
3.2 KiB
CMake
Raw Normal View History

2017-01-30 15:53:19 +01:00
# Lexesis - A language agnostic lexical analyser generator
# Copyright © 2016-2017 Thomas Avé, Robin Jadoul
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the "Software"),
# to deal in the Software without restriction, including without limitation
# the rights to use, copy, modify, merge, publish, distribute, sublicense,
# and/or sell copies of the Software, and to permit persons to whom the
# Software is furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
# OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
# DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
# OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
2016-04-26 12:35:53 +02:00
cmake_minimum_required(VERSION 3.2.2)
2016-05-27 16:22:12 +02:00
project(Lexesis VERSION 1.0)
2016-04-26 12:35:53 +02:00
set(CMAKE_CXX_STANDARD 11)
2016-05-24 01:14:15 +02:00
set(CMAKE_CXX_STANDARD_REQUIRED 11)
2016-04-26 12:35:53 +02:00
2016-05-24 11:46:36 +02:00
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()
2016-05-26 15:59:57 +02:00
ExternalProject_Add(ext-optparse
2016-05-28 15:29:34 +02:00
GIT_REPOSITORY https://github.com/myint/optparse
CONFIGURE_COMMAND ""
BUILD_COMMAND ""
2016-05-26 12:17:28 +02:00
INSTALL_COMMAND ""
)
2016-05-28 15:29:34 +02:00
ExternalProject_Get_Property(ext-optparse source_dir)
2016-05-26 12:17:28 +02:00
include_directories(${source_dir})
2016-05-24 11:46:36 +02:00
##########################################
2016-05-27 15:21:10 +02:00
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)
2016-05-24 11:46:36 +02:00
include_directories(include)
2016-04-26 12:35:53 +02:00
add_subdirectory(src)
2016-05-28 15:29:34 +02:00
add_dependencies(Lexesis ext-optparse)
2016-05-24 11:46:36 +02:00
install(DIRECTORY templates
DESTINATION share/Lexesis
)
2016-05-29 20:21:31 +02:00
2017-01-26 14:57:24 +01:00
install(DIRECTORY include/Lexesis
DESTINATION include)
2016-05-29 20:21:31 +02:00
add_subdirectory(examples)
2017-01-26 15:47:58 +01:00
install(EXPORT LexesisTargets DESTINATION lib/cmake/Lexesis)
install(FILES LexesisConfig.cmake DESTINATION lib/cmake/Lexesis)
install(DIRECTORY man/man1 man/man5 DESTINATION man)