From 8c19b96bb74b2800ae66ac7322f1cfd462272cfe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Ortega=20Froysa?= Date: Sun, 25 Mar 2018 12:30:39 +0200 Subject: [PATCH] New install target. --- CMakeLists.txt | 18 ++++++++++++++---- README | 6 +++++- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 715be84..17d445b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,8 +33,13 @@ set(CMAKE_C_FLAGS_RELEASE "-O3") set(CMAKE_C_FLAGS_RELWITHDEBINFO "-g -O3") set(CMAKE_C_FLAGS_MINSIZEREL "-Os") -# TODO: detect libraries here -# TODO: set include directories here +find_package(PkgConfig REQUIRED) +pkg_check_modules(ALLEG5 REQUIRED allegro-5) +pkg_check_modules(ALLEG5-PRIM REQUIRED allegro_primitives-5) +pkg_check_modules(ALLEG5-FONT REQUIRED allegro_font-5) + +include_directories( + SYSTEM ${ALLEG5_INCLUDE_DIRS}) set(SRCS src/main.c) @@ -50,6 +55,11 @@ endif() add_executable(${TARGET_NAME} ${SRCS}) -# TODO: link libraries +target_link_libraries(${TARGET_NAME} + ${ALLEG5_LIBRARIES} + ${ALLEG5-PRIM_LIBRARIES} + ${ALLEG5-FONT_LIBRARIES}) -# TODO: create install instructions +install(TARGETS ${TARGET_NAME} + RUNTIME DESTINATION bin/ + CONFIGURATIONS release minsizerel) diff --git a/README b/README index 0632cb8..6a6e8a6 100644 --- a/README +++ b/README @@ -21,7 +21,11 @@ You can then compile the program via the following commands: This will create a release build with compiler optimizations. If you would like a debug build then pass the `-DCMAKE_BUILD_TYPE=debug' flag to the `cmake' -command. +command. If you would like to install then run `cmake' with the additional flag +`-DCMAKE_INSTALL_PREFIX='. If you are installing as a user then +you may want to set the installation prefix to `/usr/local/', and if you're +packaging then please consult your distribution's policies. With this you +should be able to run the `make install' target and install the binary. # Contributing --------------