diff --git a/CMakeLists.txt b/CMakeLists.txt
index 79dc05a..6103b5b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -8,10 +8,10 @@ cmake_policy(SET CMP0076 NEW)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
find_package(nlohmann_json REQUIRED)
-find_package(PkgConfig REQUIRED)
-pkg_check_modules(FCGI fcgi)
+find_package(FCGI REQUIRED)
add_executable(pica main.cpp)
target_include_directories(pica PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
@@ -22,8 +22,8 @@ add_subdirectory(response)
add_subdirectory(stream)
target_link_libraries(pica PRIVATE
- fcgi
- fcgi++
+ FCGI::FCGI
+ FCGI::FCGI++
nlohmann_json::nlohmann_json
)
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..3f77108
--- /dev/null
+++ b/README.md
@@ -0,0 +1,60 @@
+# Pica - Backend for Megpie budgeting app
+
+... some description
+
+### Prerequisites
+
+- fcgi
+- nlohmann_json
+
+
+### Building
+
+```
+$ git clone https://git.macaw.me/blue/pica
+$ cd pica
+$ mkdir build
+$ cd build
+$ cmake ..
+$ cmake --build .
+```
+
+### Usage
+
+#### Webserver
+First you need a webserver. In this example I'm going to use apache.
+
+Install apache from your package manager.
+
+Create a file like this in apache config dir (in my case it's `/etc/httpd/conf/extra/fcgi-pica.conf`)
+```
+
+ ProxyPass "unix:/run/pica/pica.sock|fcgi://localhost"
+ ProxyPassReverse "http://localhost"
+
+```
+
+Incude this file from apache config file (in my case it's `/etc/httpd/conf/httpd.conf`)
+```
+Include conf/extra/fcgi-pica.conf
+```
+
+Start apache
+
+```
+$ sudo systemctl start httpd
+```
+
+#### Creating a directory
+Next you need to create a directory for pica socket file
+```
+# mkdir /run/pica
+# chown /run/pica
+```
+
+#### Running an app
+At this stage we're redy to run an app
+```
+$ cd build
+$ ./pica
+```
diff --git a/cmake/FindFCGI.cmake b/cmake/FindFCGI.cmake
new file mode 100644
index 0000000..e3a3e88
--- /dev/null
+++ b/cmake/FindFCGI.cmake
@@ -0,0 +1,28 @@
+find_library(FCGI_LIBRARIES fcgi NAMES FCGI libfcgi)
+find_library(FCGI++_LIBRARIES fcgi++ NAMES FCGI++ libfcgi++)
+
+if (FCGI_LIBRARIES AND FCGI++_LIBRARIES)
+ set(FCGI_FOUND TRUE)
+endif()
+
+if (FCGI_FOUND)
+ add_library(FCGI::FCGI SHARED IMPORTED)
+ set_target_properties(FCGI::FCGI PROPERTIES
+ IMPORTED_LOCATION "${FCGI_LIBRARIES}"
+ INTERFACE_LINK_LIBRARIES "${FCGI_LIBRARIES}"
+ )
+ add_library(FCGI::FCGI++ SHARED IMPORTED)
+ set_target_properties(FCGI::FCGI++ PROPERTIES
+ IMPORTED_LOCATION "${FCGI++_LIBRARIES}"
+ INTERFACE_LINK_LIBRARIES "${FCGI++_LIBRARIES}"
+ )
+
+ if (NOT FCGI_FIND_QUIETLY)
+ message(STATUS "Found FCGI library: ${FCGI_LIBRARIES}")
+ message(STATUS "Found FCGI++ library: ${FCGI++_LIBRARIES}")
+ endif ()
+else ()
+ if (FCGI_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find FCGI development files")
+ endif ()
+endif ()