diff --git a/CMakeLists.txt b/CMakeLists.txt index 4666084..fcbf268 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.4.0) project(mathx CXX) +# Force out-of-tree builds +if("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") + message(SEND_ERROR "In-source builds are not allowed.") +endif("${PROJECT_SOURCE_DIR}" STREQUAL "${PROJECT_BINARY_DIR}") + # Include header files include_directories(mathx) diff --git a/README.md b/README.md index 9594362..718ee5c 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ We require the following packages before you try installing the package. - A c++ compiler (g++/clang++/msvc++) - Cmake (upwards of version 3.4) + - pkg-config (optional) ### Instructions @@ -21,15 +22,16 @@ We require the following packages before you try installing the package. ``` - Use the cmake command with CMAKE_INSTALL_PREFIX to select the directory to install to (not using this command will defaul to install directories) + We do not support in tree builds. ``` - $ cmake -DCMAKE_INSTALL_PREFIX=/path/to/install + $ cmake .. -DCMAKE_INSTALL_PREFIX=/path/to/install ``` For example, one can type: ``` - $ cmake -DCMAKE_INSTALL_PREFIX=/home/user/mathx_build/ + $ cmake -DCMAKE_INSTALL_PREFIX=/home/user/opt/build ``` - If cmake runs successfully, you should now be able to see a `Makefile` in the build directory. We currently support `clean` and `all` only. We will add more targets with future upgrades to cmake. Run: @@ -44,18 +46,19 @@ We require the following packages before you try installing the package. $ make install ``` + - To build mathx based applications using terminal/makefile, we highly recommend using pkg-config. To use pkg-config, you will have + to `export` pkg-config path. Run: + + ``` + $ export PKG_CONFIG_PATH=${PKG_CONFIG_PATH}:/path/to/install/lib/pkgconfig + ``` + __NOTE__: If you fail to provide the CMAKE_INSTALL_PREFIX, install location will be set to default (For example: /usr/local/ in case of Linux users.) ## Usage Instructions -Currently we do not support pkg-config so users will have to manually add the `includes` and `lib` using their respective flags. +The user can simply build applications using pkg-config. A simple example is given as: -Manually building: - -``` -(CXX_COMPILER) -o exec_name (CXX_FILES) -I/path/to/include -L/path/to/lib ``` - -__NOTE__: You dont need to provide the last two flags if library is installed in the default location. - -We are updating our CMakelists to provide more functionality to the users. +(CXX_COMPILER) -o exec_name (CXX_FILES) `pkg-config --cflags --libs mathx` +``` \ No newline at end of file