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
G I T _ R E P O S I T O R Y h t t p s : / / g i t h u b . c o m / n o 1 m s d / m s t c h
G I T _ T A G 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
G I T _ S U B M O D U L E S " N O N E \ C O M M A N D \ t r u e \ E R R O R _ Q U I E T "
C M A K E _ A R G S - D W I T H _ U N I T _ T E S T S = N O
I N S T A L L _ C O M M A N D " "
)
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
G I T _ R E P O S I T O R Y h t t p s : / / g i t h u b . c o m / m y i n t / o p t p a r s e
C O N F I G U R E _ C O M M A N D " "
B U I L D _ C O M M A N D " "
2016-05-26 12:17:28 +02:00
I N S T A L L _ C O M M A N D " "
)
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
D E S T I N A T I O N s h a r e / L e x e s i s
)
2016-05-29 20:21:31 +02:00
2017-01-26 14:57:24 +01:00
install ( DIRECTORY include/Lexesis
D E S T I N A T I O N i n c l u d e )
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 )