Update CMakeLists

This commit is contained in:
Robin Jadoul 2016-05-24 11:46:36 +02:00
parent e8cf7888c1
commit 03a6964246
2 changed files with 43 additions and 2 deletions

View File

@ -4,6 +4,38 @@ project(Lexesis VERSION 0.1)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED 11)
include_directories(include)
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 ""
EXCLUDE_FROM_ALL 1
)
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()
##########################################
set(CMAKE_INSTALL_PREFIX "${CMAKE_CURRENT_BINARY_DIR}")
include_directories(include)
add_subdirectory(src)
install(DIRECTORY templates
DESTINATION share/Lexesis
)

View File

@ -1,6 +1,15 @@
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY)
include_directories(${CMAKE_CURRENT_BINARY_DIR})
add_executable(Lexesis
main.cpp
automata.cpp
backend.cpp
re.cpp
inputparser.cpp
)
template.cpp
)
install(TARGETS Lexesis
RUNTIME DESTINATION bin
)