Properly install the project

This commit is contained in:
Thomas Avé 2017-01-26 15:47:58 +01:00
parent f1398ed261
commit 3f18453312
4 changed files with 15 additions and 8 deletions

View File

@ -45,8 +45,6 @@ if(DOXYGEN_FOUND)
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(Lexesis ext-optparse)
@ -59,3 +57,7 @@ install(DIRECTORY include/Lexesis
DESTINATION include)
add_subdirectory(examples)
install(EXPORT LexesisTargets DESTINATION lib/cmake/Lexesis)
install(FILES LexesisConfig.cmake DESTINATION lib/cmake/Lexesis)
install(DIRECTORY man/man1 man/man5 DESTINATION man)

5
LexesisConfig.cmake Normal file
View File

@ -0,0 +1,5 @@
get_filename_component(SELF_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH)
include(${SELF_DIR}/LexesisTargets.cmake)
get_filename_component(LEXESIS_INCLUDE_DIRS "${SELF_DIR}/../../../include/" ABSOLUTE)
get_filename_component(LEXESIS_EXE "${SELF_DIR}/../../../bin/Lexesis" ABSOLUTE)
set(LEXESIS_FOUND TRUE)

View File

@ -50,10 +50,9 @@ Get your terminal in the source tree and run the following commands:
cd build
cmake ..
make
make install
sudo make install
This will place the Lexesis executable in the `build/bin` folder, with some extra needed data for Lexesis in `build/share`
You can now simply run `./bin/Lexesis` with the arguments you like (see below and in the man pages for an overview).
You can now run `Lexesis`
If you want to build the documentation as well, simply run
@ -64,9 +63,9 @@ The output should be located in `build/doc`, with the main *html* page in `build
### Running tests
First, build Lexesis in debug mode. The first difference with the normal building, is the line where you call cmake. That line should read
cmake .. -DCMAKE_BUILD_TYPE=Debug
cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_INSTALL_PREFIX=.
instead. Afterwards, after calling `make install`, build all the examples as well with
instead. Afterwards, after calling `make install` (which now install locally in the build folder, so you don't need the sudo), build all the examples as well with
cmake .
make examples

View File

@ -39,8 +39,9 @@ if (CMAKE_BUILD_TYPE MATCHES Debug)
target_link_libraries(Lexesis-test Lexesis-backends lxs templ lxsinput mstch::mstch)
endif()
install(TARGETS Lexesis templ lxs Lexesis-backends lxsinput
install(TARGETS Lexesis templ lxs Lexesis-backends lxsinput EXPORT LexesisTargets
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
INCLUDES DESTINATION include
)