diff --git a/CMakeLists.txt b/CMakeLists.txt index 3b748b5..a12fe24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -39,17 +39,18 @@ ExternalProject_Add(ext-optparse ExternalProject_Get_Property(ext-optparse source_dir) include_directories(${source_dir}) -find_program(LEXESIS_EXE Lexesis) -if (NOT LEXESIS_EXE_FOUND) +find_package(Lexesis QUIET) +if (NOT LEXESIS_FOUND) #Lexesis ExternalProject_Add(ext-lexesis GIT_REPOSITORY git@gitlab.com:Robin_Jadoul/Lexesis.git + CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=. ) add_library(templ IMPORTED STATIC GLOBAL) add_dependencies(templ ext-lexesis) ExternalProject_Get_Property(ext-lexesis binary_dir source_dir) set_target_properties(templ PROPERTIES "IMPORTED_LOCATION" "${binary_dir}/src/${CMAKE_STATIC_LIBRARY_PREFIX}templ${CMAKE_STATIC_LIBRARY_SUFFIX}") - include_directories(${source_dir}/include) + include_directories(${binary_dir}/include) set(LEXESIS_EXE "${binary_dir}/bin/Lexesis") endif() @@ -138,4 +139,7 @@ install(DIRECTORY templates DESTINATION share/Parsodus ) +install(DIRECTORY include/Parsodus + DESTINATION include) + # add_subdirectory(examples) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index e464dac..ca20c11 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,7 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h @ONLY) include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}) -if (NOT LEXESIS_EXE_FOUND) +if (NOT LEXESIS_FOUND) add_custom_command(DEPENDS ext-lexesis "${CMAKE_CURRENT_SOURCE_DIR}/parsodusLexer.lxs" COMMAND ${LEXESIS_EXE} ARGS -d "${CMAKE_CURRENT_BINARY_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/parsodusLexer.lxs" OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/ParsodusLexer.h" "${CMAKE_CURRENT_BINARY_DIR}/ParsodusLexer.cpp" @@ -28,9 +28,6 @@ add_library(Parsodus-tables lrtables/LALR1Itemset.cpp ) -# add_library(Parsodus-backends -# ) - add_library(pds backend.cpp driver.cpp @@ -38,6 +35,7 @@ add_library(pds backendmanager.cpp "${CMAKE_CURRENT_BINARY_DIR}/ParsodusLexer.cpp" ) +add_dependencies(pds mstch::mstch) add_executable(Parsodus @@ -52,7 +50,9 @@ target_link_libraries(Parsodus mstch::mstch ) -install(TARGETS Parsodus +install(TARGETS Parsodus pds Parsodus-util Parsodus-tables RUNTIME DESTINATION bin + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib )